/**
 * Safaroto Header Styles
 *
 * Sticky top header with logo and navigation
 * - Desktop: Full navigation menu
 * - Mobile: Logo only
 */

/* Header Container */
.safaroto-header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9997; /* Below nav-panel (9999) and nav-panel-backdrop (9998) */
    background-color: #FFE02B;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid #e0e0e0;
    margin: 0 !important; /* Reset any margins added by Avada or WordPress */
}

/* Remove spacing from Avada containers around the header */
.fusion-builder-row .safaroto-header,
.fusion-column-wrapper .safaroto-header {
    margin: 0 !important;
}

/* Remove any spacing from parent elements */
.safaroto-header:first-child {
    margin-top: 0 !important;
}

.safaroto-header:last-child {
    margin-bottom: 0 !important;
}

.safaroto-header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    width: 100%;
    padding: 8px 20px;
    min-height: 60px;
}

/* Logo - centered with absolute positioning */
.safaroto-header-logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    flex-shrink: 0;
}

.safaroto-logo-img {
    height: 40px;
    width: auto;
    display: block;
    transition: opacity 0.2s ease;
}

.safaroto-header-logo a:hover .safaroto-logo-img,
.safaroto-header-logo a:focus .safaroto-logo-img {
    opacity: 0.8;
}

/* Desktop Navigation */
.safaroto-header-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.safaroto-header-nav-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    text-decoration: none;
    color: #222222;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
    position: relative;
}

.safaroto-header-nav-item i {
    font-size: 18px;
}

/* Underline effect on hover */
.safaroto-header-nav-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 16px;
    right: 16px;
    height: 2px;
    background-color: #26b8f3;
    transform: scaleX(0);
    transition: transform 0.2s ease;
}

.safaroto-header-nav-item:hover::after,
.safaroto-header-nav-item:focus::after {
    transform: scaleX(1);
}

.safaroto-header-nav-item:hover,
.safaroto-header-nav-item:focus {
    color: #26b8f3;
    outline: none;
}

.safaroto-header-nav-item.active {
    color: #26b8f3;
}

.safaroto-header-nav-item.active::after {
    transform: scaleX(1);
}

/* CTA Button (Add Trip) - Hidden on desktop */
.safaroto-header-nav-cta {
    display: none;
}

/* Profile Dropdown Container */
.safaroto-header-profile-dropdown {
    position: relative;
}

/* Profile Item with Avatar - Link element */
.safaroto-header-nav-profile {
    padding: 4px;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
}

.safaroto-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e0e0e0;
    transition: border-color 0.2s ease;
}

.safaroto-header-nav-profile:hover .safaroto-header-avatar,
.safaroto-header-nav-profile:focus .safaroto-header-avatar {
    border-color: #26b8f3;
}

/* Dropdown Menu */
.safaroto-header-dropdown-menu {
    position: fixed;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 999999;
    pointer-events: none;
}

/* Add a larger invisible hit area to prevent dropdown from closing */
.safaroto-header-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -12px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    z-index: -1;
}

.safaroto-header-profile-dropdown:hover .safaroto-header-dropdown-menu,
.safaroto-header-nav-profile:focus + .safaroto-header-dropdown-menu,
.safaroto-header-dropdown-menu:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Dropdown Items */
.safaroto-header-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: #222222;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    position: relative;
}

.safaroto-header-dropdown-item:last-child {
    border-bottom: none;
}

.safaroto-header-dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.safaroto-header-dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
}

/* Ensure entire item area is clickable including padding */
.safaroto-header-dropdown-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

.safaroto-header-dropdown-item:hover,
.safaroto-header-dropdown-item:focus {
    background-color: #f7f7f7;
    color: #26b8f3;
    outline: none;
}

.safaroto-header-dropdown-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
    position: relative;
    z-index: 2;
}

.safaroto-header-dropdown-item span {
    position: relative;
    z-index: 2;
}

/* Accessibility */
.safaroto-header-nav-item:focus-visible {
    outline: 2px solid #26b8f3;
    outline-offset: 2px;
}

/* ========================================
   HAMBURGER MENU TOGGLE
   ======================================== */

.nav-panel-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    color: #26b8f3;
    font-size: 20px;
    transition: all 0.2s ease;
    border-radius: 4px;
    padding: 0;
}

.nav-panel-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #26b8f3;
}

.nav-panel-toggle:active {
    transform: scale(0.95);
}

.nav-panel-toggle:focus-visible {
    outline: 2px solid #26b8f3;
    outline-offset: 2px;
}

.nav-panel-toggle i {
    font-size: 22px;
}

/* Mobile Styles - Logo Only */
@media screen and (max-width: 768px) {
    .safaroto-header-container {
        padding: 8px 16px;
        min-height: 56px;
        justify-content: space-between;
        position: relative;
    }

    .safaroto-header-logo {
        margin: 0;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }

    .safaroto-logo-img {
        height: 36px;
    }

    /* Hide navigation on mobile */
    .safaroto-header-nav {
        display: none;
    }

    /* Hide profile avatar on mobile (shown in bottom nav) */
    .safaroto-header-nav-profile {
        display: none;
    }
}

/* Tablet Optimization */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .safaroto-header-container {
        padding: 8px 16px;
    }

    .safaroto-header-nav {
        gap: 4px;
    }

    .safaroto-header-nav-item {
        padding: 8px 12px;
        font-size: 13px;
    }

    .safaroto-header-nav-item span {
        display: none;
    }

    .safaroto-header-nav-item i {
        font-size: 20px;
        margin: 0;
    }

    .safaroto-header-nav-profile {
        padding: 4px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .safaroto-header {
        background-color: #FFE02B; /* Keep yellow branding even in dark mode for consistent mobile browser chrome */
        border-bottom-color: #333333;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    }

    .safaroto-header-nav-item {
        color: #ffffff;
    }

    .safaroto-header-nav-item:hover,
    .safaroto-header-nav-item:focus {
        background-color: #2a2a2a;
    }

    .safaroto-header-nav-item.active {
        background-color: #1a3d4f;
    }

    .safaroto-header-avatar {
        border-color: #333333;
    }
}

/* Print Styles - Hide on print */
@media print {
    .safaroto-header {
        display: none !important;
    }
}
