/**
 * The Growth Hub Portal & Dashboard - Master Theme
 * Colors: #1B1240 (Primary Dark), #632FD1 (Brand Purple), #D8D2EE (Tint / Soft)
 * Fonts: Poppins (Headings), Lato (Body)
 */

:root {
    --gh-dark: #1B1240;
    --gh-purple: #632FD1;
    --gh-purple-hover: #5223b3;
    --gh-purple-light: #F4F1FB;
    --gh-tint: #D8D2EE;
    --gh-border: #E8E5F3;
    --gh-gold: #F3C343;
    --gh-gold-light: #FEF3C7;
    --gh-gold-text: #92400E;
    --gh-text: #2A244D;
    --gh-muted: #7E789B;
    --gh-font-h: 'Poppins', sans-serif;
    --gh-font-b: 'Lato', sans-serif;
}

/* Prevent Astra / Elementor horizontal scrollbar when breaking out */
html, body {
    overflow-x: hidden !important;
}

/* Lock Window to 100vh on Desktop so columns scroll independently */
@media (min-width: 1025px) {
    html, body {
        height: 100vh !important;
        overflow: hidden !important;
    }
}

/* 100vw Full-Width Breakout */
.gh-portal-wrapper {
    width: 100vw !important;
    position: relative !important;
    left: 50% !important;
    right: 50% !important;
    margin-left: -50vw !important;
    margin-right: -50vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    box-sizing: border-box !important;
    font-family: var(--gh-font-b) !important;
    color: var(--gh-text) !important;
    background-color: #F8F7FC !important;
    overflow: hidden !important;
}

.gh-portal-wrapper * {
    box-sizing: border-box !important;
}

.gh-portal-wrapper h1, 
.gh-portal-wrapper h2, 
.gh-portal-wrapper h3, 
.gh-portal-wrapper h4 {
    font-family: var(--gh-font-h) !important;
    color: var(--gh-dark) !important;
    margin-top: 0 !important;
    text-decoration: none !important;
}

/* Responsive 2-Pane App Shell */
.gh-dash-grid {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    height: 100vh !important;
    max-height: 100vh !important;
    width: 100%;
    max-width: 100%;
    overflow: hidden !important;
}

/* Mobile & Tablet Header Bar */
.gh-mobile-bar {
    display: none;
    background: var(--gh-dark);
    padding: 16px 20px;
    color: #FFFFFF;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 9999;
    width: 100%;
}
.gh-mobile-bar a {
    color: #FFF !important;
    font-family: var(--gh-font-h);
    font-weight: 800;
    font-size: 15px;
    text-decoration: none !important;
}
.gh-hamburger-btn {
    background: transparent;
    border: none;
    color: #FFFFFF;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 4px;
}

/* Independent Column 1: The Left Sidebar */
.gh-sidebar {
    background: var(--gh-dark);
    color: #FFFFFF;
    padding: 32px 18px 48px;
    display: flex;
    flex-direction: column;
    height: 100vh !important;
    max-height: 100vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    z-index: 50;
}

/* Clean custom scrollbar for sidebar */
.gh-sidebar::-webkit-scrollbar {
    width: 5px;
}
.gh-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.gh-brand {
    font-family: var(--gh-font-h);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 24px;
    padding: 0 10px;
    color: #FFFFFF !important;
    text-decoration: none !important;
    display: block;
}
.gh-user-badge {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(216, 210, 238, 0.15);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 24px;
}
.gh-user-name {
    font-family: var(--gh-font-h);
    font-size: 13.5px;
    font-weight: 700;
    text-transform: uppercase;
    color: #FFFFFF;
}
.gh-user-role {
    font-size: 11.5px;
    color: var(--gh-tint);
    margin-top: 2px;
}

/* Nav Menu - Strip All Theme Underlines */
.gh-nav-menu {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 30px !important;
}
.gh-nav-item a {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 10px 14px !important;
    color: #B4AED2 !important;
    text-decoration: none !important;
    border-bottom: none !important;
    font-size: 13.5px !important;
    border-radius: 8px !important;
    transition: 0.15s ease !important;
}
.gh-nav-item a:hover {
    color: #FFFFFF !important;
    background: rgba(255, 255, 255, 0.07) !important;
    text-decoration: none !important;
}
.gh-nav-item.active a {
    background: var(--gh-purple) !important;
    color: #FFFFFF !important;
    font-weight: 600 !important;
    text-decoration: none !important;
}

