/* ============================================================
   AI Strategy Lab — Premium Custom Stylesheet
   Scoped to .strategy-* and #tab-content-strategylab elements.
   ============================================================ */

/* --- Main Layout --- */
#tab-content-strategylab {
    animation: strategyFadeIn .4s cubic-bezier(.16, 1, .3, 1);
}
@keyframes strategyFadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.strategy-grid {
    display: grid;
    grid-template-columns: 320px 1fr 340px;
    gap: 20px;
    margin-bottom: 24px;
    align-items: start;
}

/* --- Glassmorphic Section Containers --- */
.strategy-panel {
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--panel);
    backdrop-filter: blur(24px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: border-color .3s, transform .2s;
}
.strategy-panel:hover {
    border-color: rgba(255, 255, 255, 0.16);
}

.strategy-panel .panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
    margin-bottom: 4px;
    color: #e2e8f0;
    font-weight: 800;
}
.strategy-panel .panel-head span {
    font-family: var(--display);
    font-size: 16px;
    letter-spacing: 0.02em;
}
.strategy-panel .panel-head i {
    color: var(--mint);
    width: 18px;
    height: 18px;
}

/* --- Top Synopsis Card --- */
.strategy-summary-card {
    border: 1px solid var(--line-hot);
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(97, 242, 186, 0.08), rgba(122, 167, 255, 0.04));
    backdrop-filter: blur(20px);
    padding: 20px 24px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.strategy-summary-card .summary-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .16em;
    color: var(--mint);
}
.strategy-summary-card .summary-header i {
    width: 16px;
    height: 16px;
}
.strategy-summary-card .summary-text {
    font-size: 15px;
    line-height: 1.6;
    color: #cbd5e1;
}

/* --- Scenario Controls --- */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.control-label {
    font-size: 12px;
    font-family: var(--mono);
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .08em;
}
.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
}
.slider-container input[type="range"] {
    flex: 1;
    accent-color: var(--mint);
}
.slider-container span {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    color: var(--ink);
    min-width: 38px;
    text-align: right;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider-round {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--line);
    border-radius: 24px;
    transition: .3s;
}
.slider-round:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--muted);
    border-radius: 50%;
    transition: .3s cubic-bezier(.16, 1, .3, 1);
}
.switch input:checked + .slider-round {
    background-color: rgba(97, 242, 186, 0.2);
    border-color: var(--mint);
}
.switch input:checked + .slider-round:before {
    transform: translateX(24px);
    background-color: var(--mint);
    box-shadow: 0 0 10px rgba(97, 242, 186, 0.4);
}

.select-wrapper select {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
    color: var(--ink);
    border-radius: 12px;
    padding: 10px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}
.select-wrapper select:focus {
    border-color: var(--mint);
}

.run-simulation-btn {
    width: 100%;
    margin-top: 10px;
    font-family: var(--display);
    font-weight: 700;
    letter-spacing: 0.05em;
    min-height: 48px;
    font-size: 14px;
    border-radius: 16px;
}

/* --- Simulation Workspace & Before/After Projections --- */
.workspace-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.comparison-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.comp-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color .3s;
}
.comp-card:hover {
    border-color: rgba(255, 255, 255, 0.08);
}
.comp-title {
    font-size: 10px;
    font-family: var(--mono);
    text-transform: uppercase;
    color: var(--muted);
    letter-spacing: .08em;
}
.comp-comparison {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.comp-val {
    font-family: var(--display);
    font-size: 20px;
    font-weight: 700;
}
.comp-comparison i {
    width: 16px;
    height: 16px;
    color: var(--muted);
    opacity: 0.5;
}
.text-muted { color: var(--muted); }
.text-mint { color: var(--mint); }
.text-blue { color: var(--blue); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }

.mini-progress-track {
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.05);
    overflow: hidden;
}
.mini-progress-fill {
    height: 100%;
    background: var(--mint);
    border-radius: inherit;
    width: 0%;
    transition: width 0.8s cubic-bezier(.16, 1, .3, 1);
}
.mini-progress-fill.bg-red { background: var(--red); }
.mini-progress-fill.bg-blue { background: var(--blue); }

/* Workspace Visuals (Dial Gauge & Details) */
.workspace-visuals {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 20px;
    align-items: center;
}
.gauge-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.visual-label {
    font-size: 10px;
    font-family: var(--mono);
    color: var(--muted);
    text-transform: uppercase;
}
.strategy-gauge-container {
    position: relative;
    width: 120px;
    height: 120px;
}
.strategy-gauge-svg {
    width: 120px;
    height: 120px;
    transform: rotate(-90deg);
}
.strategy-gauge-track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.04);
    stroke-width: 10;
}
.strategy-gauge-fill {
    fill: none;
    stroke: var(--mint);
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s cubic-bezier(.16, 1, .3, 1);
}
.gauge-center-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.gauge-center-content strong {
    font-family: var(--display);
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
}
.gauge-center-content span {
    font-size: 8px;
    font-family: var(--mono);
    text-transform: uppercase;
    color: var(--muted);
    margin-top: 4px;
}

.metrics-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
}
.metric-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
    padding-bottom: 8px;
}
.metric-detail-row span {
    font-size: 13px;
    color: var(--muted);
}
.metric-detail-row strong {
    font-family: var(--mono);
    font-size: 16px;
    font-weight: 700;
}

