/* Modern Navigation Styles */

/* Header container - transparent, no blur effects */
.header {
    position: sticky;
    width: 100%;
    top: 0;
    z-index: 1000;
    background: transparent !important; /* ensure wrapper stays transparent on desktop */
    border: none !important;
    padding: 1rem 2rem;
    min-height: 72px; /* Reserve space to prevent layout shift */
    transition: padding 0.3s ease;
    pointer-events: none;
}

.header * {
    pointer-events: auto;
}

/* Navigation - full width with blur effect */
.nav {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 0.75rem 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

/* Dark mode nav */
[data-theme="dark"] .nav,
.dark .nav {
    background: transparent !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Light mode nav */
[data-theme="light"] .nav {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* Scrolled state */
.header.scrolled .nav {
    background: rgba(255, 255, 255, 0.95) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .header.scrolled .nav {
    background: rgba(15, 23, 42, 0.95) !important;
}

/* Navigation list */
.nav-list {
    display: flex;
    align-items: center;
    gap: 1rem;
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    justify-content: center;
}

.nav-list > li {
    position: relative;
}

/* Navigation links styling */
.nav-link {
    color: inherit;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    transition: all 0.3s ease;
    position: relative;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* Beautiful hover effect for nav links */
.nav-link::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--cosmic-violet), var(--stellar-magenta));
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::before {
    width: 80%;
}

.nav-link:hover {
    color: var(--cosmic-violet) !important;
    transform: translateY(-2px);
    text-decoration: none !important;
}

/* Dropdown hover effects */
.dropdown {
    position: relative;
}

.dropdown:hover .dropdown-content {
    opacity: 1;
    visibility: visible;
}

.dropdown:hover .mega-menu {
    opacity: 1;
    visibility: visible;
}

.dropdown-content {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    background: white !important;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    min-width: 220px;
    padding: 0.5rem;
    z-index: 1001;
}

[data-theme="dark"] .dropdown-content {
    background: #1e293b !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dropdown-content:not(.mega-menu) a {
    font-family: 'Source Sans 3', sans-serif;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: #475569 !important;
    text-decoration: none !important;
    transition: all 0.2s ease;
    white-space: nowrap;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

[data-theme="dark"] .dropdown-content:not(.mega-menu) a {
    color: #cbd5e1 !important;
}

.dropdown-content:not(.mega-menu) a:hover {
    background: rgba(108, 99, 255, 0.08);
    color: #6C63FF !important;
    /* Removed transform and box-shadow to prevent layout shift */
    text-decoration: none !important;
}

[data-theme="dark"] .dropdown-content {
    background: #1e293b !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Mega menu styling */
.mega-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%);
    margin-top: 0;
    background: white !important;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    min-width: 600px;
    max-width: 800px;
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 2rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

[data-theme="dark"] .mega-menu {
    background: #1e293b !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

/* Mega menu columns */
.mega-menu-column {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.mega-menu-column:hover {
    transform: none;
}

.mega-menu-column h4 {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    color: #6C63FF;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(108, 99, 255, 0.15);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mega-menu-column h4:empty {
    border-bottom: none;
    margin-bottom: 1.25rem;
}

/* Mega menu links */
.mega-menu a {
    font-family: 'Source Sans 3', sans-serif;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none !important;
    font-size: 0.9rem;
    color: #475569 !important;
    font-weight: 500;
    position: relative;
}

[data-theme="dark"] .mega-menu a {
    color: #cbd5e1 !important;
}

.mega-menu a:hover {
    background: rgba(108, 99, 255, 0.08);
    color: #6C63FF !important;
    /* Removed transform and box-shadow to prevent layout shift */
    text-decoration: none !important;
}

.mega-menu a strong {
    font-weight: 600;
    color: #6C63FF;
}

[data-theme="dark"] .mega-menu a strong {
    color: #9333EA;
}

/* Special columns for zodiac signs */
.zodiac-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.zodiac-grid a {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    border-radius: 8px;
    background: rgba(108, 99, 255, 0.03);
    border: 1px solid rgba(108, 99, 255, 0.1);
}

.zodiac-grid a:hover {
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.1), rgba(147, 51, 234, 0.1));
    border-color: var(--cosmic-violet);
    /* Removed transform to prevent layout shift */
}

/* Button styling */
.btn, .btn-nav, .btn-primary, .btn-secondary, button[type="submit"] {
    background: linear-gradient(135deg, var(--cosmic-violet), var(--stellar-magenta));
    color: white !important;
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none !important;
    display: inline-block;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(108, 99, 255, 0.3);
}

/* Button hover effect */
.btn:hover, .btn-nav:hover, .btn-primary:hover, .btn-secondary:hover, button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(108, 99, 255, 0.4);
    text-decoration: none !important;
}

/* Button ripple effect */
.btn::before, .btn-nav::before, .btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before, .btn-nav:hover::before, .btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

/* Outline button variant */
.btn-outline {
    background: transparent;
    border: 2px solid var(--cosmic-violet);
    color: var(--cosmic-violet) !important;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-outline::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(135deg, var(--cosmic-violet), var(--stellar-magenta));
    transition: width 0.3s ease;
    z-index: -1;
}

.btn-outline:hover {
    color: white !important;
    border-color: transparent;
}

.btn-outline:hover::after {
    width: 100%;
}

/* Theme toggle button */
.theme-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    padding: 0.5rem 1rem;
    color: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 1rem;
}

.theme-toggle:hover {
    background: rgba(108, 99, 255, 0.2);
    border-color: var(--cosmic-violet);
    transform: scale(1.05);
}

/* Logo styling */
.logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.logo a:hover {
    transform: scale(1.05);
    text-decoration: none;
}

/* Remove underlines from all links by default */
a {
    text-decoration: none;
    transition: color 0.3s ease;
}

/* Content area links (not navigation) */
.content a:not(.btn):not(.btn-primary):not(.btn-secondary):not(.btn-outline) {
    color: var(--cosmic-violet);
    position: relative;
    text-decoration: none;
    background: linear-gradient(to right, var(--cosmic-violet), var(--stellar-magenta));
    background-size: 0% 2px;
    background-position: left bottom;
    background-repeat: no-repeat;
    transition: background-size 0.3s ease;
    padding-bottom: 2px;
}

.content a:not(.btn):hover {
    background-size: 100% 2px;
    text-decoration: none;
}

/* Card hover effects */
.card, .zodiac-card, .calculator-card {
    transition: all 0.3s ease;
}

.card:hover, .zodiac-card:hover, .calculator-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(108, 99, 255, 0.2);
}

/* Input focus effects */
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--cosmic-violet);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

