/* ========================================
   BOTTOM NAV — Clean Minimal 2026
   Mobile (< 768px): Solid white bar + FAB sell button
   Desktop (>= 768px): Floating pill "Dynamic Island"
   ======================================== */

:root {
    --bn-kavo: #0F766E;
    --bn-kavo-hover: #0D6560;
    --bn-kavo-light: rgba(15, 118, 110, 0.1);
    --bn-kavo-glow: rgba(15, 118, 110, 0.18);
    --bn-text: #9CA3AF;
    --bn-text-active: #0F766E;
    --bn-nav-height: 64px;
    --bn-safe-bottom: env(safe-area-inset-bottom, 0px);
    --bn-fab-size: 52px;
    --bn-fab-lift: 14px;
}

/* ========================================
   Base — Mobile First (< 768px)
   Solid white bar, no transparency issues
   ======================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1050;
    background: #ffffff;
    border-top: 1px solid #F3F4F6;
    box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.07);
    padding-bottom: var(--bn-safe-bottom);
}

.bottom-nav__inner {
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    height: var(--bn-nav-height);
    max-width: 480px;
    margin: 0 auto;
    padding: 0 4px;
}

/* Nav Item — icon on top, label below */
.bottom-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--bn-text);
    text-decoration: none;
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    flex: 1;
    min-width: 0;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    transition: color 0.15s ease;
    padding-top: 8px;
    padding-bottom: 6px;
}

.bottom-nav__item i {
    font-size: 1.375rem;
    line-height: 1;
    transition: transform 0.15s ease;
}

.bottom-nav__item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    line-height: 1;
}

/* Active State */
.bottom-nav__item--active {
    color: var(--bn-text-active);
    font-weight: 600;
}

/* Active indicator — thin line on top */
.bottom-nav__item--active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 2px;
    border-radius: 0 0 2px 2px;
    background: var(--bn-kavo);
}

/* ========================================
   Sell Button — FAB (Floating Action Button)
   Perfectly centered above the bar
   ======================================== */
.bottom-nav__item--sell {
    position: relative;
    flex: 1.2;
    /* No active indicator line for sell */
}

.bottom-nav__item--sell::before {
    display: none;
}

.bottom-nav__item--sell.bottom-nav__item--active::before {
    display: none;
}

.bottom-nav__sell-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--bn-fab-size);
    height: var(--bn-fab-size);
    border-radius: 50%;
    background: var(--bn-kavo);
    color: #fff;
    font-size: 1.375rem;
    box-shadow:
        0 4px 16px rgba(15, 118, 110, 0.38),
        0 1px 4px rgba(15, 118, 110, 0.2);
    border: 3px solid #ffffff;
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease;
    /* Lift above the bar */
    margin-top: calc(-1 * var(--bn-fab-lift));
    flex-shrink: 0;
}

.bottom-nav__item--sell:hover .bottom-nav__sell-icon,
.bottom-nav__item--sell:active .bottom-nav__sell-icon {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(15, 118, 110, 0.48);
}

.bottom-nav__item--sell.bottom-nav__item--active .bottom-nav__sell-icon {
    background: var(--bn-kavo-hover);
}

.bottom-nav__sell-label {
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--bn-kavo);
    white-space: nowrap;
    margin-top: 2px;
}

/* ========================================
   Menu Button — reset native button styles
   ======================================== */
.bottom-nav__item--menu {
    background: none;
    border: none;
    outline: none;
    cursor: pointer;
    padding-top: 8px;
    padding-bottom: 6px;
}

/* ========================================
   Mobile-only class: hide on desktop
   ======================================== */
.bottom-nav--mobile-only {
    display: block;
}

/* ========================================
   Mi Cuenta — hidden on mobile, shown on desktop
   ======================================== */
.bottom-nav__item--account {
    display: none;
}

/* ========================================
   Desktop (>= 768px) — Floating pill
   Clean, minimal, "Dynamic Island" style
   ======================================== */