/* Independent Column 2: The Main Content Canvas */
.gh-main-area {
    padding: 36px 44px;
    width: 100%;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    height: 100vh !important;
    max-height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    background-color: #F8F7FC !important;
}

/* Clean custom scrollbar for main area */
.gh-main-area::-webkit-scrollbar {
    width: 7px;
}
.gh-main-area::-webkit-scrollbar-thumb {
    background: #D8D2EE;
    border-radius: 4px;
}
.gh-main-area::-webkit-scrollbar-track {
    background: transparent;
}

.gh-canvas-columns {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 32px;
    max-width: 1400px;
    margin: 0 auto;
    padding-bottom: 60px;
}

.gh-overview-container {
    max-width: 1320px;
    margin: 0 auto;
    padding-bottom: 60px;
}

/* General Cards */
.gh-card,
.gh-section-card {
    background: #FFFFFF;
    border: 1px solid var(--gh-border);
    border-radius: 14px;
    padding: 24px 28px;
    margin-bottom: 28px;
    box-shadow: 0 4px 18px rgba(27, 18, 64, 0.02);
}

.gh-card-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.gh-card-top-bar h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}
.gh-card-desc-note {
    font-size: 12.5px;
    color: var(--gh-muted);
    margin: 0 0 18px;
}

/* Responsive: Tablet & Mobile Drawer */
.gh-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(27, 18, 64, 0.6);
    backdrop-filter: blur(2px);
    z-index: 99990;
}

/* ==========================================================================
   ANALYTICS SCREEN STYLES (Figma Match with Gold #F3C343)
   ========================================================================== */
.gh-analytics-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    gap: 16px;
}
.gh-analytics-top h1 {
    font-size: 30px;
    font-weight: 700;
    margin-bottom: 4px;
}
.gh-analytics-top p {
    font-size: 14px;
    color: var(--gh-muted);
    margin: 0;
}
.gh-btn-export-csv {
    background: #FFFFFF !important;
    color: var(--gh-purple) !important;
    border: 1.5px solid var(--gh-purple) !important;
    font-family: var(--gh-font-h);
    font-size: 13.5px;
    font-weight: 600;
    padding: 9px 22px;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.gh-btn-export-csv:hover {
    background: var(--gh-purple-light) !important;
}

/* 3 Filters */
.gh-analytics-filters {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.gh-filter-col {
    display: flex;
    flex-direction: column;
}
.gh-filter-col label {
    font-family: var(--gh-font-h);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--gh-muted);
    text-transform: uppercase;
    margin-bottom: 6px;
}
.gh-filter-select {
    background: #FFFFFF !important;
    border: 1.5px solid var(--gh-tint) !important;
    border-radius: 10px !important;
    height: 48px !important;
    min-height: 48px !important;
    padding: 0 38px 0 16px !important;
    font-size: 14px !important;
    font-family: var(--gh-font-b) !important;
    color: var(--gh-dark) !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23632FD1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: calc(100% - 14px) center !important;
    cursor: pointer;
    width: 100%;
}

/* 4 Metric Cards */
.gh-analytics-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}
.gh-stat-card {
    background: var(--gh-dark);
    border-radius: 12px;
    padding: 20px 18px;
    color: #FFFFFF;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 105px;
}
.gh-stat-num {
    font-family: var(--gh-font-h);
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 8px;
}
.gh-stat-desc {
    font-size: 12px;
    color: var(--gh-tint);
    line-height: 1.3;
    font-weight: 500;
}

