/* Apple-Style Header CSS */

/* Base Header Styles */
.apple-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    overflow: visible;
}

.apple-nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.apple-nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    width: 100%;
}

/* Brand Styles */
.apple-nav-brand {
    flex-shrink: 0;
}

.apple-brand-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
}

.apple-brand-logo {
    height: 32px;
    width: auto;
}

.apple-brand-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Desktop Navigation Menu */
.apple-nav-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
    height: 100%;
}

.apple-nav-link {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    height: 100%;
}

.apple-nav-link:hover {
    color: var(--text-primary);
}

/* Dropdown Styles */
.apple-nav-dropdown {
    position: relative;
}

.apple-dropdown-menu {
    position: absolute;
    top: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.06);
    min-width: 280px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-8px);
    transition: all 0.2s ease;
    z-index: 100;
    padding: 0.5rem 0;
}

.apple-nav-dropdown:hover .apple-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.apple-dropdown-section {
    padding: 0.25rem 0;
}

.apple-dropdown-section + .apple-dropdown-section {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    margin-top: 0.25rem;
    padding-top: 0.5rem;
}

.apple-dropdown-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 1rem;
    margin-bottom: 0.25rem;
}

.apple-dropdown-link {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.apple-dropdown-link:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.apple-view-all {
    font-weight: 500;
    color: var(--primary-color);
    margin-top: 0.25rem;
}

/* Actions */
.apple-nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.apple-cta-button {
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.apple-cta-button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* Mobile Menu Toggle */
.apple-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;  /* Increased for better touch target */
    height: 44px;  /* Increased for better touch target */
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;  /* Added padding for better touch area */
    gap: 3px;
    -webkit-tap-highlight-color: transparent;  /* Remove tap highlight on iOS */
    touch-action: manipulation;  /* Improve touch responsiveness */
    z-index: 1001;  /* Ensure it's above other elements */
    position: relative;
}

.apple-menu-bar {
    width: 18px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 1px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.apple-menu-toggle.active .apple-menu-bar:nth-child(1) {
    transform: translateY(5px) rotate(45deg);
}

.apple-menu-toggle.active .apple-menu-bar:nth-child(2) {
    opacity: 0;
    transform: translateX(20px);
}

.apple-menu-toggle.active .apple-menu-bar:nth-child(3) {
    transform: translateY(-5px) rotate(-45deg);
}

/* Mobile Overlay */
.apple-mobile-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    z-index: 99999 !important;
    display: none;
    visibility: hidden;
    opacity: 0;
    flex-direction: column;
    padding: 1rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: none !important;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

.apple-mobile-overlay.show {
    pointer-events: auto;
    animation: fadeIn 0.3s ease-out;
}

.apple-mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0 2rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    margin-bottom: 2rem;
}

.apple-mobile-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.apple-mobile-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    margin: -0.5rem;
    color: var(--text-secondary);
    border-radius: 50%;
    transition: all 0.2s ease;
}

.apple-mobile-close:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-primary);
}

/* Mobile Content */
.apple-mobile-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 300px;
    margin: 0 auto;
    width: 100%;
}

.apple-mobile-link {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    padding: 1rem 0;
    width: 100%;
    text-align: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
}

.apple-mobile-link:hover {
    color: var(--primary-color);
    background: rgba(134, 97, 213, 0.04);
}

.apple-mobile-services {
    width: 100%;
    margin: 1rem 0;
    padding: 1rem 0;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.apple-mobile-group {
    margin-bottom: 2rem;
}

.apple-mobile-group:last-child {
    margin-bottom: 0;
}

.apple-mobile-group-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.apple-mobile-service {
    display: block;
    font-size: 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.75rem 0;
    text-align: center;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.apple-mobile-service:hover {
    color: var(--primary-color);
    background: rgba(134, 97, 213, 0.04);
    transform: translateX(4px);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(1.02);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive Styles */
@media (max-width: 1023px) {
    .apple-nav-menu {
        gap: 1.5rem;
    }
}

@media (max-width: 767px) {
    .apple-nav-menu {
        display: none;
    }
    
    .apple-cta-button {
        display: none;
    }
    
    .apple-menu-toggle {
        display: flex;
    }
    
    .apple-brand-text {
        font-size: 1rem;
    }
    
    .apple-brand-logo {
        height: 28px;
    }
    
    .apple-nav-content {
        height: 56px;
    }
}

/* Ensure parent containers don't restrict mobile overlay */
.main-layout {
    overflow: visible !important;
    position: relative !important;
}

/* Fix main content spacing - remove old header padding */
.main-content {
    padding-top: 0 !important;
}

/* Mobile overlay must break out of any container restrictions */
.apple-mobile-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
}

/* Hide mobile overlay on desktop - but allow .show to override on mobile */
@media (min-width: 768px) {
    .apple-mobile-overlay {
        display: none !important;
    }

    /* Even with .show class, keep hidden on desktop */
    .apple-mobile-overlay.show {
        display: none !important;
    }
}

/* Ensure mobile overlay displays on mobile when .show is added */
@media (max-width: 767px) {
    .apple-mobile-overlay.show {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}