/* PillNav Styles */
:root {
    --nav-h: 50px;
    --pill-pad-x: 20px;
    --pill-gap: 5px;
}

body.dark-mode {
    --pill-bg-color: #1a1a1a;
    --pill-text-color: #e0e0e0;
    --pill-container-bg: rgba(20, 20, 20, 0.8);
    --pill-border: 1px solid rgba(255, 255, 255, 0.1);
    --pill-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

body:not(.dark-mode) {
    --pill-bg-color: #ffffff;
    --pill-text-color: #333;
    --pill-container-bg: rgba(255, 255, 255, 0.85);
    --pill-border: 1px solid rgba(0, 0, 0, 0.05);
    --pill-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.15);
}

.pill-nav-container {
    position: fixed;
    /* Changed to fixed for sticky header */
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    width: max-content;
    max-width: 90%;
}

@media (max-width: 768px) {
    .pill-nav-container {
        /* On mobile, full width or localized */
        width: 90%;
    }
}

.pill-nav {
    display: flex;
    align-items: center;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .pill-nav {
        width: 100%;
        justify-content: space-between;
    }
}

.pill-nav-items {
    position: relative;
    display: flex;
    align-items: center;
    height: var(--nav-h);
    height: var(--nav-h);
    background: var(--pill-container-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--pill-border);
    border-radius: 9999px;
    box-shadow: var(--pill-shadow);
    padding: 5px;
    transition: all 0.3s ease;
}

.pill-logo {
    width: var(--nav-h);
    height: var(--nav-h);
    border-radius: 50%;
    background: var(--pill-bg-color);
    padding: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-right: 15px;
    /* Spacing from items */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    text-decoration: none;
}

/* Logo Sizing & Rotation */
.pill-logo img {
    width: 65%;
    height: 65%;
    object-fit: contain;
    display: block;
    transition: transform 0.3s ease;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.pill-logo:hover img {
    animation: spin 0.2s linear 2;
}

.pill-list {
    list-style: none;
    display: flex;
    align-items: center;
    gap: var(--pill-gap);
    margin: 0;
    padding: 0;
    height: 100%;
}

.pill-list>li {
    display: flex;
    height: 100%;
}

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 0 var(--pill-pad-x);
    background: transparent;
    /* Transparent inside container */
    color: var(--pill-text-color);
    text-decoration: none;
    border-radius: 9999px;
    box-sizing: border-box;
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
    font-size: 0.95rem;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: color 0.3s;
    border: none;
    /* For button override */
}

/* Disable clicks on active link */
/* Disable clicks on active link */
.pill.is-active {
    pointer-events: none;
    cursor: default;
    /* Inverse Theme Highlighting (Black in Light Mode, White in Dark Mode) */
    background-color: var(--pill-text-color);
    color: var(--pill-bg-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.pill .hover-circle {
    position: absolute;
    left: 50%;
    bottom: 0;
    border-radius: 50%;
    background: var(--primary);
    /* Use Primary Theme Color */
    z-index: 1;
    display: block;
    pointer-events: none;
    will-change: transform;
}

.pill .label-stack {
    position: relative;
    display: inline-block;
    z-index: 2;
    height: 1em;
    /* Fixed height for stack */
    overflow: hidden;
}

.pill-label {
    display: block;
}

.pill-label-hover {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    color: #fff;
    /* Always white on primary bg */
    opacity: 0;
    transform: translateY(100%);
}

/* Theme Button Icon */
.pill .icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    position: relative;
}

.pill.theme-btn {
    padding: 0 10px;
    /* Smaller padding for icon */
}



.desktop-only {
    display: flex;
}

.mobile-only {
    display: none;
}

@media (max-width: 900px) {
    .desktop-only {
        display: none;
    }

    .mobile-only {
        display: block;
    }
}

/* Mobile Controls (Toggle + Burger) */
.mobile-controls {
    display: none;
    /* Hidden by default on desktop */
    align-items: center;
    gap: 15px;
    background: var(--pill-container-bg);
    padding: 5px 15px;
    border-radius: 9999px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--pill-border);
    box-shadow: var(--pill-shadow);
}

@media (max-width: 900px) {
    .mobile-controls {
        display: flex;
        /* Show on mobile */
    }

    .desktop-only {
        display: none;
    }
}

.mobile-theme-btn {
    background: transparent;
    color: var(--pill-text-color);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform 0.2s ease;
}

.mobile-theme-btn:active {
    transform: scale(0.9);
}

/* Reset Hamburger inside container */
.mobile-menu-button {
    background: transparent;
    border: none;
    box-shadow: none;
    width: auto;
    height: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    border-radius: 0;
}

@media (max-width: 900px) {
    .mobile-menu-button {
        display: flex;
    }
}

.hamburger-line {
    width: 20px;
    height: 2px;
    background: var(--pill-text-color);
    border-radius: 2px;
    transform-origin: center;
}

/* Mobile Popover */
.mobile-menu-popover {
    position: absolute;
    top: 70px;
    left: 0;
    right: 0;
    /* Dark Glass Background */
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 25px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    z-index: 998;
    visibility: hidden;
    opacity: 0;
    transform-origin: top center;
    padding: 15px;
    color: #fff;
    overflow: hidden;
}

.mobile-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mobile-menu-link {
    display: block;
    padding: 15px 20px;
    color: #e0e0e0;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 15px;
    transition: all 0.2s ease;
    font-family: 'Cairo', sans-serif;
    text-align: center;
    border: 1px solid transparent;
}

.mobile-menu-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.1);
}

.mobile-menu-link.is-active {
    background-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(42, 211, 216, 0.3);
    pointer-events: none;
    cursor: default;
}