/* =====================================================
   CUSTOM HEADER CSS V2 - TWO-TIER PROFESSIONAL DESIGN
   FOR SEQUOIA RIDGE CPAS

   STRUCTURE:
   - Top Bar: Contact Info + Social Icons
   - Main Header: Logo + Navigation + Portal Button
   ===================================================== */

/* =====================================================
   1. CSS VARIABLES
   ===================================================== */

:root {
    /* Colors */
    --primary-blue: #005069;
    --secondary-blue: #00a2d5;
    --primary-green: #466b3f;
    --light-green: #8bc585;
    --gold: #f4b942;
    --gold-hover: #e0a82e;
    --white: #ffffff;
    --off-white: #f8f9fa;
    --light-gray: #e0e0e0;
    --medium-gray: #666666;
    --dark-gray: #333333;

    /* Header Settings */
    --top-bar-height: 45px;
    --main-header-height: 90px;
    --total-header-height: 135px;

    /* Typography */
    --font-primary: 'Outfit', sans-serif;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-smooth: 0.3s ease;

    /* Z-Index */
    --z-header: 1000;
    --z-dropdown: 1010;
    --z-mobile-menu: 1020;
    --z-overlay: 1015;
}

/* =====================================================
   2. BASE HEADER STYLES
   ===================================================== */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: var(--z-header);
    font-family: var(--font-primary);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Force background color override */
#custom-header.site-header {
    background: transparent;
}

/* Add padding to body to prevent content from hiding under fixed header */
body {
    padding-top: var(--total-header-height);
}

/* =====================================================
   3. TOP BAR STYLES
   ===================================================== */

.header-top-bar {
    background-color: var(--global-color-10);
    background: var(--global-color-10);
    height: var(--top-bar-height);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.top-bar-container {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Contact Information Styles */
.header-contact-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-smooth);
}

.contact-item:hover {
    color: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
}

.contact-item svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

.contact-divider {
    color: rgba(255, 255, 255, 0.3);
    font-weight: 300;
    padding: 0 8px;
}

/* Social Icons in Contact Info */
.header-contact-info .social-icon-link {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: all var(--transition-smooth);
    padding: 0 4px;
}

.header-contact-info .social-icon-link:hover {
    color: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
}

.header-contact-info .social-icon-link svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Appointment Button in Top Bar */
.header-appointment {
    display: flex;
    align-items: center;
}

.btn-appointment {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px;
    background-color: rgba(255, 255, 255, 0.15);
    color: var(--white) !important;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    transition: all var(--transition-smooth);
    white-space: nowrap;
    backdrop-filter: blur(10px);
}

.btn-appointment svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

/* =====================================================
   4. MAIN HEADER STYLES
   ===================================================== */

.header-main {
    background-color: var(--white);
    height: var(--main-header-height);
    max-width: 1200px;
    margin: 0 auto;
}

.main-header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    position: relative;
}

/* =====================================================
   5. LOGO STYLES
   ===================================================== */

.header-logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity var(--transition-smooth);
}

.logo-link:hover {
    opacity: 0.9;
}

.logo-image {
    height: 70px;
    width: auto;
    max-width: 350px;
    object-fit: contain;
}

/* =====================================================
   6. DESKTOP NAVIGATION
   ===================================================== */

.desktop-nav {
    flex-grow: 1;
    display: flex;
    justify-content: center;
}

.main-menu {
    display: flex;
    align-items: center;
    gap: 35px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.menu-item {
    position: relative;
}

.menu-item > a {
    display: flex;
    align-items: center;
    color: var(--dark-gray) !important;
    text-decoration: none;
    font-size: 18px;
    font-weight: 600;
    padding: 10px 0;
    transition: color var(--transition-smooth);
    white-space: nowrap;
    position: relative;
}

/* Underline hover effect */
.menu-item > a::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--global-color-10);
    transition: width var(--transition-smooth);
}

.menu-item > a:hover {
    color: var(--global-color-10) !important;
}

.menu-item > a:hover::after {
    width: 100%;
}

/* Active/Current Page Styling */
.menu-item.active > a,
.menu-item.active-parent > a {
    color: var(--global-color-10) !important;
    font-weight: 700;
}

.menu-item.active > a::after,
.menu-item.active-parent > a::after {
    width: 100%;
    background-color: var(--primary-green);
}

.dropdown-arrow {
    margin-left: 5px;
    font-size: 11px;
    color: inherit !important;
    transition: transform var(--transition-smooth);
}

.menu-item.has-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

