/**
 * BIO-CLINIC LAYOUT & SEARCH CSS v3.1.0
 * ======================================
 * Consolidated CSS for header, search, and layout
 * 
 * Z-INDEX SCALE (consistent hierarchy):
 * - Header: 1000
 * - Mobile nav overlay: 900
 * - Search dropdowns: 800
 * - Hero content: 1-10
 * - Modals: 1100+
 * 
 * @version 3.1.0
 * @date 2026-02-02
 */

/* ============================================
   Z-INDEX VARIABLES (for consistency)
   ============================================ */
:root {
    --z-header: 1000;
    --z-mobile-nav: 900;
    --z-search-dropdown: 800;
    --z-modal: 1100;
}

/* ============================================
   1. HEADER LAYOUT
   ============================================ */

/* ============================================
   HEADER - Fixed at top with white background
   ============================================ */
.header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1000 !important;
    background-color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
    height: 80px;
    border-bottom: 1px solid #e5e7eb;
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 0 1.5rem;
    background-color: #ffffff;
    flex-wrap: nowrap;
    gap: 0.75rem;
    box-sizing: border-box;
}

/* ============================================
   BODY & MAIN WRAPPER - Correct spacing
   ============================================ */
body {
    margin: 0;
    padding: 0; /* NO padding on body */
}

/* Main content wrapper - THIS gets the padding */
.site-main,
main.site-main {
    padding-top: 80px; /* Exact header height */
}

/* ============================================
   MOBILE ADJUSTMENTS
   ============================================ */
@media (max-width: 768px) {
    .header {
        height: 70px;
    }
    
    .site-main,
    main.site-main {
        padding-top: 70px;
    }
}

/* ============================================
   2. SEARCH COMPONENTS
   ============================================ */

