/* ============================================
   OurCare Dashboard - Single Question Layout
   Based on Figma Design
   ============================================ */

/* Design Tokens */
:root {
    /* Colors */
    --primary-purple: #4D5DD9;
    --primary-purple-dark: #6550FF;
    --accent-cyan: #01DBFF;
    --accent-green: #6DF2B9;
    --accent-pink: #FF4F8B;
    --accent-yellow: #FFC107;
    --accent-purple: #673AB7;
    --accent-orange: #FD7045;
    --accent-blue: #286EE2;
    --accent-lime: #86E749;
    --accent-magenta: #B150C2;
    --border-gray: #B5B4C8;
    --bg-light: #F2F1FD;
    --bg-white: #FFFFFF;
    --text-black: #000000;
    --text-white: #FFFFFF;
    
    /* Typography */
    --font-primary: 'Poppins', sans-serif;
    --font-secondary: 'Outfit', sans-serif;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-xxl: 48px;
}

/* Global overflow prevention */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: inherit;
}

/* Base Layout */
.question-page {
    position: relative;
    width: 100%;
    min-height: 100vh;
    background: var(--bg-white);
    overflow-x: hidden;
    max-width: 100vw;
}

/* Navigation Bar */
.nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 16px 30px;
    width: 100%;
    max-width: 100vw;
    height: 72px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-gray);
    overflow-x: hidden;
}

.nav-logo {
    font-family: var(--font-primary);
    font-style: normal;
    font-weight: 700;
    font-size: 32px;
    line-height: 102%;
    letter-spacing: -0.04em;
    color: var(--primary-purple);
    text-decoration: none;
}

.explore-dropdown-toggle {
    cursor: pointer;
}

.breadcrumb-chevron {
    font-size: 8px;
    color: var(--text-black);
}

#breadcrumbMenuHeader {
    color: var(--primary-purple);
}

.is-hidden {
    display: none;
}

.legend--hidden {
    display: none !important;
}

#questionTextContainer {
    margin-bottom: 8px;
    margin-left: 40px;
}

#questionFullText {
    margin: 0;
}

.section-divider {
    border: 1px solid var(--border-gray);
    margin: 40px 0;
}

/* By Demographic header (desktop templates place this outside `.section-header`) */
#demographicSection > .section-title {
    margin: 0 0 24px 0;
}

/* Multi-choice demographic header container */
#demographicSection .demographic-header-container .section-title {
    margin: 0;
}

.option-selector-label {
    font-family: var(--font-primary);
    font-weight: 500;
    font-size: 14px;
    color: var(--text-black);
    margin-right: 12px;
}

.option-selector {
    font-family: var(--font-primary);
    font-size: 14px;
    padding: 8px 12px;
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    background: #fff;
    color: var(--text-black);
    min-width: 200px;
    cursor: pointer;
}

.nav-search {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px 8px 16px;
    gap: 11px;
    width: 731px;
    max-width: 100%;
    height: 36px;
    background: var(--bg-white);
    border: 1px solid var(--border-gray);
    border-radius: 40px;
    box-sizing: border-box;
    flex-shrink: 1;
}

.nav-search input {
    flex: 1;
    border: none;
    outline: none;
    font-family: var(--font-primary);
    font-weight: 400;
    font-size: 14px;
    line-height: 102%;
    color: var(--text-black);
}

.nav-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 24px;
    flex-shrink: 0;
}

.nav-dropdown {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    font-family: var(--font-primary);
    font-weight: 500;
    font-size: 14px;
    line-height: 102%;
    color: var(--text-black);
}