/* =====================================================
   7. DROPDOWN MENUS
   ===================================================== */

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--white);
    min-width: 240px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    list-style: none;
    padding: 12px 0;
    margin: 15px 0 0 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-smooth);
    z-index: var(--z-dropdown);
    border: 1px solid var(--light-gray);
}

.menu-item:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    list-style: none;
}

.dropdown-menu li a {
    display: block;
    padding: 12px 24px;
    color: var(--dark-gray);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all var(--transition-smooth);
}

.dropdown-menu li a:hover {
    background-color: var(--off-white);
    color: var(--global-color-10);
    padding-left: 28px;
}

/* Active/Current Page Styling - Dropdown */
.dropdown-menu li.active > a {
    background-color: var(--off-white);
    color: var(--global-color-10);
    font-weight: 700;
    border-left: 3px solid var(--primary-green);
}

/* Dropdown arrow */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 20px;
    width: 12px;
    height: 12px;
    background-color: var(--white);
    border-left: 1px solid var(--light-gray);
    border-top: 1px solid var(--light-gray);
    transform: rotate(45deg);
}

/* =====================================================
   8. CLIENT PORTAL BUTTON
   ===================================================== */

.header-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-family: var(--font-primary);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition-smooth);
    white-space: nowrap;
}

.btn-portal {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-hover) 100%);
    color: var(--primary-blue);
    box-shadow: 0 4px 20px rgba(244, 185, 66, 0.35);
}

.btn-portal:hover {
    background: linear-gradient(135deg, var(--gold-hover) 0%, var(--gold) 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(244, 185, 66, 0.5);
}

.btn svg {
    width: 16px;
    height: 16px;
}

/* =====================================================
   9. MOBILE MENU TOGGLE
   ===================================================== */

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 32px;
    height: 24px;
    background: transparent !important;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1030;
    position: relative;
    outline: none !important;
    box-shadow: none !important;
}

.mobile-menu-toggle:focus,
.mobile-menu-toggle:active,
.mobile-menu-toggle:hover {
    background: transparent !important;
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

.hamburger-line {
    width: 100%;
    height: 3px;
    background-color: var(--dark-gray);
    border-radius: 3px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

/* Hamburger transforms to X when menu is open */
.mobile-menu-toggle[aria-expanded="true"] .hamburger-line {
    background-color: var(--dark-gray);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
    transform: translateY(10.5px) rotate(45deg);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
    transform: translateY(-10.5px) rotate(-45deg);
}

/* =====================================================
   10. MOBILE NAVIGATION
   ===================================================== */

.mobile-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 100vw;
    height: 100vh;
    background-color: var(--white);
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    transition: right 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: var(--z-mobile-menu);
}

.mobile-nav[aria-hidden="false"] {
    right: 0;
}

.mobile-nav-inner {
    padding: 20px;
    padding-top: 20px;
}

/* Mobile Contact Section */
.mobile-contact-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 15px 0;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--off-white);
}

.mobile-contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background-color: var(--off-white);
    border-radius: 8px;
    color: var(--dark-gray);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all var(--transition-smooth);
    max-width: calc(100% - 60px);
}

.mobile-contact-item:hover {
    background-color: var(--global-color-10);
    color: var(--white);
    transform: translateX(5px);
}

.mobile-contact-item svg {
    flex-shrink: 0;
}

/* Mobile Menu Items */
.mobile-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-menu-item {
    border-bottom: 1px solid var(--light-gray);
}

.mobile-menu-item:last-child {
    border-bottom: none;
}

.mobile-menu-item > a {
    display: block;
    padding: 15px 5px;
    color: var(--dark-gray);
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    transition: color var(--transition-smooth);
}

.mobile-menu-item > a:hover {
    color: var(--global-color-10);
}

/* Active/Current Page Styling - Mobile */
.mobile-menu-item.active > a,
.mobile-menu-item.active-parent > a {
    color: var(--global-color-10);
    font-weight: 700;
    border-left: 4px solid var(--primary-green);
    padding-left: 9px;
}

/* Mobile Submenu Toggle */
.submenu-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 5px;
    background: transparent;
    border: none;
    color: var(--dark-gray);
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-primary);
    cursor: pointer;
    text-align: left;
}

.toggle-icon {
    font-size: 20px;
    transition: transform var(--transition-smooth);
}

.submenu-toggle[aria-expanded="true"] .toggle-icon {
    transform: rotate(45deg);
}

/* Mobile Submenu */
.mobile-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.submenu-toggle[aria-expanded="true"] + .mobile-submenu {
    max-height: 600px;
}

.mobile-submenu li a {
    display: block;
    padding: 10px 20px 10px 30px;
    color: var(--medium-gray);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all var(--transition-smooth);
}

.mobile-submenu li a:hover {
    color: var(--global-color-10);
    padding-left: 35px;
}

