/* ===================================
   Scenario Planner Standalone - Styles
   LiveCraft Brand Theme
   =================================== */

:root {
    /* LiveCraft Brand Colors - Light theme matching creds deck */
    --bg-primary: #f5f5f7;
    --bg-secondary: #eeeef0;
    --bg-tertiary: #e5e5ea;
    --bg-card: #ffffff;

    /* Dark header (matches deck dark header bar) */
    --header-bg: #111111;
    --header-text: #ffffff;
    --header-text-secondary: #a3a3a3;
    --header-text-muted: #737373;
    --header-border: rgba(255, 255, 255, 0.1);

    /* Primary Accent - LiveCraft Coral (from deck) */
    --accent-primary: #FF4D2E;
    --accent-primary-dim: rgba(255, 77, 46, 0.08);
    --accent-primary-hover: #ff6347;
    --accent-primary-border: rgba(255, 77, 46, 0.2);

    /* Status Colors */
    --success: #16a34a;
    --success-dim: rgba(22, 163, 74, 0.1);
    --warning: #ca8a04;
    --warning-dim: rgba(202, 138, 4, 0.1);
    --error: #dc2626;
    --error-dim: rgba(220, 38, 38, 0.1);

    /* Text Colors */
    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --text-muted: #888888;

    /* Platform Colors */
    --tiktok: #e6004a;
    --amazon: #e68a00;
    --dtc: #9333ea;

    /* Borders & Shadows */
    --border-color: #e0e0e0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* ===================================
   Header
   =================================== */

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 32px;
    background: var(--header-bg);
    border-bottom: 2px solid var(--accent-primary);
    position: sticky;
    top: 0;
    z-index: 100;
    color: var(--header-text);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 24px;
    color: var(--accent-primary);
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--header-text);
}

.brand-badge {
    display: flex;
    flex-direction: column;
    padding-left: 24px;
    border-left: 2px solid var(--accent-primary);
}

.brand-name {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--accent-primary);
}

.powered-by {
    font-size: 10px;
    color: var(--header-text-muted);
    text-transform: lowercase;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.profile-selector {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.profile-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--header-text);
}

.profile-market {
    font-size: 11px;
    color: var(--header-text-muted);
}

/* Guide Toggle Button */
.guide-toggle-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--header-border);
    border-radius: 6px;
    color: var(--header-text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.guide-toggle-btn:hover {
    color: var(--header-text);
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.guide-toggle-btn.active {
    color: #ffffff;
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* Pulse animation for first visit */
.guide-toggle-btn.pulse {
    animation: guidePulse 2s ease-in-out 3;
}

@keyframes guidePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 77, 46, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(255, 77, 46, 0); }
}

/* ===================================
   Walkthrough Guide Panel
   =================================== */

.walkthrough-panel {
    max-height: 0;
    overflow: hidden;
    background: #1a1a2e;
    transition: max-height 0.4s ease, padding 0.3s ease;
    padding: 0 32px;
}

.walkthrough-panel.open {
    max-height: 2000px;
    padding: 24px 32px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.walkthrough-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.walkthrough-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #e2e8f0;
}

.walkthrough-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.walkthrough-close:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.1);
}

.walkthrough-sections {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.walkthrough-section {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    overflow: hidden;
}

.walkthrough-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    color: #e2e8f0;
    font-size: 14px;
    font-weight: 600;
}

.walkthrough-section-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.walkthrough-section-header .toggle-icon {
    font-size: 10px;
    transition: transform 0.2s;
    color: #94a3b8;
}

.walkthrough-section.collapsed .walkthrough-section-header .toggle-icon {
    transform: rotate(-90deg);
}

.walkthrough-section-content {
    padding: 0 16px 16px;
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.7;
}

.walkthrough-section.collapsed .walkthrough-section-content {
    display: none;
}

.walkthrough-section-content ol {
    padding-left: 20px;
    margin: 8px 0;
}

.walkthrough-section-content ol li {
    margin-bottom: 8px;
}

.walkthrough-section-content ul {
    list-style: none;
    padding-left: 0;
    margin: 8px 0;
}

