/* ===========================================
   BVAS.CSS - BVAS v3 Calculator Styles
   Desktop Grid + Mobile Stepper
   =========================================== */

/* Note: Page theme (data-page="bvas") is defined in variables.css */

/* ===========================================
   DESKTOP GRID LAYOUT (900px+)
   =========================================== */
@media (min-width: 900px) {
    [data-page="bvas"] .page-content {
        max-width: var(--layout-wide);
        padding-bottom: 2rem;
    }

    .bvas-desktop-container {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
    
    /* --- Sticky Header (extends .calc-sticky-header) --- */
    .bvas-desktop-header {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
    }

    .bvas-header-scores {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 1rem;
    }
    
    .bvas-desktop-header .calc-header-copy {
        justify-self: end;
    }

    .bvas-header-score {
        display: flex;
        align-items: baseline;
        gap: 0.25rem;
        padding: 0.375rem 0.625rem;
        border-radius: var(--radius-sm);
        background: var(--bg-primary);
    }
    
    .bvas-header-score-label {
        font-size: 0.8125rem;  /* Was --text-xs (12px) - increased for readability */
        font-weight: var(--font-medium);
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.025em;
    }
    
    .bvas-header-score-value {
        font-size: var(--text-xl);
        font-weight: var(--font-bold);
        font-variant-numeric: tabular-nums;
        color: var(--text-secondary);
        transition: color var(--transition-fast);
    }
    
    .bvas-header-score-value.has-value {
        color: var(--text-primary);
    }
    
    .bvas-header-score.p-score .bvas-header-score-value.has-value {
        color: var(--bvas-persistent-text);
    }
    
    .bvas-header-score.nw-score .bvas-header-score-value.has-value {
        color: var(--bvas-new-worse-text);
    }
    
    .bvas-header-score-max {
        font-size: var(--text-sm);
        color: var(--text-muted);
        font-variant-numeric: tabular-nums;
    }
    
    /* --- Grid Layout --- */
    .bvas-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        align-items: start;
    }
    
    @media (min-width: 1200px) {
        .bvas-grid {
            grid-template-columns: repeat(3, 1fr);
        }
    }
    
    .bvas-grid-section[data-section="general"] {
        border-top: 3px solid var(--theme-primary);
        border-radius: var(--radius-lg);
    }
    
    /* --- Grid Section Card --- */
    .bvas-grid-section {
        background: var(--bg-elevated);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-lg);
        overflow: hidden;
        box-shadow: var(--shadow-sm);
    }
    
    .bvas-grid-section-header {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
        background: var(--bg-primary);
        border-bottom: 1px solid var(--border-color);
    }
    
    .bvas-grid-section-icon {
        font-size: 1.125rem;
        line-height: 1;
    }
    
    .bvas-grid-section-title {
        flex: 1;
        margin: 0;
        font-size: var(--text-sm);
        font-weight: var(--font-bold);
        color: var(--text-primary);
    }
    
    .bvas-grid-section-scores {
        display: flex;
        gap: 0.25rem;
    }
    
    /* Section score badges - pill shape matches mobile badges */
    .bvas-section-score {
        font-size: 0.8125rem;  /* Was --text-xs (12px) - increased for readability */
        font-weight: var(--font-bold);
        padding: 0.1875rem 0.5rem;
        border-radius: var(--radius-pill);
        min-width: 22px;
        text-align: center;
        font-variant-numeric: tabular-nums;
        transition:
            background var(--transition-fast),
            color var(--transition-fast);
    }
    
    .bvas-section-score.p {
        background: var(--bg-secondary);
        color: var(--text-muted);
    }
    
    .bvas-section-score.p.has-value {
        background: var(--bvas-persistent);
        color: var(--text-on-theme);
    }
    
    .bvas-section-score.nw {
        background: var(--bg-secondary);
        color: var(--text-muted);
    }
    
    .bvas-section-score.nw.has-value {
        background: var(--bvas-new-worse);
        color: var(--text-on-theme);
    }
    
    /* --- Grid Items --- */
    .bvas-grid-section-items {
        padding: 0.25rem 0;
    }
    
    .bvas-grid-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        padding: 0.5rem 0.75rem;
        border-bottom: 1px solid var(--border-light);
        transition: background var(--transition-fast);
    }
    
    .bvas-grid-item:last-child {
        border-bottom: none;
    }
    
    @media (any-hover: hover) {
        .bvas-grid-item:hover {
            background: var(--bg-primary);
        }
    }
    
    .bvas-grid-item-label {
        flex: 1;
        font-size: var(--text-sm);
        color: var(--text-primary);
        line-height: var(--leading-snug);
        min-width: 0;
        /* Truncate long labels */
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* --- Compact Segmented Controls --- */
    .bvas-grid-item-controls {
        flex-shrink: 0;
    }
    
    .bvas-grid-item-controls .sliding-pill-btn {
        min-width: 28px;
        padding: 0.25rem 0.5rem;
    }
    
    /* --- Reset Button --- */
    /* Note: .bvas-desktop-reset styles moved to components.css */

    /* Hide mobile elements */
    .bvas-mobile {
        display: none !important;
    }
}