@media (min-width: 768px) {
    .bottom-nav {
        bottom: 2rem;
        left: 50%;
        transform: translateX(-50%) translateY(20px);
        width: auto;
        border-top: none;
        border-radius: 999px;
        border: 1px solid rgba(255, 255, 255, 0.4);
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(24px) saturate(180%);
        -webkit-backdrop-filter: blur(24px) saturate(180%);
        box-shadow:
            0 20px 40px rgba(0, 0, 0, 0.08),
            0 1px 3px rgba(0, 0, 0, 0.05),
            inset 0 0 0 1px rgba(255, 255, 255, 0.5);
        padding: 8px 10px;
        animation: bn-island-enter 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards 0.2s;
        opacity: 0;
    }

    @keyframes bn-island-enter {
        to {
            opacity: 1;
            transform: translateX(-50%) translateY(0);
        }
    }

    .bottom-nav__inner {
        height: 52px;
        gap: 8px;
        justify-content: center;
        max-width: none;
        padding: 0;
    }

    /* Desktop: horizontal layout — icon + text side by side */
    .bottom-nav__item {
        flex-direction: row;
        gap: 8px;
        flex: none;
        width: auto;
        padding: 0 20px;
        border-radius: 999px;
        font-size: 0.9375rem;
        font-weight: 600;
        color: #6B7280;
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
        height: 100%;
    }

    .bottom-nav__item::before { display: none; }

    /* Hide menu button on desktop */
    .bottom-nav__item--menu {
        display: none;
    }

    /* Show Mi Cuenta on desktop */
    .bottom-nav__item--account {
        display: flex;
    }

    .bottom-nav__item:hover {
        background: rgba(15, 118, 110, 0.08);
        color: var(--bn-kavo);
        transform: translateY(-2px);
    }

    .bottom-nav__item i {
        font-size: 1.125rem;
        transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .bottom-nav__item:hover i {
        transform: scale(1.15);
    }

    /* Active — soft green pill */
    .bottom-nav__item--active {
        background: rgba(15, 118, 110, 0.12);
        color: var(--bn-kavo);
    }

    .bottom-nav__item--active i {
        color: var(--bn-kavo);
    }

    /* Sell button — solid green pill CTA */
    .bottom-nav__item--sell {
        flex: none;
        background: linear-gradient(135deg, var(--bn-kavo) 0%, #0c5c56 100%);
        color: #fff;
        padding: 0 24px;
        border-radius: 999px;
        box-shadow: 0 4px 12px rgba(15, 118, 110, 0.3);
        position: relative;
        overflow: hidden;
    }

    /* Shimmer effect for sell button */
    .bottom-nav__item--sell::after {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 50%;
        height: 100%;
        background: linear-gradient(to right, transparent, rgba(255,255,255,0.3), transparent);
        transform: skewX(-20deg);
        animation: bn-shimmer 3s infinite;
        pointer-events: none;
    }

    @keyframes bn-shimmer {
        0% { left: -100%; }
        20% { left: 200%; }
        100% { left: 200%; }
    }

    .bottom-nav__item--sell:hover {
        background: linear-gradient(135deg, var(--bn-kavo-hover) 0%, #0a4d48 100%);
        color: #fff;
        box-shadow: 0 8px 24px rgba(15, 118, 110, 0.4);
        transform: translateY(-3px) scale(1.02);
    }

    .bottom-nav__sell-icon {
        position: static;
        width: auto;
        height: auto;
        font-size: 1.125rem;
        border: none;
        background: transparent;
        color: #fff;
        box-shadow: none;
        margin-top: 0;
        border-radius: 0;
    }

    .bottom-nav__item--sell:hover .bottom-nav__sell-icon,
    .bottom-nav__item--sell:active .bottom-nav__sell-icon {
        transform: rotate(90deg);
        box-shadow: none;
    }

    .bottom-nav__sell-label {
        font-size: inherit;
        font-weight: inherit;
        color: inherit;
        margin-top: 0;
    }

    .bottom-nav__item--sell.bottom-nav__item--active {
        background: linear-gradient(135deg, var(--bn-kavo-hover) 0%, #0a4d48 100%);
        color: #fff;
    }

    /* Hide on desktop when not in allowed routes */
    .bottom-nav--mobile-only {
        display: none;
    }
}

/* ========================================
   Tiny screens (< 375px)
   ======================================== */
@media (max-width: 374px) {
    :root {
        --bn-fab-size: 46px;
        --bn-fab-lift: 12px;
    }

    .bottom-nav__item {
        font-size: 0.5625rem;
    }

    .bottom-nav__item i {
        font-size: 1.2rem;
    }
}

/* ========================================
   Body padding to prevent content overlap
   Only on mobile (< 768px)
   ======================================== */
@media (max-width: 767.98px) {
    body {
        padding-bottom: calc(var(--bn-nav-height) + var(--bn-safe-bottom, 0px) + 4px);
    }
}