.walkthrough-section-content ul li {
    margin-bottom: 8px;
    padding-left: 16px;
    position: relative;
}

.walkthrough-section-content ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-primary);
}

.walkthrough-section-content strong {
    color: var(--accent-primary);
    font-weight: 600;
}

/* ===================================
   Main Content
   =================================== */

.app-main {
    padding: 32px;
    max-width: 1600px;
    margin: 0 auto;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
}

.view-header h1 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.view-subtitle {
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ===================================
   Planner Layout
   =================================== */

.planner-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 24px;
    height: calc(100vh - 100px);
}

.planner-inputs {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.planner-inputs h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.input-section {
    margin-bottom: 24px;
}

.input-section h4 {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.input-group select,
.input-group input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group select:focus,
.input-group input[type="number"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(255, 77, 46, 0.15);
}

.input-group select {
    cursor: pointer;
    appearance: none;
    background-color: var(--bg-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.slider-group {
    margin-bottom: 16px;
}

.slider-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.slider-group label span {
    font-weight: 600;
    color: var(--accent-primary);
}

.slider-group input[type="range"] {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    appearance: none;
    cursor: pointer;
}

.slider-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(255, 77, 46, 0.3);
    transition: transform 0.2s;
}

.slider-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

/* Investment Options */
.investment-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.investment-option {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.investment-option:hover {
    background: var(--bg-secondary);
}

.investment-option.selected {
    border-color: var(--accent-primary);
    background: rgba(255, 77, 46, 0.08);
}

.investment-option input[type="radio"] {
    display: none;
}

.investment-option .option-radio {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s;
}

.investment-option.selected .option-radio {
    border-color: var(--accent-primary);
}

.investment-option.selected .option-radio::after {
    content: '';
    width: 10px;
    height: 10px;
    background: var(--accent-primary);
    border-radius: 50%;
}

.option-details {
    flex: 1;
}

.option-details .option-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.option-details .option-desc {
    font-size: 12px;
    color: var(--text-muted);
}

/* Calculate Button */
.calculate-btn {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--accent-primary), #ff6b4a);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 8px;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 77, 46, 0.35);
}

.calculate-btn:active {
    transform: translateY(0);
}

/* Affiliate Funnel Visualization */
.affiliate-funnel-visual {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
    overflow-x: auto;
}

.funnel-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.funnel-stage .funnel-number {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.funnel-stage .funnel-label {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
}

.funnel-stage.highlight {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 8px;
    padding: 8px 12px;
}

.funnel-stage.highlight .funnel-number {
    color: var(--success);
}

.funnel-arrow {
    color: var(--text-muted);
    font-size: 16px;
    opacity: 0.5;
}

.funnel-source {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 12px;
    font-style: italic;
}

.sampling-cost-preview {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    padding: 10px 14px;
    margin-top: 12px;
}

.sampling-cost-preview .preview-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.sampling-cost-preview .preview-value {
    font-size: 16px;
    font-weight: 700;
    color: #ef4444;
}

#sampling-controls {
    transition: opacity 0.2s;
}

#sampling-controls.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Affiliate Mode Toggle */
.affiliate-mode-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.affiliate-mode-toggle .mode-btn {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: none;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.affiliate-mode-toggle .mode-btn:first-child {
    border-right: 1px solid var(--border-color);
}

.affiliate-mode-toggle .mode-btn.active {
    background: var(--accent-primary);
    color: white;
    font-weight: 600;
}

.affiliate-mode-toggle .mode-btn:hover:not(.active) {
    background: var(--bg-secondary);
}

/* Sample ROI Funnel */
.sample-roi-funnel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 16px 0;
}

.roi-funnel-stage {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.roi-funnel-bar {
    height: 32px;
    background: linear-gradient(90deg, var(--accent-primary-dim), rgba(255, 77, 46, 0.15));
    border: 1px solid rgba(255, 77, 46, 0.2);
    border-radius: 6px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    transition: width 0.3s ease;
    min-width: 60px;
}

.roi-funnel-bar.highlight {
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.08));
    border-color: rgba(34, 197, 94, 0.3);
}

.roi-funnel-count {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

.roi-funnel-bar.highlight .roi-funnel-count {
    color: var(--success);
}

.roi-funnel-label {
    font-size: 10px;
    color: var(--text-muted);
    padding-left: 4px;
}

/* Sample ROI Derived Metrics */
.sample-roi-metrics {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
}

.roi-metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--bg-secondary);
}

.roi-metric-row:last-child {
    border-bottom: none;
}

.roi-metric-row.highlight {
    padding-top: 8px;
    margin-top: 4px;
    border-top: 1px solid var(--border-color);
    border-bottom: none;
    font-weight: 600;
    color: var(--text-primary);
}

.roi-metric-value {
    font-weight: 700;
    color: var(--text-primary);
}

.roi-metric-value.positive {
    color: var(--success);
}

.roi-metric-value.negative {
    color: var(--error);
}

/* Seasonality Preview Bar Chart */
.season-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 90px;
    padding: 8px 0 0;
}

