/* Dark Empires — Navigation (PC dropdown + Mobile bottom nav) */

/* ── Keyframes ── */
@keyframes nav-pop      { 0% { transform: scale(0.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes menu-item-in { 0% { opacity: 0; transform: translateY(-4px); } 100% { opacity: 1; transform: translateY(0); } }
@keyframes wallet-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0.35); } 50% { box-shadow: 0 0 0 6px rgba(99,102,241,0); } }

/* ── Mobile Bottom Nav ── */
.mobile-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    width: 100%;
    background: rgba(255,255,255,0.88);
    border-top: 1px solid var(--border);
    display: none;
    grid-template-columns: repeat(5, 1fr);
    padding: 0.5rem 0 calc(0.5rem + env(safe-area-inset-bottom, 0px));
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    box-shadow:
        0 -6px 24px rgba(15, 23, 42, 0.08),
        0 -1px 0 rgba(255,255,255,0.8) inset;
    z-index: 1000;
    will-change: transform;
    transition: transform 0.3s ease-in-out;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

@media only screen and (max-device-width: 1024px) {
    .mobile-nav { display: grid; }
}

.mobile-nav.slide-left  { transform: translate3d(-100%, 0, 0); }
.mobile-nav.slide-right { transform: translate3d( 100%, 0, 0); }

.nav-item {
    color: var(--subtext);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: color 0.25s ease, background 0.25s ease, transform 0.2s ease;
    padding: 0.55rem 0.25rem 0.4rem;
    position: relative;
    flex: 1;
    text-align: center;
    touch-action: manipulation;
    border-radius: 12px;
    margin: 0 0.2rem;
    -webkit-tap-highlight-color: transparent;
}
/* Top indicator bar */
.nav-item::before {
    content: '';
    position: absolute;
    top: -8px;
    width: 28px; height: 3px;
    background: linear-gradient(90deg, var(--primary), #8b5cf6);
    border-radius: 2px;
    opacity: 0;
    transform: scaleX(0);
    transition: opacity 0.25s ease, transform 0.25s ease;
    box-shadow: 0 2px 8px rgba(99,102,241,0.45);
}
.nav-item:hover { color: var(--primary); background: rgba(99,102,241,0.06); }
.nav-item:active { transform: scale(0.95); }
.nav-item.active { color: var(--primary); background: rgba(99,102,241,0.08); }
.nav-item.active::before { opacity: 1; transform: scaleX(1); }
.nav-item:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.nav-icon {
    position: relative;
    font-size: 1.4rem;
    margin-bottom: 0.25rem;
    transition: transform 0.25s cubic-bezier(.34,1.56,.64,1);
    display: inline-block;
}
.nav-item:hover .nav-icon  { transform: translateY(-3px); }
.nav-item.active .nav-icon {
    transform: scale(1.15);
    animation: nav-pop 0.35s cubic-bezier(.34,1.56,.64,1);
}

/* ── PC Dropdown Menu ── */
.menu-container {
    display: none;
    position: relative;
}
@media only screen and (min-width: 1025px) {
    .menu-container { display: block; }
}

.menu-button {
    background: transparent;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-appearance: none;
    appearance: none;
}
.menu-button:hover { transform: scale(1.05); }
.menu-button i {
    font-size: 1.3rem;
    color: var(--text);
    transition: var(--transition);
}

.menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--card-bg);
    border-radius: 0.85rem;
    box-shadow:
        0 20px 40px -12px rgba(15,23,42,0.18),
        0 8px 16px -8px rgba(15,23,42,0.10),
        0 0 0 1px rgba(15,23,42,0.04);
    width: 260px;
    padding: 0.5rem 0;
    border: 1px solid var(--border);
    z-index: 200;
    transform-origin: top right;
}
.menu-dropdown.show {
    display: block;
    animation: scaleIn 0.22s cubic-bezier(.2,.9,.3,1);
}
.menu-dropdown.show::before {
    content: '';
    position: absolute;
    top: -6px; right: 18px;
    width: 12px; height: 12px;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    border-left: 1px solid var(--border);
    transform: rotate(45deg);
    z-index: -1;
}
/* Staggered item reveal */
.menu-dropdown.show > * { animation: menu-item-in 0.28s ease-out both; }
.menu-dropdown.show > *:nth-child(1) { animation-delay: 0.03s; }
.menu-dropdown.show > *:nth-child(2) { animation-delay: 0.06s; }
.menu-dropdown.show > *:nth-child(3) { animation-delay: 0.09s; }
.menu-dropdown.show > *:nth-child(4) { animation-delay: 0.12s; }
.menu-dropdown.show > *:nth-child(5) { animation-delay: 0.15s; }
.menu-dropdown.show > *:nth-child(n+6) { animation-delay: 0.18s; }

