/* ==========================================================================
   Classic Analysis page — shared stylesheet
   Extracted from inline styles in analysis.html + light theme pass (Sep 2026)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Light theme — page area, cards, headers, tables
   Scoped under #ca-page so it only affects the classic analysis layout.
   -------------------------------------------------------------------------- */
#ca-page {
    background: #eef2f7;
    border-radius: 1rem;
    padding: .5rem .5rem 1.25rem;
}

/* All cards: white, same radius, soft shadow, light border.
   NOTE: !important is required — most sections carry Bootstrap utility
   classes (border-0, shadow, shadow-sm) which are themselves !important
   and would otherwise silently defeat the theme. */
#ca-page .card {
    background: #fff;
    border: 1px solid #e3e8ef !important;
    border-radius: .75rem !important;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 14px rgba(16, 24, 40, .05) !important;
    margin-bottom: 1.1rem;
    overflow: hidden;
}

/* Nested metric cards (e.g. Quick Stats tiles) stay flat */
#ca-page .card .card {
    box-shadow: none !important;
    border-radius: .6rem !important;
    margin-bottom: 0;
}

#ca-page .card > .card-header {
    background: linear-gradient(180deg, #fbfcfe 0%, #f4f6fa 100%) !important;
    border-bottom: 1px solid #e9edf3 !important;
    border-radius: .75rem .75rem 0 0 !important;
    padding: .8rem 1.1rem;
}

/* Uniform section header label style (h5 titles only — h4 narrative titles keep
   their sentence styling, e.g. the SMA verdict card) */
#ca-page .card-header h5.card-title,
#ca-page .card-header h5 {
    font-size: .82rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #344054 !important;
}

/* Header icons sit in a soft rounded chip — the one visible accent per card */
#ca-page .card-header h5 i.fas,
#ca-page .card-header h5 i.far {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: .5rem;
    background: rgba(102, 126, 234, .12);
    font-size: .8rem;
    vertical-align: middle;
}

/* Tables: lighter borders, zebra striping, hover, right-aligned numeric columns */
#ca-page .table th,
#ca-page .table td {
    border-color: #eef1f5 !important;
    vertical-align: middle;
}
#ca-page .table-striped > tbody > tr:nth-of-type(odd) > *,
#ca-page .table tbody tr:nth-of-type(odd) td {
    background-color: #f9fafc;
    --bs-table-accent-bg: #f9fafc;
}
#ca-page .table tbody tr:hover td {
    background-color: #f1f4f9;
}
#ca-page .table thead th {
    font-size: .74rem !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #667085 !important;
    background: #fbfcfe !important;
    border-bottom: 1px solid #e3e8ef !important;
}
/* Right-align value columns (first column stays left: Type / Indicator / Days) */
#ca-page table.tablesorter th:not(:first-child),
#ca-page table.tablesorter td:not(:first-child) {
    text-align: right;
}

/* Sticky search bar blends with the page background */
#ca-page .ca-sticky-search {
    background: #f6f8fb;
}

/* Metrics header (single hero accent — purple gradient set inline) */
#ca-page .ca-metrics-header .card-body {
    padding: 1rem 1.25rem;
}

/* Mobile: tighter card paddings, metrics header wraps cleanly */
@media (max-width: 576px) {
    #ca-page .card-body {
        padding: .75rem;
    }
    #ca-page .ca-metrics-header .d-flex.flex-wrap {
        row-gap: .5rem;
    }
    #ca-page .ca-metrics-header .fs-4 {
        font-size: 1.15rem !important;
    }
}

/* --------------------------------------------------------------------------
   2. Options tabs styling (moved from inline <style> in the tabs section)
   -------------------------------------------------------------------------- */
#optionTabs .nav-link {
    color: #495057;
    background-color: transparent;
    border: 1px solid #dee2e6;
    border-bottom: none;
}
#optionTabs .nav-link:hover {
    color: #495057;
    background-color: #f8f9fa;
}
#optionTabs .nav-link.active {
    color: #495057;
    background-color: #fff;
    border-color: #dee2e6;
    border-bottom-color: transparent;
}

/* Ensure chart container expands smoothly (moved from inline <style>) */
#price-candlestick-chart {
    transition: height 0.3s ease;
}

/* --------------------------------------------------------------------------
   3. Company info card (moved from extra_css inline <style>)
   -------------------------------------------------------------------------- */
.company-info-card {
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.company-info-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.company-info-card .card-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0;
}

.company-info-card .card-title i {
    margin-right: 0.5rem;
}

.company-description {
    line-height: 1.8;
    color: #4a5568;
    font-size: 1rem;
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .company-info-card .card-title {
        font-size: 1.2rem;
    }

    .company-description {
        font-size: 0.95rem;
    }
}

/* --------------------------------------------------------------------------
   4. Mobile chart layout (moved from extra_css inline <style>)
   -------------------------------------------------------------------------- */
/* Remove left/right margin on mobile for chart sections to use full width */
@media (max-width: 767px) {
    #chart-section,
    #options-section,
    #options-change-section,
    #volume-profile-section {
        margin-left: -1rem;
        margin-right: -1rem;
    }

    #chart-section .card,
    #options-section .card,
    #options-change-section .card,
    #volume-profile-section .card {
        border-radius: 0;
    }

    /* Reduce width for options change chart on mobile */
    #options-change-section .chart-area {
        min-width: 2000px !important;
    }

    /* Remove padding from technical chart card-body on mobile for full width */
    #chart-section .card-body {
        padding: 0 !important;
    }

    /* Reduce Highcharts margins on mobile */
    #price-candlestick-chart {
        margin: 0 !important;
    }

    /* Remove Highcharts plot background left margin on mobile */
    #price-candlestick-chart .highcharts-plot-background {
        x: 0 !important;
    }

    /* Force Highcharts container to start at 0 on mobile */
    #price-candlestick-chart .highcharts-container,
    #price-candlestick-chart .highcharts-root {
        left: 0 !important;
    }

    /* Remove padding from volume profile card-body on mobile for full width */
    #volume-profile-section .card-body {
        padding: 0 !important;
        overflow-x: hidden !important;
    }

    /* Make volume profile chart responsive on mobile */
    #volume-profile-section .card-body > div {
        min-width: 100% !important;
        height: 400px !important;
    }

    #volume-profile-section #vp-candlestick-chart {
        width: 100% !important;
        height: 100% !important;
    }

    /* Make overlays and guide text display in full rows on mobile */
    .chart-overlays-container {
        flex-direction: column !important;
    }

    .chart-overlays-container .form-check {
        width: 100% !important;
    }

    /* Force guide section to take full width on mobile */
    .chart-header-mobile {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }

    .chart-controls-wrapper {
        width: 100% !important;
        text-align: center !important;
    }

    #chartGuide {
        flex-basis: 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        text-align: left !important;
    }

    #chartGuide .alert {
        width: 100% !important;
        text-align: left !important;
    }

    #chartGuide ul {
        width: 100% !important;
        padding-left: 1.25rem !important;
        text-align: left !important;
    }

    #chartGuide .alert ul li {
        margin-bottom: 0.5rem;
        text-align: left !important;
    }

    /* Center the buttons */
    .chart-controls-wrapper .btn {
        margin: 0 auto !important;
    }
}
