:root {
    --bg-base: #0f172a;
    /* Deep slate dark mode */
    --bg-surface: #1e293b;
    /* Elevated dark surface */
    --bg-surface-hover: #334155;
    /* Lighter hover state */

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    --accent-primary: #38bdf8;
    /* vibrant light blue */
    --accent-secondary: #818cf8;
    /* indigo */

    --success: #10b981;
    /* neon green */
    --success-dim: rgba(16, 185, 129, 0.15);
    --danger: #ef4444;
    /* neon red */
    --danger-dim: rgba(239, 68, 68, 0.15);

    --border-color: #475569;
    /* Subtle slate border */
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* --- GLASSMORPHISM UTILITIES --- */
.glass-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}

/* --- SIDEBAR --- */
.sidebar {
    width: 260px;
    background: #0b1120;
    /* Darker slate to stand out */
    border-right: 1px solid var(--border-color);
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

/* Old Logo rules removed */

.top-nav-menu {
    display: flex;
    gap: 12px;
}

.top-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.top-nav-btn:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.top-nav-btn.active {
    background: rgba(168, 35, 35, 0.1);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.nav-icon {
    width: 20px;
    height: 20px;
}

.calendar-section {
    margin-bottom: 24px;
    background: rgba(56, 189, 248, 0.05);
    /* Subtle neon blue tint */
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 12px;
}

.calendar-section h3,
.earnings-tickers h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding-left: 12px;
}

.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 12px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    font-weight: 600;
}

.cal-nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.cal-nav-btn:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
}

.day-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.cal-days-container {
    display: contents;
    /* Allows children to participate in parent's grid */
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    position: relative;
}

.cal-day:hover:not(.empty) {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.cal-day.active {
    background: var(--accent-primary);
    color: white;
    font-weight: 700;
    box-shadow: 0 0 10px rgba(168, 35, 35, 0.4);
}

.cal-day.has-earnings::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 4px;
    height: 4px;
    background-color: var(--success);
    border-radius: 50%;
}

.cal-day.empty {
    cursor: default;
}

.earnings-tickers {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Scrollbar specific to lists */
.earnings-tickers {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.ticker-list {
    flex: 1;
    overflow-y: auto;
}

.ticker-item {
    display: flex;
    justify-content: space-between;
    padding: 3px 8px;
    border-radius: 8px;
    margin-bottom: 0px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.75rem;
}

.ticker-item:hover {
    background: var(--bg-surface-hover);
}

.ticker-name {
    font-weight: 600;
    color: var(--text-primary);
}

.ticker-price {
    font-variant-numeric: tabular-nums;
}

.trend.up {
    color: var(--success);
}

.trend.down {
    color: var(--danger);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px 32px 0 32px;
    overflow-y: auto;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px 16px;
    width: 320px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-bar:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(109, 158, 81, 0.2);
}

.search-bar svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    margin-right: 12px;
}

.search-bar input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    width: 100%;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--bg-surface);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

/* --- DASHBOARD GRID --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 24px;
}

.widget {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
}


.widget h3 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.full-width {
    grid-column: 1 / -1;
    height: auto !important;
}

/* Gauge styling */
.sentiment-gauge {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
    justify-content: center;
}

.gauge-svg {
    width: 100%;
    max-width: 90px;
    overflow: visible;
}

.gauge-bg {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 8;
    stroke-linecap: round;
}

.gauge-fill {
    fill: none;
    stroke: var(--success);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease-out;
}

.gauge-value {
    position: absolute;
    bottom: -10px;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
}

/* Recommendation Card */
.ai-recommendation {
    /* Uses base .glass-panel styles instead of dark theme */
    position: relative;
    overflow: hidden;
}

.rec-card {
    position: relative;
    z-index: 1;
}

.rec-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.rec-header h2 {
    font-size: 1.1rem;
    font-weight: 800;
}

.badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.badge-call {
    background: var(--success-dim);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-put {
    background: var(--danger-dim);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* --- Strategy Tabs (Modern Pill Style) --- */
.strategy-tabs {
    display: inline-flex;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 12px;
    margin-left: 24px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.strat-tab-btn {
    position: relative;
    background: transparent;
    border: none;
    padding: 6px 16px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    margin-right: 0;
    z-index: 1;
    transition: all 0.2s ease;
    box-shadow: none;
}

.strat-tab-btn::after,
.strat-tab-btn.active::after {
    display: none;
}

/* Hover State */
.strat-tab-btn:hover {
    background: transparent;
    color: var(--text-primary);
    z-index: 2;
}

/* Active State */
.strat-tab-btn.active {
    background: var(--bg-surface);
    color: var(--success);
    z-index: 3;
    text-shadow: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.strat-tab-content {
    display: none;
    padding: 0;
}

.strat-tab-content.active {
    display: block;
}

.rec-details {
    display: flex;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.04);
    padding: 12px;
    border-radius: 8px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-item .label {
    font-size: 0.6rem;
    color: var(--text-muted);
}

.detail-item .value {
    font-size: 0.8rem;
    font-weight: 600;
}

.value.highlight {
    color: var(--accent-primary);
}

.expert-guidance {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: none;
    /* Visible in Strategy Tab */
}

/* Stats Widget */
.stat-large {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-sub {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 24px;
}

.progress-bar-container {
    height: 8px;
    background: var(--bg-surface-hover);
    border-radius: 4px;
    display: flex;
    overflow: hidden;
    margin-bottom: 12px;
}

.calls-bar {
    background: var(--success);
}

.puts-bar {
    background: var(--danger);
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* --- DATA TABLE --- */
.table-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.filter-controls {
    display: flex;
    align-items: center;
    gap: 24px;
}

/* Custom Slider Styling */
.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.slider-container label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 100px;
}

.custom-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 150px;
    height: 6px;
    background: var(--bg-surface-hover);
    border-radius: 3px;
    outline: none;
    opacity: 0.8;
    transition: opacity .2s;
}

.custom-slider:hover {
    opacity: 1;
}

.custom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
    transition: transform 0.2s, background 0.2s;
}

.custom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #60a5fa;
}

.custom-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
    border: none;
    transition: transform 0.2s, background 0.2s;
}

.custom-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    background: #60a5fa;
}