.nav-button {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    padding: 10px 16px;
    gap: 4px;
    width: 93px;
    height: 36px;
    border: 1px solid var(--primary-purple);
    border-radius: 39px;
    background: transparent;
    font-family: var(--font-primary);
    font-weight: 500;
    font-size: 14px;
    line-height: 102%;
    color: var(--primary-purple);
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-button:hover {
    background: var(--primary-purple);
    color: var(--text-white);
}

/* Side Navigation */
.side-nav {
    position: fixed;
    left: 0;
    top: 72px;
    width: 300px;
    max-width: 100%;
    height: calc(100vh - 72px);
    background: var(--bg-light);
    padding: 27px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

.side-nav-item {
    font-family: var(--font-primary);
    font-weight: 400;
    font-size: 14px;
    line-height: 102%;
    color: var(--text-black);
    cursor: pointer;
    padding: 6px 0 6px 16px;
    transition: color 0.3s ease;
}

/* First item (All Responses) should not be indented */
.side-nav-item:first-child {
    padding-left: 0;
    font-weight: 500;
}

.side-nav-item.active {
    font-weight: 600;
    color: var(--primary-purple);
}

.side-nav-item:hover {
    color: var(--primary-purple);
}

/* Question Header */
.question-header {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 20px 24px 12px 24px;
    gap: 16px;
    width: calc(100% - 300px);
    max-width: calc(100vw - 300px);
    margin-left: 300px;
    margin-top: 72px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-gray);
    overflow-x: hidden;
}

.question-breadcrumb {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-family: var(--font-primary);
    font-weight: 400;
    font-size: 16px;
    line-height: 140%;
    color: var(--primary-purple);
    flex-wrap: wrap;
    max-width: 100%;
}

.question-breadcrumb-item {
    color: var(--text-black);
}

.question-title {
    font-family: var(--font-primary);
    font-style: normal;
    font-weight: 600;
    font-size: 36px;
    line-height: 102%;
    color: var(--text-black);
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

/* Main Content Area */
.main-content {
    width: calc(100% - 300px);
    max-width: calc(100vw - 300px);
    margin-left: 300px;
    padding: 0px 12px 24px 12px;
    background: var(--bg-white);
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Section Headers */
.section-header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    margin-left: 40px;
}

.section-title {
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 24px;
    line-height: 120%;
    color: var(--text-black);
}

.section-subtitle {
    font-family: var(--font-primary);
    font-weight: 500;
    font-size: 16px;
    line-height: 102%;
    color: var(--text-black);
    text-align: right;
}

/* Chart Container */
.chart-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin-bottom: 40px;
    margin-left: -20px;
    box-sizing: border-box;
    /* Ensure the chart area never becomes its own vertical scroll container */
    overflow-x: hidden;
    overflow-y: visible;
}

.chart-wrapper-container {
    display: flex;
    flex-direction: row;
    gap: 16px;
    align-items: flex-start;
    width: 100%;
}

.chart-wrapper-container .legend {
    align-self: flex-start;
    margin-top: 0;
}

/* Align legend with chart area (below title) for demographic charts */
.demographic-section .chart-wrapper-container .legend {
    margin-top: 40px;
}

/* Chart Disclaimer */
.chart-disclaimer {
    margin-top: 16px;
    margin-left: 20px;  /* Compensate for chart-container's -20px margin */
    font-family: var(--font-primary);
    font-size: 12px;
    line-height: 1.5;
    color: #666666;
    font-style: italic;
    padding: 0;
}

.percentile-grid {
    position: relative;
    width: 100%;
    height: 364px;
    margin-bottom: 24px;
}

.percentile-grid-lines {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    gap: 52px;
    position: absolute;
    left: 22px;
    right: 23px;
    top: 0;
    bottom: 24px;
}

.percentile-line {
    width: 100%;
    height: 0;
    opacity: 0.5;
    border: 1px solid var(--border-gray);
    transform: rotate(90deg);
}

.percentile-labels {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.percentile-label {
    font-family: var(--font-primary);
    font-weight: 400;
    font-size: 14px;
    line-height: 102%;
    text-align: center;
    color: var(--text-black);
}

/* Demographic Breakdown */
.demographic-section {
    margin-bottom: 60px;
}

.demographic-section .chart-container {
    margin-left: -15px;
}

.demographic-chart-title {
    margin-left: 40px;
}

.demographic-title {
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 18px;
    line-height: 120%;
    color: var(--text-black);
    margin-bottom: 16px;
}

.demographic-header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    margin-left: 0;
    margin-right: 0;
}


.demographic-chart {
    position: relative;
    width: 100%;
    margin-bottom: 24px;
}

.demographic-label {
    position: absolute;
    font-family: var(--font-primary);
    font-weight: 500;
    font-size: 14px;
    line-height: 102%;
    text-align: right;
    color: var(--text-black);
}

/* Bar Chart Colors */
.bar-color-1 { background: var(--primary-purple-dark); }
.bar-color-2 { background: var(--accent-green); }
.bar-color-3 { background: var(--accent-pink); }
.bar-color-4 { background: var(--accent-yellow); }
.bar-color-5 { background: var(--accent-purple); }
.bar-color-6 { background: var(--accent-orange); }
.bar-color-7 { background: var(--accent-blue); }
.bar-color-8 { background: var(--accent-lime); }
.bar-color-9 { background: var(--accent-magenta); }
.bar-color-10 { background: var(--accent-cyan); }

/* Legend */
.legend {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 200px;
    flex-shrink: 0;
    margin-top: 0;
}

.legend-item {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 6px;
}

.legend-color {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.legend-label {
    font-family: var(--font-primary);
    font-weight: 500;
    font-size: 14px;
    line-height: 102%;
    color: var(--text-black);
}

/* Tooltip */
.tooltip {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    padding: 19px 0;
    gap: 10px;
    position: absolute;
    background: var(--bg-white);
    box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.25);
    border-radius: 4px;
    z-index: 1000;
}

.tooltip-content {
    font-family: var(--font-primary);
    font-weight: 500;
    font-size: 14px;
    line-height: 102%;
    text-align: right;
    color: var(--text-black);
}

.tooltip-arrow {
    position: absolute;
    width: 24px;
    height: 24px;
    background: var(--bg-white);
    transform: rotate(-90deg);
}

/* Footer */
.data-footer {
    width: calc(100% - 300px);
    max-width: calc(100vw - 300px);
    margin-left: 300px;
    height: auto;
    min-height: 199px;
    background: var(--text-black);
    padding: 37px 12px;
    margin-top: 60px;
    box-sizing: border-box;
    overflow-x: hidden;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 100%;
    box-sizing: border-box;
}

.footer-logos {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 37px;
    flex-wrap: wrap;
    max-width: 100%;
}

.footer-divider {
    width: 100%;
    height: 0;
    border: 1px solid var(--text-white);
}

.footer-links {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 34px;
    flex-wrap: wrap;
    max-width: 100%;
}

.footer-link {
    font-family: var(--font-secondary);
    font-weight: 500;
    font-size: 14px;
    line-height: 102%;
    color: var(--primary-purple);
    text-decoration: none;
}

.footer-copyright {
    font-family: var(--font-secondary);
    font-weight: 400;
    font-size: 14px;
    line-height: 140%;
    letter-spacing: 0.06em;
    color: var(--text-white);
}

/* =========================================================
   DATA FOOTER (Desktop Question Templates) - Figma alignment
   Target: inner frame width 1050px starting at x=341 (300 sidebar + 41)
   ========================================================= */
.dashboard-device-desktop .data-footer.data-footer--figma-1050 {
    padding: 39px 0;
    min-height: 323px;
    margin-top: 0;
}

.dashboard-device-desktop .data-footer.data-footer--figma-1050 .footer-content {
    width: min(1050px, calc(100% - 40px));
    margin-left: 41px;
    gap: 37px;
}

.dashboard-device-desktop .data-footer.data-footer--figma-1050 .footer-links.footer-links-desktop {
    width: 100%;
}

.dashboard-device-desktop .data-footer.data-footer--figma-1050 .footer-links {
    justify-content: space-between;
    align-items: flex-start;
    gap: 108px;
    flex-wrap: nowrap;
}

.dashboard-device-desktop .data-footer.data-footer--figma-1050 .footer-links-column {
    width: 344px;
    flex: 0 0 344px;
    gap: 16px;
}

.dashboard-device-desktop .data-footer.data-footer--figma-1050 .footer-link {
    display: block;
    margin-bottom: 0;
}

.dashboard-device-desktop .data-footer.data-footer--figma-1050 .footer-logos {
    width: 598px;
    max-width: 598px;
    display: grid;
    grid-template-columns: max-content max-content max-content;
    grid-template-rows: auto auto;
    justify-content: space-between;
    align-items: center;
    row-gap: 40px;
    flex-wrap: nowrap;
}

/* Explicit placement to match Figma arrangement (5 logos; second row right cell empty) */
.dashboard-device-desktop .data-footer.data-footer--figma-1050 .footer-logos .footer-logo:nth-child(1) { grid-column: 1; grid-row: 1; }
.dashboard-device-desktop .data-footer.data-footer--figma-1050 .footer-logos .footer-logo:nth-child(2) { grid-column: 2; grid-row: 1; }
.dashboard-device-desktop .data-footer.data-footer--figma-1050 .footer-logos .footer-logo:nth-child(3) { grid-column: 3; grid-row: 1; }
.dashboard-device-desktop .data-footer.data-footer--figma-1050 .footer-logos .footer-logo:nth-child(5) { grid-column: 1; grid-row: 2; }
.dashboard-device-desktop .data-footer.data-footer--figma-1050 .footer-logos .footer-logo:nth-child(4) { grid-column: 2; grid-row: 2; }

/* Responsive Design */


/* ============================================
   DEVICE MODE OVERRIDES (server-selected templates)
   ============================================ */
/* `dashboard.js` applies `.dashboard-device-mobile` / `.dashboard-device-desktop` to <html>.
   Mirror the mobile breakpoint behavior so mobile templates render correctly even when
   opened at a desktop viewport width (useful for testing and server-selected device mode). */
.dashboard-device-mobile .side-nav {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: none;
}

.dashboard-device-mobile .main-content,
.dashboard-device-mobile .question-header {
    width: 100%;
    max-width: 100vw;
    margin-left: 0;
    padding-left: 8px;
    padding-right: 8px;
}

.dashboard-device-mobile .nav-bar {
    padding: 16px;
    flex-wrap: wrap;
    height: auto;
    min-height: 72px;
}

.dashboard-device-mobile .data-footer {
    width: 100%;
    max-width: 100vw;
    margin-left: 0;
    padding: 24px 16px;
}

.dashboard-device-mobile .section-header {
    margin-left: 8px;
}

.dashboard-device-mobile .chart-wrapper-container {
    gap: 8px;
}

.dashboard-device-mobile .chart-wrapper {
    padding-left: 0;
    margin-left: 0;
}

.dashboard-device-mobile .chart-container {
    padding-left: 0;
    padding-right: 0;
}

.dashboard-device-mobile .chart-disclaimer {
    margin-left: 16px;
    padding-right: 16px;
}


/* Additional mobile breakpoint for 480px */


/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
