/* ══════════════════════════════════════════════════════
   PUBLIC NAVBAR — Header estándar de 3 columnas
   Usado en: catalogo, region, rutas, vinicola, vino_detalle, perfil
   ══════════════════════════════════════════════════════ */

:root {
    --pub-nav-h:          64px;
    --pub-nav-h-scrolled: 54px;
    --pub-nav-brand:      #A1488E;
}

/* ── Contenedor principal ──────────────────────────────── */
.pub-navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--pub-nav-h);
    padding: 0 16px;

    /* 3 columnas simétricas: 1/4 | 2/4 | 1/4 */
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    align-items: center;

    z-index: 10000;

    /* Estado sólido por defecto (vistas sin hero de fondo) */
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);

    transition:
        background   0.3s ease,
        backdrop-filter 0.3s ease,
        box-shadow   0.3s ease,
        height       0.3s ease;
}

/* Modificador: fondo negro sólido (vinicola detalle) */
.pub-navbar--dark {
    background: #000 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
}

/* Botones sobre fondo negro: blancos con borde sutil */
.pub-navbar--dark .pub-nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
    box-shadow: none;
}

.pub-navbar--dark .pub-nav-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
    box-shadow: none;
    transform: scale(1.08);
}

/* Modificador: inicia transparente (vistas con hero-image) */
.pub-navbar--transparent {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
}

/* Modificador: aplicado por JS al hacer scroll > 50 px → negro */
.pub-navbar--scrolled {
    background: rgba(0, 0, 0, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.4) !important;
    height: var(--pub-nav-h-scrolled) !important;
}

/* Botones en estado scrolled: igual que en dark */
.pub-navbar--scrolled .pub-nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
    box-shadow: none;
}

.pub-navbar--scrolled .pub-nav-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
    box-shadow: none;
    transform: scale(1.08);
}