/* Weekly Trend Bar Chart */
.gh-chart-container {
    padding: 10px 0;
}
.gh-chart-bars-wrap {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    align-items: flex-end;
    padding: 10px 0 16px 0;
    border-bottom: 1px solid #F3F4F6;
    margin-bottom: 18px;
    width: 100%;
}
.gh-chart-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
}
.gh-bar-val {
    font-size: 13px;
    font-weight: 700;
    color: var(--gh-dark);
    font-family: var(--gh-font-h);
    margin-bottom: 8px;
    line-height: 1;
    text-align: center;
}
.gh-bar-track {
    width: 44px;
    max-width: 100%;
    height: 130px;
    display: flex;
    align-items: flex-end;
    background: transparent;
}
.gh-bar-fill {
    width: 100%;
    border-radius: 8px 8px 0 0;
    transition: height 0.4s ease;
}
.gh-bar-labels {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 10px;
    text-align: center;
}
.gh-week-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--gh-dark);
    font-family: var(--gh-font-h);
    line-height: 1.2;
    white-space: nowrap;
}
.gh-week-rating {
    font-size: 11.5px;
    color: #6B7280;
    font-family: var(--gh-font-b);
    margin-top: 3px;
    line-height: 1.2;
    white-space: nowrap;
}
.gh-chart-legend {
    display: flex;
    gap: 24px;
    align-items: center;
    padding: 0;
    margin: 0;
    font-size: 13px;
    color: #374151;
    font-family: var(--gh-font-b);
    clear: both;
}
.gh-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.gh-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.gh-dot-purple { background-color: var(--gh-purple); }
.gh-dot-gold { background-color: var(--gh-gold); } /* #F3C343 */

/* Table */
.gh-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.gh-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13.5px;
    min-width: 520px;
}
.gh-table th {
    font-family: var(--gh-font-h);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--gh-muted);
    text-transform: uppercase;
    padding: 12px 14px;
    border-bottom: 1.5px solid var(--gh-border);
    white-space: nowrap;
}
.gh-table td {
    padding: 14px;
    border-bottom: 1px solid var(--gh-border);
    color: var(--gh-text);
    vertical-align: middle;
    white-space: nowrap;
}
.gh-table tr:last-child td {
    border-bottom: none;
}

/* Status Badges & Pills */
.gh-pill-badge,
.gh-status-badge {
    display: inline-block !important;
    padding: 5px 14px !important;
    border-radius: 9999px !important;
    font-family: var(--gh-font-h) !important;
    font-size: 11.5px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    text-align: center !important;
}
.gh-badge-track,
.gh-flag-ontrack {
    background: #E8F5E9 !important;
    color: #2E7D32 !important;
}
.gh-badge-low,
.gh-flag-twomisses {
    background: #FEF3C7 !important;
    color: #92400E !important;
}
.gh-badge-lapsed,
.gh-flag-absent {
    background: #FFEBEE !important;
    color: #C62828 !important;
}

.gh-table-footer-note {
    font-size: 12px;
    color: var(--gh-muted);
    margin: 16px 0 0;
}

/* Tablet & Mobile Media Queries */
@media (max-width: 1024px) {
    html, body {
        height: auto !important;
        overflow: auto !important;
        overflow-x: hidden !important;
    }
    .gh-portal-wrapper {
        height: auto !important;
        overflow: visible !important;
    }
    .gh-mobile-bar {
        display: flex;
    }
    .gh-dash-grid {
        grid-template-columns: minmax(0, 1fr) !important;
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
    }
    .gh-sidebar {
        position: fixed !important;
        left: -300px !important;
        top: 0 !important;
        bottom: 0 !important;
        width: 280px !important;
        z-index: 99999 !important;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        padding-bottom: 80px !important;
    }
    .gh-sidebar.open {
        left: 0 !important;
    }
    .gh-drawer-overlay.open {
        display: block;
    }
    .gh-main-area {
        padding: 20px 14px !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: none !important;
        overflow-y: visible !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    .gh-sidebar-close {
        display: block !important;
        position: absolute;
        top: 14px;
        right: 14px;
        background: transparent;
        border: none;
        color: var(--gh-tint);
        font-size: 26px;
        cursor: pointer;
    }
    .gh-analytics-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px !important;
    }
}

@media (max-width: 640px) {
    .gh-main-area {
        padding: 14px 10px !important;
    }
}
.gh-sidebar-close { display: none; }