/* Active/Current Page Styling - Mobile Submenu */
.mobile-submenu li.active > a {
    color: var(--global-color-10);
    font-weight: 700;
    background-color: var(--off-white);
    border-radius: 6px;
}

/* Mobile Social Icons */
.mobile-social {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid var(--light-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.mobile-social-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--medium-gray);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}

.mobile-social-icons {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-social .social-icon-link {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-green);
    transition: all var(--transition-smooth);
    padding: 0;
}

.mobile-social .social-icon-link:hover {
    color: var(--light-green);
    transform: translateY(-2px);
}

.mobile-social .social-icon-link svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* Mobile Actions */
.mobile-actions {
    margin-top: 15px;
}

.mobile-btn {
    width: 100%;
    justify-content: center;
    padding: 14px 20px;
}

/* Mobile Overlay */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-smooth);
    z-index: var(--z-overlay);
}

.mobile-overlay[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

/* =====================================================
   11. RESPONSIVE BREAKPOINTS
   ===================================================== */

/* Tablet & Mobile (1024px and below) */
@media (max-width: 1024px) {
    .desktop-nav,
    .header-actions {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
        position: absolute;
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
    }

    .mobile-menu-toggle[aria-expanded="true"] {
        position: fixed;
        right: 20px;
        top: calc(var(--top-bar-height) + (var(--main-header-height) / 2));
        transform: translateY(-50%);
    }

    .main-menu {
        gap: 30px;
    }
}

/* Tablet (768px and below) */
@media (max-width: 768px) {
    :root {
        --top-bar-height: 40px;
        --main-header-height: 80px;
        --total-header-height: 120px;
    }

    .top-bar-container {
        padding: 0 0 0 15px;
    }

    .header-contact-info {
        gap: 6px;
    }

    .contact-item {
        font-size: 13px;
    }

    .contact-divider {
        padding: 0 6px;
    }

    .contact-item span {
        display: none;
    }

    .header-contact-info .social-icon-link svg {
        width: 16px;
        height: 16px;
    }

    .btn-appointment {
        padding: 6px 12px;
        font-size: 13px;
        font-weight: 600;
    }

    .btn-appointment svg {
        width: 14px;
        height: 14px;
    }

    .logo-image {
        height: 60px;
        max-width: 300px;
    }

    /* Adjust mobile menu toggle positioning for balanced spacing */
    .mobile-menu-toggle {
        position: absolute;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
    }

    .mobile-menu-toggle[aria-expanded="true"] {
        position: fixed;
        right: 15px;
        top: calc(var(--top-bar-height) + (var(--main-header-height) / 2));
        transform: translateY(-50%);
    }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
    :root {
        --top-bar-height: 38px;
        --main-header-height: 70px;
        --total-header-height: 108px;
    }

    .header-contact-info {
        gap: 4px;
    }

    .contact-item svg {
        width: 16px;
        height: 16px;
    }

    .contact-divider {
        padding: 0 4px;
    }

    .header-contact-info .social-icon-link svg {
        width: 15px;
        height: 15px;
    }

    .btn-appointment {
        padding: 3px 10px;
        font-size: 13px;
        font-weight: 500;
        gap: 6px;
    }

    .btn-appointment svg {
        width: 13px;
        height: 13px;
    }

    .logo-image {
        height: 55px;
        max-width: 280px;
    }

    .mobile-nav-inner {
        padding: 15px;
        padding-top: 15px;
    }

    /* Adjust mobile menu toggle positioning for balanced spacing */
    .mobile-menu-toggle {
        position: absolute;
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
    }

    .mobile-menu-toggle[aria-expanded="true"] {
        position: fixed;
        right: 20px;
        top: calc(var(--top-bar-height) + (var(--main-header-height) / 2));
        transform: translateY(-50%);
    }
}

/* Desktop Large (1400px and up) */
@media (min-width: 1400px) {
    .main-menu {
        gap: 50px;
    }
}

/* =====================================================
   12. ANIMATIONS
   ===================================================== */

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.site-header {
    animation: fadeInDown 0.6s ease-out;
}

/* =====================================================
   14. ACCESSIBILITY
   ===================================================== */

a:focus,
button:focus {
    outline: 2px solid var(--global-color-10);
    outline-offset: 2px;
}

a:focus:not(:focus-visible),
button:focus:not(:focus-visible) {
    outline: none;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* =====================================================
   15. PRINT STYLES
   ===================================================== */

@media print {
    .site-header {
        position: static;
        box-shadow: none;
    }

    .header-top-bar,
    .header-actions,
    .mobile-menu-toggle {
        display: none;
    }
}