/* === 2.1 Search Base Styles === */
.search-container {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-left: 2.5rem;
    font-size: 1rem;
    border: 2px solid var(--gray-200, #e5e7eb);
    border-radius: var(--radius-lg, 0.75rem);
    background: var(--white, #fff);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary, #7CBA3D);
    box-shadow: 0 0 0 3px rgba(124, 186, 61, 0.15);
}

.search-input::placeholder {
    color: var(--gray-400, #9ca3af);
}

.search-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
}

/* === 2.2 Hero Search Section (Home Page) === */
/* Section is full-width, inner content is centered */
section.hero-search {
    position: relative;
    width: 100%;
    max-width: none;
    z-index: 1; /* Below header */
}

/* Search box inside hero - THIS is centered */
.search-box-hero {
    position: relative;
    max-width: 680px;
    margin: 0 auto;
}

.hero-search-input,
.search-box-hero input {
    width: 100%;
    padding: 1rem 1.25rem;
    padding-left: 3rem;
    font-size: 1.125rem;
    border: 2px solid transparent;
    border-radius: var(--radius-xl, 1rem);
    background: var(--white, #fff);
    box-shadow: var(--shadow-lg);
}

.hero-search-input:focus,
.search-box-hero input:focus {
    outline: none;
    border-color: var(--primary, #7CBA3D);
}

.hero-search-results,
.search-box-hero .search-results {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: var(--white, #fff);
    border-radius: var(--radius-lg, 0.75rem);
    box-shadow: var(--shadow-xl);
    max-height: 450px;
    overflow-y: auto;
    z-index: var(--z-search-dropdown, 800);
}

/* === 2.3 Header Search (Compact) === */
.header-search {
    position: relative;
    width: 220px;
    margin-left: auto;
    margin-right: 1rem;
}

.header-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    padding-left: 2.25rem;
    font-size: 0.875rem;
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: var(--radius-full, 9999px);
    background: var(--gray-50, #f9fafb);
    transition: all var(--transition-fast);
}

.header-search-input:focus {
    outline: none;
    background: var(--white);
    border-color: var(--primary, #7CBA3D);
    width: 280px;
}

.header-search-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    min-width: 320px;
    background: var(--white, #fff);
    border-radius: var(--radius-lg, 0.75rem);
    box-shadow: var(--shadow-xl);
    max-height: 350px;
    overflow-y: auto;
    z-index: var(--z-search-dropdown, 800);
    display: none;
}

.header-search-dropdown.active {
    display: block;
}

@media (max-width: 992px) {
    .header-search {
        display: none;
    }
}

/* === 2.4 Lab Search === */
.lab-search {
    position: relative;
    max-width: 500px;
    margin: 0 auto 2rem;
}

.lab-search-input {
    width: 100%;
    padding: 0.875rem 1rem;
    padding-left: 2.75rem;
    font-size: 1rem;
    border: 2px solid var(--gray-200, #e5e7eb);
    border-radius: var(--radius-lg, 0.75rem);
    background: var(--white, #fff);
}

.lab-search-results {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    background: var(--white, #fff);
    border-radius: var(--radius-lg, 0.75rem);
    box-shadow: var(--shadow-xl);
    max-height: 500px;
    overflow-y: auto;
    z-index: var(--z-search-dropdown, 800);
}

/* ============================================
   3. BREADCRUMB NAVIGATION
   ============================================ */

.breadcrumb-nav {
    padding: 0.75rem 0;
    background: var(--gray-50, #f9fafb);
    border-bottom: 1px solid var(--gray-200, #e5e7eb);
}

.breadcrumb-nav .container {
    max-width: var(--container-max, 1280px);
    margin: 0 auto;
    padding: 0 var(--container-padding, 1.5rem);
}

.breadcrumb-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-500, #6b7280);
}

.breadcrumb-list a {
    color: var(--gray-600, #4b5563);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.breadcrumb-list a:hover {
    color: var(--primary, #7CBA3D);
}

.breadcrumb-list .separator {
    color: var(--gray-300, #d1d5db);
}

.breadcrumb-list .current {
    color: var(--gray-700, #374151);
    font-weight: 500;
}

/* ============================================
   4. PAGE CONTENT SPACING
   ============================================ */

/* Main content area */
main,
.main-content,
.page-content {
    min-height: calc(100vh - var(--header-height, 80px) - 200px);
}

/* Hero sections that need to account for header */
.hero,
.page-hero,
.section-hero {
    position: relative;
}

/* First section after header in pages without hero */
.content-start,
section:first-of-type {
    /* No extra padding needed if body has padding-top */
}

/* Pages with colored hero sections */
.genetic-hero,
.work-hero,
.prep-hero,
.slim-hero,
.specialty-hero {
    padding-top: 2rem;
    margin-top: 0;
}

/* ============================================
   5. MOBILE RESPONSIVENESS
   ============================================ */

@media (max-width: 768px) {
    /* Hero search mobile */
    .hero-search,
    .search-box-hero {
        max-width: 100%;
        padding: 0 1rem;
    }
    
    .hero-search-input,
    .search-box-hero input {
        font-size: 1rem;
        padding: 0.875rem 1rem;
        padding-left: 2.5rem;
    }
    
    /* Results dropdown mobile */
    .hero-search-results,
    .lab-search-results,
    .search-results-dropdown {
        max-height: 60vh;
    }
    
    /* Breadcrumb mobile */
    .breadcrumb-nav {
        padding: 0.5rem 0;
    }
    
    .breadcrumb-list {
        font-size: 0.8125rem;
    }
}

/* ============================================
   6. SEARCH RESULTS STYLING
   ============================================ */

/* Scrollbar styling */
.hero-search-results::-webkit-scrollbar,
.header-search-dropdown::-webkit-scrollbar,
.lab-search-results::-webkit-scrollbar,
.search-results-dropdown::-webkit-scrollbar {
    width: 6px;
}

.hero-search-results::-webkit-scrollbar-track,
.header-search-dropdown::-webkit-scrollbar-track,
.lab-search-results::-webkit-scrollbar-track,
.search-results-dropdown::-webkit-scrollbar-track {
    background: var(--gray-100, #f3f4f6);
    border-radius: 3px;
}

.hero-search-results::-webkit-scrollbar-thumb,
.header-search-dropdown::-webkit-scrollbar-thumb,
.lab-search-results::-webkit-scrollbar-thumb,
.search-results-dropdown::-webkit-scrollbar-thumb {
    background: var(--gray-300, #d1d5db);
    border-radius: 3px;
}

.hero-search-results::-webkit-scrollbar-thumb:hover,
.header-search-dropdown::-webkit-scrollbar-thumb:hover,
.lab-search-results::-webkit-scrollbar-thumb:hover,
.search-results-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400, #9ca3af);
}

/* ============================================
   7. UTILITY CLASSES
   ============================================ */

/* Hide element but keep accessible */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* No scroll when search open */
body.search-open {
    overflow: hidden;
}

/* Search loading state */
.search-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 1rem;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--gray-300);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   7. TRIAGE RESULTS - Clinical Hierarchy
   ============================================ */

/* Triage container */
.search-triage-results {
    padding: 0.5rem;
}

/* === PRIMARY RESULT (Level 1) === */
.triage-primary {
    margin-bottom: 1rem;
}

.triage-primary-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-dark, #008238);
    background: var(--primary-bg, #f0f7e6);
    border-radius: var(--radius-full, 9999px);
}

.triage-primary-badge i {
    color: var(--primary, #7CBA3D);
}

.triage-primary-card {
    display: block;
    padding: 1.25rem;
    background: linear-gradient(135deg, var(--white) 0%, var(--primary-bg, #f0f7e6) 100%);
    border: 2px solid var(--primary, #7CBA3D);
    border-radius: var(--radius-lg, 0.75rem);
    text-decoration: none;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
}

.triage-primary-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-dark, #008238);
}

.triage-primary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.triage-type-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    border-radius: var(--radius-sm, 0.375rem);
    background: var(--gray-100, #f3f4f6);
    color: var(--gray-600, #4b5563);
}

.triage-type-exam { background: #dbeafe; color: #1e40af; }
.triage-type-procedure { background: #dcfce7; color: #166534; }
.triage-type-specialty { background: #fef3c7; color: #92400e; }
.triage-type-pack { background: #fce7f3; color: #9d174d; }
.triage-type-pathway { background: #e0e7ff; color: #3730a3; }

.triage-primary-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-dark, #008238);
}

.triage-primary-name {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900, #111827);
    line-height: 1.3;
}

.triage-primary-desc {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: var(--gray-600, #4b5563);
    line-height: 1.5;
}

.triage-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: var(--gray-500, #6b7280);
}

.triage-primary-cta {
    margin-top: 1rem;
    text-align: right;
}

.triage-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--white, #fff);
    background: var(--primary, #7CBA3D);
    border-radius: var(--radius-md, 0.5rem);
    transition: background var(--transition-fast);
}

.triage-primary-card:hover .triage-cta-btn {
    background: var(--primary-dark, #008238);
}

/* === RELATED SECTION (Level 2) === */
.triage-related {
    margin-bottom: 1rem;
}

.triage-related-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-700, #374151);
    background: var(--gray-50, #f9fafb);
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: var(--radius-md, 0.5rem);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.triage-related-toggle:hover {
    background: var(--gray-100, #f3f4f6);
}

.triage-related-toggle span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.triage-toggle-icon {
    transition: transform var(--transition-base);
}

.triage-related-content {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--gray-50, #f9fafb);
    border-radius: var(--radius-md, 0.5rem);
}

.triage-related-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.75rem;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    color: var(--gray-700, #374151);
    background: var(--white);
    border-radius: var(--radius-sm, 0.375rem);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.triage-related-item:last-child {
    margin-bottom: 0;
}

.triage-related-item:hover {
    background: var(--primary-bg, #f0f7e6);
    color: var(--primary-dark, #008238);
}

.triage-related-name {
    flex: 1;
}

.triage-related-price {
    font-weight: 600;
    color: var(--gray-600, #4b5563);
    margin-left: 0.5rem;
}

/* === PACK SUGGESTION (Level 3) === */
.triage-suggestion {
    padding: 0.75rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-radius: var(--radius-md, 0.5rem);
}

.triage-suggestion-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #92400e;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.triage-suggestion-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--white);
    border-radius: var(--radius-sm, 0.375rem);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.triage-suggestion-card:hover {
    box-shadow: var(--shadow-md);
}

.triage-suggestion-info {
    flex: 1;
}

.triage-suggestion-name {
    display: block;
    font-weight: 600;
    color: var(--gray-900, #111827);
    margin-bottom: 0.25rem;
}

.triage-suggestion-desc {
    display: block;
    font-size: 0.8rem;
    color: var(--gray-500, #6b7280);
}

.triage-suggestion-price {
    font-size: 1.125rem;
    font-weight: 700;
    color: #92400e;
    margin-left: 1rem;
}

/* === TRIAGE MOBILE === */
@media (max-width: 640px) {
    .triage-primary-card {
        padding: 1rem;
    }
    
    .triage-primary-name {
        font-size: 1.1rem;
    }
    
    .triage-primary-price {
        font-size: 1rem;
    }
    
    .triage-cta-btn {
        width: 100%;
        justify-content: center;
    }
    
    .triage-suggestion-card {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .triage-suggestion-price {
        margin-left: 0;
        margin-top: 0.5rem;
    }
}