/* --- Loader Animation inside Workspace --- */
#sim-workspace-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    min-height: 260px;
    text-align: center;
}
.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(97, 242, 186, 0.1);
    border-radius: 50%;
    border-top-color: var(--mint);
    animation: strategySpin 1s linear infinite;
}
@keyframes strategySpin {
    to { transform: rotate(360deg); }
}
#sim-workspace-loading p {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--mint);
    letter-spacing: 0.05em;
    animation: pulseText 1.5s ease-in-out infinite;
}
@keyframes pulseText {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* --- Right Panel: AI Coach Analysis & Alerts --- */
.coach-notes-container {
    font-size: 13px;
    line-height: 1.6;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.coach-notes-para {
    margin: 0;
}
.coach-bullet-list {
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.coach-bullet-list li {
    position: relative;
    list-style: none;
}
.coach-bullet-list li:before {
    content: "•";
    color: var(--violet);
    font-weight: bold;
    display: inline-block;
    width: 1em;
    margin-left: -1em;
}

.smart-alerts-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-top: 1px solid var(--line);
    padding-top: 16px;
}
.section-subtitle {
    font-size: 11px;
    font-family: var(--mono);
    text-transform: uppercase;
    color: var(--muted);
    letter-spacing: .08em;
}
.strategy-alerts-feed {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 180px;
    overflow-y: auto;
}
.strategy-alert-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--line);
    font-size: 12px;
    line-height: 1.4;
    transition: transform 0.2s;
}
.strategy-alert-item:hover {
    transform: translateX(4px);
}
.strategy-alert-item.alert-warning {
    border-color: rgba(255, 95, 115, 0.2);
    background: rgba(255, 95, 115, 0.02);
}
.strategy-alert-item.alert-warning i { color: var(--red); }

.strategy-alert-item.alert-success {
    border-color: rgba(97, 242, 186, 0.2);
    background: rgba(97, 242, 186, 0.02);
}
.strategy-alert-item.alert-success i { color: var(--mint); }

.strategy-alert-item i {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* --- Bottom Panel: Risk Distribution + Recovery Timeline --- */
.bottom-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    align-items: center;
}

/* Risk Distribution bars */
.distribution-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.dist-row {
    display: grid;
    grid-template-columns: 80px 24px 1fr;
    align-items: center;
    gap: 10px;
}
.dist-row span {
    font-size: 12px;
}
.dist-row span:first-child {
    color: var(--muted);
    font-family: var(--sans);
}
.dist-row span:nth-child(2) {
    font-family: var(--mono);
    font-weight: 700;
    text-align: right;
}
.dist-bar-track {
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.04);
    overflow: hidden;
}
.dist-bar {
    height: 100%;
    width: 0%;
    border-radius: inherit;
    transition: width 0.8s cubic-bezier(.16, 1, .3, 1);
}
.dist-bar.bg-red { background: var(--red); }
.dist-bar.bg-amber { background: var(--amber); }
.dist-bar.bg-mint { background: var(--mint); }

/* Timeline Visualizer */
.timeline-slider-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.timeline-track {
    display: flex;
    justify-content: space-between;
    position: relative;
    padding: 0 10px;
}
.timeline-track:after {
    content: "";
    position: absolute;
    height: 2px;
    background: rgba(255, 255, 255, 0.06);
    left: 10px;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
}
.timeline-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
    z-index: 2;
    cursor: pointer;
}
.node-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--muted);
    border: 2px solid var(--bg);
    transition: transform .2s, background-color .2s;
}
.node-label {
    font-size: 10px;
    font-family: var(--mono);
    color: var(--muted);
    text-transform: uppercase;
}
.timeline-node:hover .node-dot {
    transform: scale(1.3);
    background-color: var(--mint);
}
.timeline-node.active .node-dot {
    background-color: var(--mint);
    box-shadow: 0 0 10px var(--mint);
    transform: scale(1.4);
}
.timeline-node.active .node-label {
    color: var(--ink);
    font-weight: 700;
}

.timeline-chart-projection {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.projection-chart-label {
    font-size: 10px;
    font-family: var(--mono);
    color: var(--muted);
    text-transform: uppercase;
}
.timeline-trend-visualization {
    display: flex;
    justify-content: space-between;
    height: 80px;
    align-items: flex-end;
    gap: 8px;
    padding: 0 10px;
}
.trend-bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.trend-bar-track {
    width: 28px;
    height: 50px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
}
.trend-bar-fill {
    width: 100%;
    height: 0%;
    background: linear-gradient(to top, var(--blue), var(--mint));
    border-radius: inherit;
    transition: height 0.8s cubic-bezier(.16, 1, .3, 1);
}
.trend-bar-val {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
}
.trend-date-label {
    font-size: 8px;
    font-family: var(--mono);
    color: var(--muted);
}

/* --- Print & PDF Layout Controls --- */
@media print {
    body > *:not(.mission-stage), .mission-header, .orbital-dock, .filter-strip {
        display: none !important;
    }
    #tab-content-strategylab {
        display: block !important;
    }
    .strategy-panel {
        background: #fff !important;
        color: #111 !important;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }
    .strategy-summary-card {
        background: #f8fafc !important;
        border: 1px solid #ccc !important;
        color: #111 !important;
    }
    .strategy-grid {
        display: block !important;
    }
    .strategy-panel {
        margin-bottom: 20px;
        width: 100% !important;
    }
    .trend-bar-track {
        border: 1px solid #ccc !important;
    }
    .slider-container input[type="range"], .switch, select {
        display: none !important;
    }
}

/* --- Responsive Layout --- */
@media (max-width: 1200px) {
    .strategy-grid {
        grid-template-columns: 1fr;
    }
    .bottom-layout {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 768px) {
    .comparison-cards {
        grid-template-columns: 1fr;
    }
    .workspace-visuals {
        grid-template-columns: 1fr;
    }
}