/* Mobile menu button - hidden on desktop */
.hamburger {
    display: none;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 0.5rem;
}

.hamburger span {
    background: var(--text-primary);
    height: 2px;
    transition: all 0.3s ease;
}

.hamburger:hover span {
    background: var(--cosmic-violet);
}

/* Scroll indicator */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(108, 99, 255, 0.4);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(108, 99, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(108, 99, 255, 0);
    }
}

/* Add scroll detection script styles */
.header.scrolled {
    background: transparent !important;
    padding: 0.5rem 2rem;
}

/* Main content spacing to account for fixed nav */
.main-content {
    margin-top: 0;
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Hide mobile menu on desktop */
.mobile-menu {
    display: none;
}

/* Mobile Navigation */

/* Mobile Navigation */
@media (max-width: 768px) {
    /* Show mobile menu on mobile */
    .mobile-menu {
        display: block;
    }
    .header {
        position: sticky !important;
        top: 0;
        padding: 0.25rem 0.75rem !important;
        min-height: 56px !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    .nav {
        padding: 0.5rem 0.75rem !important;
        border-radius: 0 !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 0 !important;
        max-width: 100% !important;
        margin: 0 auto !important;
    }

    .nav-list {
        display: none;
    }

    /* Hide desktop dropdowns/mega-menus on mobile to prevent off-canvas issues */
    .dropdown-content,
    .mega-menu {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }

    .hamburger {
        display: block;
        order: 3;
        background: transparent;
        border: none;
        padding: 0.5rem;
        cursor: pointer;
        transition: all 0.3s ease;
        margin-left: auto; /* Push hamburger to the right */
        z-index: 1002; /* ensure above content */
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .hamburger span {
        display: block;
        width: 20px;
        height: 2px;
        background: #6C63FF;
        margin: 4px 0;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-radius: 1px;
        transform-origin: center;
    }

    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(5.5px, 5.5px);
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5.5px, -5.5px);
    }

    .nav-actions {
        display: none !important; /* hide large actions in compact mobile header; shown in mobile menu */
    }

    .logo {
        order: 1;
        transform: scale(0.95);
    }

    /* Z-index Hierarchy Documentation
     * Header: 1000
     * Desktop dropdowns: 1001
     * Hamburger button: 1002
     * Mobile menu overlay: 9999
     * Mobile menu content: 10000
     */

    /* Mobile menu overlay */
    .mobile-menu {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        z-index: 9999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .mobile-menu.active {
        opacity: 1;
        visibility: visible;
    }

    .mobile-menu-content {
        position: absolute;
        top: 0;
        right: 0;
        width: min(320px, 85vw);
        max-width: 85vw;
        height: 100vh;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border-left: 1px solid rgba(0, 0, 0, 0.1);
        padding: 1.5rem;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        z-index: 10000;
        display: flex;
        flex-direction: column;
    }

    @media (max-width: 375px) {
        .mobile-menu-content {
            padding: 1rem;
        }
    }

    @media (max-width: 320px) {
        .mobile-nav-link {
            font-size: 0.9rem;
        }
    }

    .mobile-menu.active .mobile-menu-content {
        transform: translateX(0);
    }

    /* Prevent body scroll when mobile menu is open */
    body.mobile-menu-open {
        overflow: hidden;
    }

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

    .mobile-menu-close {
        background: none;
        border: none;
        font-size: 1.5rem;
        color: #6C63FF;
        cursor: pointer;
        padding: 0.5rem;
        border-radius: 50%;
        transition: all 0.2s ease;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-menu-close:hover {
        background: rgba(108, 99, 255, 0.1);
        transform: scale(1.1);
    }

    .mobile-menu-close:focus-visible {
        outline: 2px solid #6C63FF;
        outline-offset: 2px;
        border-radius: 8px;
    }

    .hamburger:focus-visible {
        outline: 2px solid #6C63FF;
        outline-offset: 2px;
        border-radius: 8px;
    }

    .mobile-nav-list {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .mobile-nav-item {
        margin-bottom: 0.5rem;
    }

    .mobile-nav-link {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1.25rem 1rem;
        color: #475569;
        text-decoration: none;
        border-radius: 12px;
        transition: all 0.2s ease;
        font-weight: 500;
        min-height: 44px;
    }

    .mobile-nav-link:hover {
        background: rgba(108, 99, 255, 0.08);
        color: #6C63FF;
        transform: translateX(5px);
    }

    .mobile-nav-link:focus-visible {
        outline: 2px solid #6C63FF;
        outline-offset: 2px;
    }

    .mobile-nav-link i {
        font-size: 0.9rem;
        color: #6C63FF;
    }

    .mobile-dropdown {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
        background: rgba(108, 99, 255, 0.03);
        border-radius: 8px;
        margin-top: 0.5rem;
        opacity: 0;
    }

    .mobile-dropdown.active {
        max-height: 500px;
        opacity: 1;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .mobile-dropdown a {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.75rem 1rem 0.75rem 2.5rem;
        color: #64748b;
        text-decoration: none;
        font-size: 0.9rem;
        transition: all 0.2s ease;
        min-height: 44px;
    }

    .mobile-dropdown a:hover {
        background: rgba(108, 99, 255, 0.08);
        color: #6C63FF;
        padding-left: 3rem;
    }

    .mobile-dropdown a:focus-visible {
        outline: 2px solid #6C63FF;
        outline-offset: 2px;
    }

    .mobile-dropdown a i {
        font-size: 0.8rem;
        width: 16px;
        text-align: center;
    }

    .mobile-nav-actions {
        margin-top: 2rem;
        padding-top: 1.5rem;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .mobile-theme-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        padding: 1rem;
        background: rgba(108, 99, 255, 0.08);
        border: 1px solid rgba(108, 99, 255, 0.2);
        border-radius: 12px;
        color: #6C63FF;
        text-decoration: none;
        font-weight: 500;
        transition: all 0.2s ease;
    }

    .mobile-theme-toggle:hover {
        background: rgba(108, 99, 255, 0.15);
        transform: scale(1.02);
    }

    .mobile-login-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        padding: 1rem;
        background: linear-gradient(135deg, #6C63FF 0%, #9333EA 100%);
        border: none;
        border-radius: 12px;
        color: white;
        text-decoration: none;
        font-weight: 600;
        transition: all 0.2s ease;
    }

    .mobile-login-btn:hover {
        transform: scale(1.02);
        box-shadow: 0 4px 15px rgba(108, 99, 255, 0.3);
    }

    /* Dark mode mobile menu */
    [data-theme="dark"] .mobile-menu-content {
        background: rgba(15, 23, 42, 0.95);
        border-left: 1px solid rgba(255, 255, 255, 0.1);
    }

    [data-theme="dark"] .mobile-menu-header {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    [data-theme="dark"] .mobile-nav-link {
        color: #cbd5e1;
    }

    [data-theme="dark"] .mobile-nav-link:hover {
        background: rgba(147, 51, 234, 0.1);
        color: #9333EA;
    }

    [data-theme="dark"] .mobile-dropdown {
        background: rgba(147, 51, 234, 0.03);
    }

    [data-theme="dark"] .mobile-dropdown a {
        color: #94a3b8;
    }

    [data-theme="dark"] .mobile-dropdown a:hover {
        background: rgba(147, 51, 234, 0.1);
        color: #9333EA;
    }

    [data-theme="dark"] .mobile-nav-actions {
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    [data-theme="dark"] .mobile-theme-toggle {
        background: rgba(147, 51, 234, 0.1);
        border-color: rgba(147, 51, 234, 0.3);
        color: #9333EA;
    }

    [data-theme="dark"] .mobile-theme-toggle:hover {
        background: rgba(147, 51, 234, 0.2);
    }

    /* Dark mode focus outlines */
    [data-theme="dark"] .mobile-nav-link:focus-visible,
    [data-theme="dark"] .mobile-dropdown a:focus-visible,
    [data-theme="dark"] .mobile-menu-close:focus-visible,
    [data-theme="dark"] .hamburger:focus-visible {
        outline-color: #9333EA;
    }

    /* Reduced motion support */
    @media (prefers-reduced-motion: reduce) {
        .mobile-menu-content {
            transition: none;
        }

        .mobile-dropdown {
            transition: none;
        }

        .hamburger span {
            transition: none;
        }

        .mobile-nav-link {
            transition: none;
        }
    }
}

/* Footer links */
footer a {
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: var(--cosmic-violet) !important;
    text-decoration: none;
}
