/* ==========================================================================
   ELITE RISK OF RUIN CSS
   Glassmorphism, Quant Terminal Vibes, Custom SVGs
   ========================================================================== */

/* Layout */
.ruin-container { margin-left: 20px; padding: 32px; min-height: 100vh; color: #ffffff; display: flex; flex-direction: column; gap: 24px; }
.ruin-grid-layout { display: flex; gap: 24px; align-items: flex-start; }
.ruin-inputs-panel { width: 380px; flex-shrink: 0; position: sticky; top: 32px; }
.ruin-results-panel { flex-grow: 1; display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.ruin-grid-2-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* Utilities */
.hidden { display: none !important; }
.m-0 { margin: 0; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.text-sm { font-size: 0.85rem; } .text-muted { color: rgba(255,255,255,0.6); }
.text-cyan { color: #06b6d4; } .text-purple { color: #c084fc; } .text-red { color: #ef5350; } .text-green { color: #22c55e; } .text-gold { color: #fbbf24; }

/* Animations */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulseBtn { 0% { box-shadow: 0 0 0 0 rgba(168,85,247,0.6); } 70% { box-shadow: 0 0 0 15px rgba(168,85,247,0); } 100% { box-shadow: 0 0 0 0 rgba(168,85,247,0); } }
@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes drawPath { to { stroke-dashoffset: 0; } }

.fade-in { animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.pulse-btn { animation: pulseBtn 2s infinite; }
.spin-dice { font-size: 3rem; animation: spin 2s linear infinite; margin-bottom: 16px; }

/* Cards (Glassmorphism) */
.ruin-card { background: rgba(255,255,255,0.03); backdrop-filter: blur(24px) saturate(180%); border: 1px solid rgba(255,255,255,0.08); border-radius: 24px; padding: 24px; box-shadow: 0 8px 32px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05); }
.ruin-card-title { font-size: 1.1rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }

/* Header Elements */
.ruin-header { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 24px; }
.ruin-header__title { font-size: 2.2rem; font-weight: 800; margin: 0 0 8px 0; letter-spacing: 1px; }
.ruin-header__subtitle { color: #c084fc; margin: 0; font-size: 1rem; }
.ruin-header__stats { display: flex; gap: 24px; }
.ruin-stat-card { text-align: center; }
.ruin-stat-val { display: block; font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ruin-stat-label { font-size: 0.75rem; color: rgba(255,255,255,0.5); text-transform: uppercase; }

/* Buttons */
.ruin-btn { padding: 10px 20px; border-radius: 12px; font-weight: 600; font-size: 0.85rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); border: none; text-transform: uppercase; letter-spacing: 0.5px; }
.ruin-btn--primary { background: linear-gradient(135deg, #a855f7, #7e22ce); color: white; }
.ruin-btn--primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5); }
.ruin-btn--secondary { background: rgba(255,255,255,0.05); color: white; border: 1px solid rgba(255,255,255,0.1); }
.ruin-btn--secondary:hover { background: rgba(255,255,255,0.1); border-color: #c084fc; color: #c084fc; }
.ruin-btn--massive { width: 100%; padding: 16px; font-size: 1.1rem; border-radius: 16px; margin-top: 16px; }

/* Forms & Inputs */
.ruin-section-label { font-size: 0.8rem; color: #c084fc; text-transform: uppercase; letter-spacing: 1px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 4px; margin: 24px 0 16px 0; }
.form-group { margin-bottom: 16px; }
.form-group label { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.85rem; color: rgba(255,255,255,0.8); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ruin-input, .ruin-select { width: 100%; padding: 10px 14px; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1); color: white; border-radius: 8px; transition: 0.3s; font-family: inherit; }
.ruin-input:focus, .ruin-select:focus { outline: none; border-color: #c084fc; box-shadow: 0 0 0 2px rgba(192,132,252,0.2); }

/* Sliders */
.ruin-range-wrapper { padding: 8px 0; }
.ruin-range { -webkit-appearance: none; width: 100%; height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; outline: none; transition: 0.2s; }
.ruin-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #c084fc; cursor: pointer; box-shadow: 0 0 10px rgba(192,132,252,0.5); transition: 0.2s; }
.ruin-range::-webkit-slider-thumb:hover { transform: scale(1.2); }

/* Switch Toggle */
.ruin-toggle-row { display: flex; justify-content: space-between; align-items: center; }
.ruin-switch { position: relative; display: inline-block; width: 48px; height: 24px; }
.ruin-switch input { opacity: 0; width: 0; height: 0; }
.ruin-slider-toggle { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255,255,255,0.1); transition: .4s; border-radius: 24px; }
.ruin-slider-toggle:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
.ruin-switch input:checked + .ruin-slider-toggle { background-color: #a855f7; }
.ruin-switch input:checked + .ruin-slider-toggle:before { transform: translateX(24px); }

.ruin-expectancy-box { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); padding: 12px; border-radius: 8px; text-align: center; color: #22c55e; font-weight: 700; margin-top: 16px; }

/* Simulation Progress */
.ruin-progress { background: rgba(20,15,25,0.95); border: 1px solid #c084fc; border-radius: 24px; padding: 48px; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 300px; box-shadow: 0 0 40px rgba(192,132,252,0.2); }
.ruin-progress-bar { width: 80%; max-width: 400px; height: 8px; background: rgba(255,255,255,0.1); border-radius: 4px; margin-top: 24px; overflow: hidden; }
.ruin-progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #a855f7, #06b6d4, #a855f7); background-size: 200% 100%; animation: shimmer 2s linear infinite; transition: width 0.1s; }

/* Hero Results */
.ruin-hero { display: flex; justify-content: space-between; align-items: center; background: radial-gradient(circle at right, rgba(168,85,247,0.1) 0%, rgba(2,0,5,0.5) 70%); border: 1px solid rgba(192,132,252,0.3); }
.ruin-hero__left { display: flex; flex-direction: column; align-items: flex-start; }
.ruin-hero-label { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 2px; color: rgba(255,255,255,0.6); }
.ruin-hero-value { font-size: 5rem; font-weight: 800; margin: 0; line-height: 1; font-variant-numeric: tabular-nums; text-shadow: 0 4px 20px rgba(0,0,0,0.5); }
.ruin-verdict-chip { margin-top: 16px; padding: 8px 16px; border-radius: 12px; font-weight: 800; letter-spacing: 1px; }

.ruin-kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; background: rgba(0,0,0,0.4); padding: 24px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.05); }
.ruin-kpi { display: flex; flex-direction: column; }
.ruin-kpi .lbl { font-size: 0.75rem; color: rgba(255,255,255,0.5); text-transform: uppercase; }
.ruin-kpi .val { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* SVG Visualizations */
.ruin-svg-container { width: 100%; height: 350px; background: rgba(0,0,0,0.2); border-radius: 12px; position: relative; overflow: hidden; border: 1px solid rgba(255,255,255,0.05); }
.chart-header { display: flex; justify-content: space-between; align-items: baseline; }
.chart-header h3 { margin: 0; font-size: 1.1rem; }

/* Heatmap */
.ruin-heatmap { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; border-radius: 8px; overflow: hidden; }
.hm-cell { padding: 12px 4px; text-align: center; font-size: 0.75rem; font-weight: 700; color: #fff; text-shadow: 1px 1px 2px rgba(0,0,0,0.8); transition: transform 0.2s; cursor: crosshair; }
.hm-cell:hover { transform: scale(1.1); z-index: 10; border: 1px solid white; }
.hm-label-row { font-size: 0.7rem; color: rgba(255,255,255,0.5); text-align: center; padding: 4px; }

/* Streaks */
.streak-stats { display: flex; flex-direction: column; gap: 12px; background: rgba(0,0,0,0.3); padding: 16px; border-radius: 12px; }
.streak-item { display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.streak-val { font-size: 1.4rem; font-weight: 800; }

/* Insights List */
.ruin-insights-list { list-style: none; padding: 0; margin: 16px 0 0 0; display: flex; flex-direction: column; gap: 12px; }
.ruin-insights-list li { background: rgba(255,255,255,0.05); padding: 16px; border-radius: 12px; border-left: 3px solid #c084fc; font-size: 0.95rem; }

/* Modals */
.ruin-modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.ruin-modal__overlay { position: absolute; width: 100%; height: 100%; background: rgba(0,0,0,0.8); backdrop-filter: blur(8px); }
.ruin-modal__content { position: relative; background: #0d0b12; border: 1px solid rgba(255,255,255,0.1); border-radius: 24px; width: 90%; max-width: 600px; padding: 32px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); animation: fadeInUp 0.3s ease-out; }
.ruin-modal__close { position: absolute; top: 24px; right: 24px; background: none; border: none; color: rgba(255,255,255,0.5); font-size: 1.5rem; cursor: pointer; }
.ruin-modal__close:hover { color: white; }
.saved-list { display: flex; flex-direction: column; gap: 12px; max-height: 400px; overflow-y: auto; padding-right: 8px; }
.saved-item { display: flex; justify-content: space-between; align-items: center; background: rgba(255,255,255,0.05); padding: 16px; border-radius: 12px; cursor: pointer; transition: 0.2s; }
.saved-item:hover { background: rgba(192,132,252,0.1); border: 1px solid #c084fc; }

/* Custom Tooltip */
.tooltip-trigger { cursor: help; position: relative; }
.tooltip-trigger:hover::after { content: attr(data-tip); position: absolute; bottom: 150%; left: 50%; transform: translateX(-50%); background: #000; padding: 8px 12px; font-size: 0.75rem; border-radius: 8px; border: 1px solid rgba(255,255,255,0.2); white-space: normal; width: max-content; max-width: 250px; z-index: 10; color: #fff; text-transform: none; letter-spacing: normal; font-weight: normal; }