/* ── Columnas ──────────────────────────────────────────── */
.pub-navbar__left {
    grid-column: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.pub-navbar__center {
    grid-column: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pub-navbar__right {
    grid-column: 3;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

/* ── Logo estandarizado ────────────────────────────────── */
.pub-nav-logo {
    height: 36px;
    width: auto;
    object-fit: contain;
    display: block;
    transition: height 0.3s ease;
    /* Evita que el logo sea arrastrable */
    pointer-events: none;
    user-select: none;
}

.pub-navbar__center a {
    display: flex;
    align-items: center;
    pointer-events: auto;
}

.pub-navbar--scrolled .pub-nav-logo {
    height: 30px;
}

/* ── Botones circulares de acción ──────────────────────── */
.pub-nav-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;

    color: var(--pub-nav-brand);
    font-size: 17px;
    text-decoration: none;
    cursor: pointer;

    /* Glass por defecto (útil sobre imágenes oscuras) */
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(161, 72, 142, 0.22);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);

    /* Reset <button> */
    -webkit-appearance: none;
    appearance: none;
    padding: 0;
    line-height: 1;

    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sobre fondo blanco del navbar sólido: botón más sutil */
.pub-navbar--scrolled .pub-nav-btn {
    background: rgba(161, 72, 142, 0.06);
    border-color: rgba(161, 72, 142, 0.15);
    box-shadow: none;
}

.pub-nav-btn:hover {
    background: var(--pub-nav-brand);
    color: #fff;
    border-color: var(--pub-nav-brand);
    transform: scale(1.08);
    box-shadow: 0 0 18px rgba(161, 72, 142, 0.28);
}

.pub-nav-btn:active {
    transform: scale(0.94);
}

/* ── Vinicola mobile: logo izquierda en scroll, sin hamburguesa ── */
.pub-nav-vinicola-logo {
    display: none;
    align-items: center;
    text-decoration: none;
}

@media (max-width: 768px) {
    /* Botón atrás oculto en mobile — el bottom nav cubre la navegación */
    .pub-navbar__left { display: none; }

    /* Logo vinicola aparece solo cuando el header está scrolled */
    .pub-navbar--vinicola.pub-navbar--scrolled .pub-navbar__left {
        display: flex;
    }
    .pub-navbar--vinicola.pub-navbar--scrolled .pub-nav-vinicola-logo {
        display: flex;
    }

    .pub-navbar--vinicola #menuToggle { display: none; }
}

/* ── Spacer: empuja el contenido debajo del navbar fijo ── */
.pub-nav-spacer {
    height: var(--pub-nav-h);
    flex-shrink: 0;
}

/* ── Bottom Navigation (mobile only) ─────────────────────
   Compartido por todas las vistas públicas
   ──────────────────────────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 62px;
    background: #ffffff;
    border-top: 0.5px solid #e8e4e0;
    display: none;
    align-items: stretch;
    z-index: 200;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

@media (max-width: 768px) {
    .bottom-nav { display: flex; }

    /* Padding para que el contenido no quede tapado por el bottom nav */
    body { padding-bottom: 80px !important; }
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 0;
    cursor: pointer;
    background: none;
    border: none;
    outline: none;
    text-decoration: none;
    color: #bbb;
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item i { font-size: 18px; }

.bottom-nav-item span {
    font-size: 11px;
    font-weight: 500;
    font-family: 'DM Sans', 'Inter', sans-serif;
}

.bottom-nav-item.active,
.bottom-nav-item:hover { color: #7B2D8B; }

.bottom-nav-item.active span,
.bottom-nav-item:hover span { font-weight: 500; }

/* Vionda center button */
.bottom-nav-item.vionda-btn { position: relative; }

.bottom-nav-item.vionda-btn .vionda-fab {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7B2D8B 0%, #5a1f6b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -16px;
    box-shadow: 0 4px 16px rgba(123, 45, 139, 0.45);
    color: #fff;
    font-size: 18px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.bottom-nav-item.vionda-btn:hover .vionda-fab,
.bottom-nav-item.vionda-btn:active .vionda-fab {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(123, 45, 139, 0.55);
    color: #fff;
}

.bottom-nav-item.vionda-btn span {
    color: #7B2D8B;
    font-weight: 500;
}

/* Footer: solo visible en desktop */
@media (max-width: 768px) {
    .site-footer { display: none; }
}


/* ── Carrito en navbar ── */
.pub-nav-cart {
    position: relative;
    text-decoration: none;
}

.pub-nav-cart__badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: #e74c3c;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    pointer-events: none;
}

.pub-nav-cart__badge--hidden {
    display: none;
}

/* ── Search bar en navbar center (desktop only) ───────────── */
.pub-nav-search-bar {
    display: none;
}
.pub-nav-logo-mobile {
    display: flex;
}

@media (min-width: 769px) {
    .pub-nav-search-bar {
        display: flex;
        align-items: center;
        background: rgba(255,255,255,0.12);
        border: 1px solid rgba(255,255,255,0.2);
        border-radius: 999px;
        padding: 6px 18px;
        gap: 10px;
        width: 340px;
        backdrop-filter: blur(8px);
        transition: background 0.2s, border-color 0.2s;
    }
    .pub-nav-search-bar:focus-within {
        background: rgba(255,255,255,0.2);
        border-color: rgba(255,255,255,0.4);
    }
    .pub-nav-search-icon {
        color: rgba(255,255,255,0.7);
        font-size: 13px;
        flex-shrink: 0;
    }
    .pub-nav-search-input {
        background: transparent;
        border: none;
        outline: none;
        color: #fff;
        font-size: 13px;
        font-weight: 500;
        width: 100%;
    }
    .pub-nav-search-input::placeholder {
        color: rgba(255,255,255,0.5);
    }
    .pub-nav-search-clear {
        color: rgba(255,255,255,0.5);
        font-size: 12px;
        text-decoration: none;
        flex-shrink: 0;
    }
    .pub-nav-search-clear:hover { color: #fff; }
    .pub-nav-logo-mobile {
        display: none;
    }
}