.menu-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.menu-item::before {
    content: '';
    position: absolute;
    left: 0; top: 0;
    width: 3px; height: 100%;
    background: var(--primary);
    transform: scaleY(0);
    transition: var(--transition);
}
.menu-item:hover {
    background: linear-gradient(90deg, rgba(99,102,241,0.09), rgba(99,102,241,0.02));
    color: var(--primary);
    padding-left: 1.5rem;
}
.menu-item:hover::before { transform: scaleY(1); }
.menu-item.active {
    color: var(--primary);
    font-weight: 600;
    background: rgba(99,102,241,0.06);
}
.menu-item.active::before { transform: scaleY(1); }
.menu-item:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.menu-icon {
    font-size: 1.1rem;
    margin-right: 1rem;
    color: var(--subtext);
    transition: var(--transition);
    min-width: 20px;
    text-align: center;
}
.menu-item:hover .menu-icon {
    color: var(--primary);
    transform: scale(1.15);
}

.wallet-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    background: var(--gradient);
    margin: 0.3rem 0.5rem;
    color: var(--text);
    border-radius: 0.5rem;
    animation: wallet-pulse 2.8s ease-in-out infinite;
    transition: background 0.25s ease, transform 0.2s ease;
}
.wallet-item:hover {
    background: linear-gradient(135deg, #d7e0ff, #b3d4fe);
    transform: translateY(-1px);
}
.wallet-content { display: flex; align-items: center; }

.whatsapp-link {
    color: var(--whatsapp);
    font-size: 1.2rem;
    transition: var(--transition);
    margin-right: 0.5rem;
}
.whatsapp-link:hover { transform: scale(1.15); color: #20b354; }

.menu-divider {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 0.5rem 0;
}

.logout-button {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--danger);
    transition: var(--transition);
}
.logout-button:hover {
    background: linear-gradient(90deg, rgba(220,38,38,0.08), rgba(220,38,38,0.02));
    padding-left: 1.5rem;
}
.logout-button i {
    font-size: 1.2rem;
    margin-right: 0.8rem;
    color: var(--danger);
    transition: transform 0.25s ease;
}
.logout-button:hover i { transform: translateX(-2px); }

/* ── Responsive refinements ── */
@media (max-width: 480px) {
    .nav-item { margin: 0 0.1rem; padding: 0.5rem 0.15rem 0.35rem; }
    .nav-icon { font-size: 1.3rem; }
}
@media (max-width: 360px) {
    .nav-item    { font-size: 0.65rem; margin: 0; border-radius: 8px; }
    .nav-icon    { font-size: 1.2rem; }
    .nav-item::before { width: 22px; height: 2px; }
    .wallet-item  { font-size: 0.8rem; }
    .whatsapp-link{ font-size: 1rem; }
}

/* ── Reduced-motion: respect user preference ── */
@media (prefers-reduced-motion: reduce) {
    .mobile-nav,
    .nav-item, .nav-icon,
    .menu-dropdown.show,
    .menu-dropdown.show > *,
    .menu-item, .menu-icon,
    .wallet-item, .whatsapp-link,
    .logout-button, .logout-button i {
        animation: none !important;
        transition: none !important;
    }
}
