/**
 * NAVBAR.CSS - THEME TOGGLE FIXED
 */

/* --- 1. Animation Keyframes --- */
@keyframes navItemEntry {
    0% { opacity: 0; transform: translateY(-25px) scale(0.9); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes logoGlowPulse {
    0%, 100% { filter: drop-shadow(0 0 2px rgba(100, 1, 201, 0)); transform: scale(1); }
    50% { filter: drop-shadow(0 0 12px rgba(100, 1, 201, 0.4)); transform: scale(1.02); }
}

/* Rotation Fix: Added scale and simplified for stability */
@keyframes smoothRotate {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
}

@keyframes iconFloating {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* --- 2. Top Bar --- */
.top-bar {
    background-color: #f1f3f5;
    border-bottom: 1px solid var(--border-color);
    padding: 10px 0;
    position: relative;
    z-index: 2001;
}

.top-bar-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.top-separator {
    width: 1px;
    height: 15px;
    background-color: #ccc;
    opacity: 0.5;
}

.top-link {
    background-color: #ffffff;
    color: #555;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid #eee;
    transition: all 0.3s ease;
    opacity: 0;
    animation: navItemEntry 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.top-link:hover {
    background-color: var(--primary-color);
    color: #fff !important;
    transform: translateY(-2px);
}

.top-link:nth-child(1) { animation-delay: 0.05s; }
.top-link:nth-child(2) { animation-delay: 0.1s; }
.top-link:nth-child(3) { animation-delay: 0.15s; }
.top-link:nth-child(4) { animation-delay: 0.2s; }
.top-link:nth-child(5) { animation-delay: 0.25s; }

/* --- 3. Main Sticky Navbar --- */
.navbar {
    background-color: var(--card-bg);
    position: sticky;
    top: 0;
    z-index: 2000;
    border-bottom: 2px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1550px;
    margin: 0 auto;
    padding: 10px 20px;
    height: 85px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    animation: logoGlowPulse 4s infinite ease-in-out;
}

.logo img {
    height: 52px;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.logo:hover img { transform: rotate(-15deg) scale(1.2); }

.logo span {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary-color);
    white-space: nowrap;
}

/* --- 4. Main Colorful Action Boxes --- */
.nav-box {
    padding: 12px 24px;
    border-radius: 14px;
    font-weight: 800;
    font-size: 0.95rem;
    color: white !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    animation: navItemEntry 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.nav-koda-box { background: linear-gradient(135deg, #e67e22, #d35400); animation-delay: 0.3s; }
.nav-books-box { background: linear-gradient(135deg, #2980b9, #2471a3); animation-delay: 0.4s; }
.nav-questions-box { background: linear-gradient(135deg, #8e44ad, #7d3c98); animation-delay: 0.5s; }

.nav-box:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 12px 25px rgba(0,0,0,0.25);
    filter: brightness(1.15);
}

/* --- 5. Functional Buttons --- */
.nav-links {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-btn {
    background-color: var(--card-bg);
    border: 2px solid var(--border-color);
    color: var(--text-color);
    padding: 10px 18px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    font-size: 0.85rem;
    height: 46px;
    transition: all 0.3s ease;
    opacity: 0;
    animation: navItemEntry 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    backface-visibility: hidden; /* Fixes flickering */
}

.nav-fav-anim { border-color: var(--fav-color); color: var(--fav-color); animation-delay: 0.6s; }
.nav-offline-anim { animation-delay: 0.7s; }
.share-btn { border-color: var(--primary-color); color: var(--primary-color); animation-delay: 0.8s; }

/* FIXED THEME BUTTON STYLE */
.nav-theme-anim {
    width: 46px;
    min-width: 46px;
    border-radius: 50% !important;
    font-size: 1.3rem;
    animation-delay: 0.9s;
    padding: 0;
    line-height: 0;
    transform: none; /* Reset transform to prevent vanish glitch */
}

/* Apply hover effects specifically to buttons EXCEPT the theme toggle */
.nav-btn:not(.nav-theme-anim):hover {
    transform: translateY(-3px);
    background: var(--bg-color);
}

/* Specific Hover for Theme Toggle to avoid transform conflicts */
.nav-theme-anim:hover {
    animation: smoothRotate 0.6s ease-in-out forwards;
    background: var(--primary-color);
    border-color: var(--primary-color);
}

/* Icon Floating effect on hover */
.nav-box:hover span, .nav-btn:hover span {
    display: inline-block;
    animation: iconFloating 0.8s ease-in-out infinite;
}

/* --- 6. Mobile --- */
@media (max-width: 1000px) {
    .nav-container {
        height: auto;
        padding: 15px;
        flex-direction: column;
        gap: 15px;
    }
    .nav-links, .nav-right { width: 100%; justify-content: center; flex-wrap: wrap; }
}