.season-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.season-bar {
    width: 100%;
    min-height: 4px;
    border-radius: 3px 3px 0 0;
    background: var(--accent-primary);
    opacity: 0.7;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    transition: height 0.3s ease;
}

.season-bar.season-high {
    background: var(--success);
    opacity: 0.9;
}

.season-bar.season-low {
    background: var(--error);
    opacity: 0.8;
}

.season-mult {
    font-size: 9px;
    font-weight: 600;
    color: #fff;
    margin-top: 2px;
    white-space: nowrap;
}

.season-month-label {
    font-size: 9px;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 3px;
    line-height: 1.2;
}

/* ===================================
   Results Panel
   =================================== */

.planner-results {
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    padding-right: 8px;
}

.planner-results h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

/* Insight Banner */
.planner-insight-banner {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: var(--accent-primary-dim);
    border: 1px solid var(--accent-primary);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 24px;
}

.planner-insight-banner .insight-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-primary);
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
}

.planner-insight-banner .insight-content {
    flex: 1;
}

.planner-insight-banner .insight-content strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 4px;
}

.planner-insight-banner .insight-content p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

/* Category Benchmarks */
.category-benchmarks {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.benchmark-item {
    font-size: 12px;
    color: var(--text-muted);
    position: relative;
}

.benchmark-item.has-tooltip {
    cursor: help;
}

.benchmark-item strong {
    color: var(--accent-primary);
}

.benchmark-item .info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    margin-left: 4px;
    cursor: help;
    vertical-align: middle;
    transition: all 0.2s ease;
}

.benchmark-item:hover .info-icon {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
}

/* Input Rows */
.input-row {
    margin-bottom: 16px;
}

.input-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.slider-value {
    display: inline-block;
    min-width: 30px;
    text-align: center;
    font-weight: 600;
    color: var(--accent-primary);
    margin-left: 12px;
}

.currency-input {
    display: flex;
    align-items: center;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.currency-input .currency-symbol {
    padding: 10px 12px;
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-weight: 500;
    border-right: 1px solid var(--border-color);
}

.currency-input input {
    flex: 1;
    padding: 10px 12px;
    background: transparent;
    border: none;
    font-size: 14px;
    color: var(--text-primary);
}

.currency-input input:focus {
    outline: none;
}

.input-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    font-style: italic;
}