.filter-toggles {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: 8px;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.toggle-btn.active {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 12px 16px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 8px 12px;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-variant-numeric: tabular-nums;
    transition: background 0.2s, transform 0.2s;
}

.col-filter {
    width: 90%;
    margin-top: 6px;
    padding: 4px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.75rem;
    outline: none;
}

.col-filter:focus {
    border-color: var(--accent-primary);
}

tr {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

tr:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.symbol-cell {
    font-weight: 600;
}

.action-call {
    color: var(--success);
    font-weight: 600;
}

.action-put {
    color: var(--danger);
    font-weight: 600;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* Load More Pagination */
.load-more-container {
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 12px 0;
}

/* --- UNIVERSAL TREND COLORS --- */
.up {
    color: var(--success) !important;
}

.down {
    color: var(--danger) !important;
}

/* --- RIGHT PANEL (Suggestions) --- */
.right-panel {
    width: 280px;
    background: #0b1120;
    border-left: 1px solid var(--border-color);
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    z-index: 10;
}

.suggestion-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.suggestion-section h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Specific colors for bullish/bearish sections */
.bulls-header {
    color: var(--success);
}

.bears-header {
    color: var(--danger);
}

.sugg-card {
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.sugg-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    background: var(--bg-surface-hover);
}

.sugg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.sugg-ticker {
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.sugg-price {
    font-weight: 700;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

.sugg-reason {
    font-size: 0.7rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* --- MOBILE RESPONSIVENESS --- */

/* Tablet (max-width: 1024px) */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .search-bar {
        width: 200px;
        /* Compress search bar */
    }

    #tabExpertOpinions>div {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px;
    }

    /* Stack right panel on tablet since there's no room for 3 columns */
    .app-container {
        flex-wrap: wrap;
    }

    .right-panel {
        width: 100%;
        border-left: none;
        border-top: 2px solid var(--border-color);
        flex-direction: row;
        gap: 32px;
        height: auto;
    }

    .suggestion-section {
        flex: 1;
    }
}

/* Mobile (max-width: 768px) */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        flex-wrap: nowrap;
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }

    body {
        overflow-y: auto;
        /* Allow body scrolling on mobile */
    }

    /* Sidebar transforms into a movable menu or top header area */
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 2px solid var(--border-color);
        padding: 16px;
        position: relative;
    }

    .sidebar-content {
        display: none;
        /* Hide secondary sidebar content by default on mobile */
    }

    .sidebar.open .sidebar-content {
        display: flex;
        flex-direction: column;
    }

    .logo {
        margin-bottom: 0;
        justify-content: space-between;
        /* Space out logo and hamburger */
    }

    /* Hamburger Menu Icon (to be added in HTML) */
    .mobile-menu-btn {
        display: block !important;
        background: none;
        border: none;
        cursor: pointer;
        color: var(--text-primary);
        padding: 8px;
    }

    .main-content {
        padding: 16px;
        overflow-y: visible;
        /* Let the container handle scrolling */
    }

    .top-bar {
        flex-wrap: wrap;
        gap: 16px;
        margin-bottom: 24px;
    }

    #headerActiveTicker {
        order: 1;
        width: 100%;
        /* Push to full width row */
        justify-content: center;
        margin-bottom: 12px;
    }

    .search-bar {
        order: 2;
        width: 100%;
        max-width: none;
    }

    .top-nav-menu {
        order: 3;
        margin-right: 0 !important;
        margin: 0 auto;
    }

    .user-profile {
        order: 4;
        margin: 0 auto;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        /* Single column layout for mobile */
    }

    .table-header-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .filter-controls {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .slider-container {
        width: 100%;
        justify-content: space-between;
    }

    .filter-toggles {
        justify-content: space-between;
    }

    /* Expert opinions to 1 column */
    #tabExpertOpinions>div {
        grid-template-columns: 1fr !important;
    }

    /* Strategy Breakdown metrics wrap */
    #tabBestStrategy>div>div:nth-child(2) {
        grid-template-columns: repeat(2, 1fr) !important;
        /* Risk/Capital 2x2 */
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -16px;
        /* Edge to edge on mobile */
        padding: 0 16px;
    }

    /* Interactive Chart Height on mobile */
    .chart-widget {
        height: 300px;
    }
}