@media (max-width: 640px) {
    .gh-analytics-top {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    .gh-btn-export-csv {
        width: 100% !important;
        text-align: center !important;
    }
    .gh-analytics-filters {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    .gh-analytics-stats {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }
    .gh-section-card {
        padding: 20px 16px !important;
    }
    .gh-chart-bars-wrap {
        gap: 6px !important;
        padding: 6px 0 14px 0 !important;
        margin-bottom: 14px !important;
    }
    .gh-bar-track {
        width: 100% !important;
        max-width: 30px !important;
        height: 110px !important;
    }
    .gh-bar-val, .gh-week-name {
        font-size: 11px !important;
    }
    .gh-week-rating {
        font-size: 10px !important;
    }
    .gh-chart-legend {
        flex-wrap: wrap !important;
        gap: 10px 16px !important;
        font-size: 12px !important;
    }
}

/* Global Pill Toggle Buttons */
.gh-pill-btn {
    border: 1.5px solid #D8D2EE !important;
    background: #FFFFFF !important;
    color: #1B1240 !important;
    font-family: var(--gh-font-h, 'Poppins', sans-serif) !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    padding: 8px 18px !important;
    border-radius: 9999px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}
.gh-pill-btn:hover {
    border-color: #632FD1 !important;
    background: #F4F1FB !important;
    color: #632FD1 !important;
}
.gh-pill-btn.active,
.gh-pill-btn.active:hover {
    background: #632FD1 !important;
    border-color: #632FD1 !important;
    color: #FFFFFF !important;
}

/* Overview Header & 5 Metric Cards */
.gh-overview-top {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    margin-bottom: 24px !important;
    flex-wrap: wrap !important;
    gap: 16px !important;
}

.gh-overview-top h1 {
    font-family: var(--gh-font-h, 'Poppins', sans-serif) !important;
    font-size: 28px !important;
    font-weight: 700 !important;
    color: var(--gh-dark, #1B1240) !important;
    margin: 0 0 6px 0 !important;
    line-height: 1.2 !important;
}

.gh-overview-top p {
    font-family: var(--gh-font-b, 'Lato', sans-serif) !important;
    font-size: 14.5px !important;
    color: #6B6580 !important;
    margin: 0 !important;
    line-height: 1.4 !important;
}

.gh-stats-row {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 16px !important;
    margin-bottom: 28px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.gh-header-actions {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    flex-wrap: wrap !important;
}
.gh-btn-log-class {
    background: var(--gh-purple, #632FD1) !important;
    color: #FFFFFF !important;
    font-family: var(--gh-font-h, 'Poppins', sans-serif) !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    padding: 10px 22px !important;
    border-radius: 9999px !important;
    text-decoration: none !important;
    transition: background 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
}
.gh-btn-log-class:hover {
    background: #5224B8 !important;
}
.gh-btn-schedule-live {
    background: #FFFFFF !important;
    color: var(--gh-purple, #632FD1) !important;
    border: 1.5px solid var(--gh-purple, #632FD1) !important;
    font-family: var(--gh-font-h, 'Poppins', sans-serif) !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    padding: 9px 20px !important;
    border-radius: 9999px !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
}
.gh-btn-schedule-live:hover {
    background: var(--gh-purple-light, #F4F1FB) !important;
}

@media (max-width: 1024px) {
    .gh-canvas-columns {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 20px !important;
        width: 100% !important;
    }
    .gh-stats-row {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 14px !important;
    }
}
@media (max-width: 768px) {
    .gh-stats-row {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px !important;
    }
    .gh-stats-row .gh-stat-card:last-child {
        grid-column: span 2 !important;
    }
}
@media (max-width: 640px) {
    .gh-header-actions {
        width: 100% !important;
        flex-direction: column !important;
    }
    .gh-btn-log-class,
    .gh-btn-schedule-live {
        width: 100% !important;
        text-align: center !important;
    }
    .gh-stats-row {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    .gh-stats-row .gh-stat-card:last-child {
        grid-column: span 1 !important;
    }
}