.input-row .input-hint {
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

/* Planner Select */
.planner-select {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.planner-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.planner-select.small {
    padding: 8px 10px;
    font-size: 12px;
}

/* Collapsible Section */
.input-section.collapsible {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0;
    background: var(--bg-primary);
}

.input-section.collapsible h3.section-toggle {
    padding: 12px 16px;
    margin: 0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    transition: background 0.2s;
}

.input-section.collapsible h3.section-toggle:hover {
    background: var(--bg-secondary);
}

.input-section.collapsible .toggle-icon {
    font-size: 10px;
    transition: transform 0.2s;
}

.input-section.collapsible.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.input-section.collapsible .section-content {
    padding: 0 16px 16px;
    border-top: 1px solid var(--border-color);
}

.input-section.collapsible.collapsed .section-content {
    display: none;
}

/* Override Controls */
.override-checkbox {
    width: 14px;
    height: 14px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.override-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    opacity: 0.5;
    pointer-events: none;
}

.override-control.active {
    opacity: 1;
    pointer-events: auto;
}

.planner-slider.small {
    height: 4px;
}

/* ===================================
   Key Metrics Cards
   =================================== */

.planner-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.planner-metric-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.planner-metric-card .metric-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.planner-metric-card .metric-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.planner-metric-card .metric-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.planner-metric-card.highlight {
    background: linear-gradient(135deg, rgba(255, 77, 46, 0.1), rgba(255, 107, 74, 0.05));
    border-color: var(--accent-primary);
}

.planner-metric-card.highlight .metric-value {
    color: var(--accent-primary);
}

.planner-metric-card.success .metric-value {
    color: var(--success);
}

.planner-metric-card.warning .metric-value {
    color: var(--warning);
}

.planner-metric {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.planner-metric .metric-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.planner-metric .metric-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.planner-metric.investment .metric-value {
    color: #ef4444;
}

.planner-metric.revenue .metric-value {
    color: #22c55e;
}

.planner-metric.breakeven .metric-value {
    color: var(--accent-primary);
}

.planner-metric.roi .metric-value {
    color: #22c55e;
}

.planner-metric .metric-sublabel {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

.planner-metric.profit18 .metric-value {
    color: #22c55e;
}

/* ===================================
   Chart Section
   =================================== */

.planner-chart-section {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border-color);
}

.planner-chart-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.planner-chart-container {
    height: 280px;
    position: relative;
}

/* ===================================
   P&L Table
   =================================== */

.planner-pnl-section {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.planner-pnl-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.planner-table-section {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border-color);
}

.planner-table-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.planner-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.planner-table th {
    padding: 10px 12px;
    text-align: right;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.planner-table th:first-child {
    text-align: left;
    border-radius: 8px 0 0 0;
}

.planner-table th:last-child {
    border-radius: 0 8px 0 0;
}

.planner-table td {
    padding: 12px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.planner-table td:first-child {
    text-align: left;
    font-weight: 500;
    color: var(--text-primary);
}

.planner-table tr:last-child td {
    border-bottom: none;
}

.planner-table tr.total-row {
    background: var(--bg-tertiary);
    font-weight: 600;
}

.planner-table tr.total-row td {
    color: var(--text-primary);
}

.planner-table tr.profit-row td {
    font-weight: 700;
}

.planner-table tr.profit-row.positive td:last-child,
.planner-table .positive {
    color: var(--success);
}

.planner-table tr.profit-row.negative td:last-child,
.planner-table .negative {
    color: var(--error);
}

.planner-table tr.breakeven-row {
    background: rgba(255, 77, 46, 0.08);
}

.planner-table tr.breakeven-row td {
    color: var(--accent-primary);
    font-weight: 600;
}

.planner-table .phase-cell {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.planner-table .cost-cell {
    color: #ef4444;
}

.planner-table .gmv-cell {
    color: var(--text-primary);
}

.planner-table .halo-cell {
    color: #818cf8;
    font-style: italic;
}

.planner-table .pnl-cell {
    font-weight: 600;
}

.planner-table .cumulative-cell {
    font-weight: 700;
}

.planner-table tr.profit {
    background: rgba(34, 197, 94, 0.05);
}

.planner-table tr.loss {
    background: rgba(239, 68, 68, 0.03);
}

/* P&L Table Visual Treatment */
.planner-table tr.row-negative-deep {
    background: rgba(239, 68, 68, 0.04);
}

.planner-table tr.row-negative-improving {
    background: rgba(234, 179, 8, 0.06);
}

.planner-table tr.row-breakeven {
    background: rgba(34, 197, 94, 0.12);
    border-top: 2px solid #22c55e;
    border-bottom: 2px solid #22c55e;
}

.planner-table tr.row-breakeven td {
    font-weight: 700;
}

.planner-table tr.row-positive {
    background: rgba(34, 197, 94, 0.05);
}

.planner-table tr.projected-row td {
    font-style: italic;
    opacity: 0.85;
}

.planner-table tr.projection-note-row td {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 8px;
    border-top: 1px dashed var(--border-color);
}

.trend-up {
    color: #22c55e;
    font-size: 10px;
    margin-right: 3px;
}

.trend-down {
    color: #ef4444;
    font-size: 10px;
    margin-right: 3px;
}

.trend-flat {
    color: var(--text-muted);
    font-size: 10px;
    margin-right: 3px;
}

/* ===================================
   Breakdown Cards
   =================================== */

.planner-breakdown {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.breakdown-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
}

.breakdown-card h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.breakdown-card h5 {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 16px;
    letter-spacing: 0.5px;
}

.breakdown-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 13px;
}

.breakdown-item .item-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.breakdown-item .item-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.breakdown-item span:first-child {
    color: var(--text-secondary);
}

.breakdown-item span:last-child {
    font-weight: 600;
    color: var(--text-primary);
}

.breakdown-item.halo span:last-child {
    color: #818cf8;
}

.breakdown-item.total {
    padding-top: 12px;
    margin-top: 8px;
    border-top: 1px solid var(--border-color);
}

.breakdown-item.total span:first-child {
    font-weight: 600;
    color: var(--text-primary);
}

.breakdown-item.total span:last-child {
    font-size: 18px;
    color: var(--accent-primary);
}

.breakdown-section {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 12px 0 6px 0;
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
}

.breakdown-section:first-child {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}

.breakdown-item.warning span:last-child {
    color: var(--warning);
}

.breakdown-item.subtle {
    opacity: 0.7;
    font-size: 12px;
}

.breakdown-item.subtle span:last-child {
    color: var(--text-secondary);
}

.breakdown-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    margin-top: 8px;
    border-top: 2px solid var(--border-color);
    font-weight: 600;
}

.breakdown-total span:first-child {
    color: var(--text-primary);
}

.breakdown-total span:last-child {
    font-size: 16px;
    color: var(--accent-primary);
}

.breakdown-total .total-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.breakdown-total .total-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-primary);
}

.breakdown-net {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-top: 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 15px;
}

.breakdown-net.positive {
    background: var(--success-dim);
    color: var(--success);
}

.breakdown-net.negative {
    background: var(--error-dim);
    color: var(--error);
}

.breakdown-net span:last-child {
    font-size: 18px;
}

.breakdown-net.projected {
    margin-top: 8px;
    border: 2px dashed;
}

.breakdown-net.projected.positive {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.08);
}

.breakdown-net.projected.negative {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.08);
}