/* ===========================================
   MOBILE STEPPER LAYOUT (<900px)
   =========================================== */
@media (max-width: 899px) {
    [data-page="bvas"] .page-content {
        max-width: 600px;
        padding-bottom: 2rem;
    }

    /* Hide desktop elements */
    .bvas-desktop-container {
        display: none;
    }
    
    .bvas-container {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
    
    .bvas-mobile .bvas-intro {
        display: none;
    }
    
    /* Stepper content */
    .bvas-stepper-content {
        padding: 0.25rem 0.75rem 1rem;
        scroll-margin-top: 10px;         /* Reduced - header outside scroll container */
    }
    
    .bvas-stepper-header {
        margin-bottom: 0.5rem;
    }
    
    .bvas-stepper-title-row {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    
    .bvas-stepper-icon {
        font-size: 1.25rem;
        line-height: 1;
    }
    
    .bvas-stepper-title {
        font-size: var(--text-lg);
        font-weight: var(--font-bold);
        color: var(--text-primary);
        margin: 0;
    }
    
    .bvas-stepper-count {
        font-size: var(--text-xs);
        color: var(--text-muted);
        padding-left: 0.5rem;
        border-left: 1px solid var(--border-color);
        margin-left: 0.5rem;
    }
    
    .bvas-stepper-scores {
        display: flex;
        gap: 0.375rem;
        margin-left: auto;
    }
    
    .bvas-score-badge {
        font-size: 0.8125rem;  /* Was --text-xs (12px) - increased for readability */
        font-weight: var(--font-bold);
        padding: 0.25rem 0.625rem;
        border-radius: var(--radius-pill);
        font-variant-numeric: tabular-nums;
    }
    
    .bvas-score-badge.p {
        background: var(--bvas-persistent-bg);
        color: var(--bvas-persistent);
    }
    
    .bvas-score-badge.p.has-value {
        background: var(--bvas-persistent);
        color: var(--text-on-theme);
    }
    
    .bvas-score-badge.nw {
        background: var(--bvas-new-worse-bg);
        color: var(--bvas-new-worse);
    }
    
    .bvas-score-badge.nw.has-value {
        background: var(--bvas-new-worse);
        color: var(--text-on-theme);
    }
    
    /* Stepper items */
    .bvas-stepper-items {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        margin-bottom: 1rem;
        width: 100%;
    }
    
    .bvas-mobile-item {
        background: var(--bg-elevated);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-lg);
        padding: 1rem;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
        box-sizing: border-box;
        box-shadow: var(--shadow-sm);
    }
    
    .bvas-mobile-item-info {
        display: flex;
        flex-direction: column;
        gap: 0.125rem;
    }
    
    .bvas-mobile-item-label {
        font-size: var(--text-sm);
        font-weight: var(--font-semibold);
        color: var(--text-primary);
        line-height: var(--leading-snug);
    }
    
    .bvas-mobile-item-desc {
        font-size: var(--text-xs);
        color: var(--text-muted);
        line-height: var(--leading-relaxed);
    }
    
    .bvas-mobile-item-controls {
        border-radius: var(--radius-md);
        padding: 4px;
    }
    
    .bvas-mobile-item-controls .sliding-pill-btn {
        flex: 1;
        padding: 0.75rem 0.5rem;
        font-size: var(--text-sm);
        border-radius: var(--radius-sm);
    }

    /* Adjust indicator border-radius for mobile */
    .bvas-mobile-item-controls .sliding-pill-indicator {
        border-radius: var(--radius-sm);
    }
    
    /* Navigation buttons */
    .bvas-stepper-nav {
        display: flex;
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }
    
    .bvas-nav-btn {
        flex: 1;
        padding: 0.875rem 1rem;
        font-size: var(--text-sm);
        font-weight: var(--font-semibold);
        border: none;
        border-radius: var(--radius-md);
        cursor: pointer;
        font-family: inherit;
        transition: 
            background var(--transition-fast),
            opacity var(--transition-fast);
    }
    
    .bvas-nav-btn.prev {
        background: var(--bg-secondary);
        color: var(--text-secondary);
    }
    
    .bvas-nav-btn.next {
        background: var(--theme-primary);
        color: var(--text-on-theme);
    }
    
    .bvas-nav-btn:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }
    
    .bvas-nav-btn.prev:active:not(:disabled) {
        background: var(--bg-tertiary);
    }
    
    .bvas-nav-btn.next:active:not(:disabled) {
        background: var(--theme-dark);
    }
    
    /* Results button */
    .bvas-nav-btn.results {
        background: var(--theme-primary);
        color: var(--text-on-theme);
    }
    
    .bvas-nav-btn.results:active {
        background: var(--theme-dark);
        transform: scale(0.98);
    }
    
    /* Reset link in stepper */
    .bvas-stepper-content .reset-link {
        width: 100%;
        margin: 0 0 2rem;
        padding: 0.875rem 1rem;
        border: none;
        border-radius: var(--radius-md);
        background: var(--bg-elevated);
        color: var(--text-primary);
        box-shadow: 
            0 0 0 1px var(--border-color),
            var(--shadow-xs);
        transition: 
            background var(--transition-fast),
            box-shadow var(--transition-fast),
            color var(--transition-fast);
    }
    
    @media (any-hover: hover) {
        .bvas-stepper-content .reset-link:hover {
            background: rgba(220, 38, 38, 0.1);
            box-shadow:
                0 0 0 1px rgba(220, 38, 38, 0.4),
                var(--shadow-sm);
            color: var(--risk-high-text);
        }
    }

    .bvas-stepper-content .reset-link:active {
        background: rgba(220, 38, 38, 0.15);
        box-shadow:
            0 0 0 1px rgba(220, 38, 38, 0.5),
            var(--shadow-sm);
        color: var(--risk-high-text);
    }

    [data-theme="dark"] .bvas-stepper-content .reset-link {
        background: var(--bg-primary);
    }

    @media (any-hover: hover) {
        [data-theme="dark"] .bvas-stepper-content .reset-link:hover {
            background: rgba(220, 38, 38, 0.15);
            box-shadow:
                0 0 0 1px rgba(239, 68, 68, 0.5),
                var(--shadow-sm);
            color: var(--risk-high-border);
        }
    }

    [data-theme="dark"] .bvas-stepper-content .reset-link:active {
        background: rgba(220, 38, 38, 0.15);
        box-shadow:
            0 0 0 1px rgba(239, 68, 68, 0.5),
            var(--shadow-sm);
        color: var(--risk-high-border);
    }
}


/* ===========================================
   PRINT STYLES
   =========================================== */
@media print {
    [data-page="bvas"] .page-content {
        padding-bottom: 0;
        max-width: none;
    }

    .bvas-desktop-header {
        position: static;
        box-shadow: none;
        border: 1px solid var(--border-print);
    }

    .bvas-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .bvas-grid-section {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid var(--border-print);
    }
    
    .bvas-desktop-reset,
    .bvas-header-copy {
        display: none;
    }
}