/* ===================================
   Content Economics Card
   =================================== */

.content-economics-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.content-economics-card h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.content-econ-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.econ-metric {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 16px 12px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.econ-metric-net {
    border-color: var(--accent-primary-border);
    background: var(--accent-primary-dim);
}

.econ-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
    line-height: 1.3;
}

.econ-qualifier {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.7;
}

.econ-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--border-color);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    vertical-align: middle;
    margin-left: 3px;
    transition: background 0.2s, color 0.2s;
    position: relative;
}

.econ-info-icon:hover,
.econ-info-icon.active {
    background: var(--accent-primary);
    color: #000;
}

.econ-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a2e;
    color: #e2e8f0;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    width: 220px;
    text-align: left;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    z-index: 100;
    animation: tooltipFadeIn 0.15s ease-out;
}

.econ-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1a1a2e;
}

@keyframes tooltipFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(4px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.econ-value {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.econ-metric-net .econ-value.positive {
    color: #22c55e;
}

.econ-metric-net .econ-value.negative {
    color: #ef4444;
}

.econ-footnote {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 12px;
    font-style: italic;
}

/* ===================================
   Steady-State Monthly P&L Card
   =================================== */

.steady-state-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border-color);
    border-left: 4px solid #22c55e;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.steady-state-card h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.steady-state-qualifier {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
}

.steady-state-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.ss-metric {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 16px 12px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.ss-metric-highlight {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.06);
}

.ss-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.ss-value {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.ss-value.positive {
    color: #22c55e;
}

.ss-value.negative {
    color: #ef4444;
}

.ss-footnote {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 12px;
    font-style: italic;
}

.ss-footnote-warning {
    color: #eab308;
    font-style: normal;
    font-weight: 500;
}

/* Warning cell for sensitivity tables */
.sensitivity-table td.warning-cell {
    color: #eab308;
    font-weight: 600;
}

/* ===================================
   Sensitivity Analysis
   =================================== */

.sensitivity-section {
    margin-bottom: 24px;
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
}

.sensitivity-section h3.section-toggle {
    padding: 16px 20px !important;
    font-size: 14px !important;
    font-weight: 600;
}

.sensitivity-subtitle {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 12px;
}

.sensitivity-section .section-content {
    padding: 0 20px 20px !important;
}

.sensitivity-block {
    margin-bottom: 28px;
}

.sensitivity-block:last-child {
    margin-bottom: 0;
}

.sensitivity-block h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.sensitivity-note {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.sensitivity-table-wrap {
    overflow-x: auto;
}

.sensitivity-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.sensitivity-table th,
.sensitivity-table td {
    padding: 10px 14px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

.sensitivity-table th:first-child,
.sensitivity-table td:first-child {
    text-align: left;
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 180px;
}

.sensitivity-table th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    background: var(--bg-primary);
    border-bottom: 2px solid var(--border-color);
}

.sensitivity-table th.current-col {
    background: var(--accent-primary-dim);
    color: var(--accent-primary);
}

.sensitivity-table td.current-col {
    background: rgba(255, 77, 46, 0.04);
    font-weight: 600;
}

.sensitivity-table td.positive {
    color: #22c55e;
    font-weight: 600;
}

.sensitivity-table td.negative {
    color: #ef4444;
    font-weight: 600;
}

.sensitivity-table td.yes-cell {
    color: #22c55e;
    font-weight: 700;
    background: rgba(34, 197, 94, 0.06);
}

.sensitivity-table td.no-cell {
    color: #ef4444;
    font-weight: 700;
    background: rgba(239, 68, 68, 0.06);
}

.sensitivity-table tbody tr:last-child td {
    border-bottom: none;
}

/* Break-Even Views */
.breakeven-views-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.breakeven-views-item {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.breakeven-views-item.halo {
    border-color: rgba(129, 140, 248, 0.3);
    background: rgba(129, 140, 248, 0.05);
}

.bev-value {
    display: block;
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.breakeven-views-item.halo .bev-value {
    color: #818cf8;
}

.bev-label {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ===================================
   CTA Section
   =================================== */

.planner-cta {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.planner-cta p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.cta-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.cta-primary {
    padding: 12px 28px;
    background: linear-gradient(135deg, var(--accent-primary), #ff6b4a);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.cta-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(255, 77, 46, 0.3);
}

.cta-secondary {
    padding: 12px 28px;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.cta-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-muted);
}

/* ===================================
   Sources Section
   =================================== */

.planner-sources {
    text-align: center;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.planner-sources h4 {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.source-links {
    display: flex;
    gap: 24px;
    justify-content: center;
    flex-wrap: wrap;
}

.source-links span {
    font-size: 11px;
    color: var(--text-muted);
}

/* ===================================
   Responsive
   =================================== */

@media (max-width: 1400px) {
    .planner-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1200px) {
    .planner-metrics {
        grid-template-columns: repeat(2, 1fr);
    }

    .content-econ-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1100px) {
    .planner-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .planner-inputs {
        max-height: none;
    }
}

@media (max-width: 800px) {
    .app-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .app-main {
        padding: 16px;
    }

    .planner-breakdown {
        grid-template-columns: 1fr;
    }

    .cta-buttons {
        flex-direction: column;
    }

    .content-econ-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .breakeven-views-grid {
        grid-template-columns: 1fr;
    }

    .sensitivity-table {
        font-size: 12px;
    }

    .sensitivity-table th,
    .sensitivity-table td {
        padding: 8px 10px;
    }

    .sensitivity-table th:first-child,
    .sensitivity-table td:first-child {
        min-width: 140px;
    }

    .steady-state-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .walkthrough-panel.open {
        padding: 16px;
    }
}
