/* ============================================================
   NAVBAR — TuNegocioenCuba
   Mobile-First | CSS puro
   ============================================================ */

/* --- Reset base navbar --- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light, #e2e8f0);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.25s ease;
}

.navbar.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* ============================================================
   FILA PRINCIPAL — MOBILE FIRST
   Logo izquierda | Hamburger esquina sup. derecha (absoluto)
   ============================================================ */
.nav-inner {
    position: relative;              /* ancla para hamburguesa absoluta */
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 52px;
    padding: 0 14px;
    box-sizing: border-box;
}

/* ============================================================
   LOGO
   ============================================================ */
.nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    flex-shrink: 0;
    order: 1;
}

.nav-logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--primary, #0ea5e9), var(--primary-dark, #0284c7));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.85rem;
    box-shadow: 0 3px 10px rgba(14, 165, 233, 0.3);
    flex-shrink: 0;
}

.nav-logo-text {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-dark, #0f172a);
    letter-spacing: -0.3px;
    white-space: nowrap;
}

.nav-logo-accent {
    color: var(--primary, #0ea5e9);
}

/* ============================================================
   LINKS DE NAVEGACIÓN CENTRO — ocultos en móvil
   ============================================================ */
.nav-links {
    display: none;
    align-items: center;
    gap: 2px;
    flex: 1;
    justify-content: center;
    order: 2;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-mid, #475569);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.nav-link:hover {
    background: var(--bg-subtle, #f1f5f9);
    color: var(--primary, #0ea5e9);
}

.nav-link-active {
    background: rgba(14, 165, 233, 0.08);
    color: var(--primary, #0ea5e9);
    font-weight: 600;
}

/* ============================================================
   BLOQUE DE ACCIONES — OCULTO POR COMPLETO EN MÓVIL
   (esto eliminaba la "franja amarilla" / segunda fila)
   ============================================================ */
.nav-actions {
    display: contents;               /* no genera caja propia en móvil */
}

/* En móvil ocultamos TODO menos la hamburguesa */
.btn-publicar,
.btn-nav-secondary,
.btn-nav-primary,
.nav-user-menu {
    display: none !important;
}

/* ============================================================
   HAMBURGUESA — SIEMPRE esquina SUPERIOR DERECHA del NAVBAR
   ============================================================ */
.nav-hamburger {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    border: none;
    background: var(--bg-subtle, #f1f5f9);
    border-radius: 9px;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s ease;
    flex-shrink: 0;

    /* Anclaje absoluto al NAVBAR completo */
    position: absolute;
    top: 7px;
    right: 12px;
    z-index: 1100;
}

.nav-hamburger:hover {
    background: var(--border-light, #e2e8f0);
}

.nav-hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text-dark, #0f172a);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.2s ease, width 0.2s ease;
    transform-origin: center;
}

/* Animación X al abrir (compensar translateY del position absolute) */
.nav-hamburger.is-active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.nav-hamburger.is-active span:nth-child(2) {
    opacity: 0;
    width: 0;
}
.nav-hamburger.is-active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ============================================================
   MENÚ MÓVIL DESPLEGABLE
   Se ancla DEBAJO de la navbar, ancho completo, como dropdown.
   No empuja contenido ni aparece flotando en el medio.
   ============================================================ */
.nav-mobile-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    background: #fff;
    border-top: 1px solid var(--border-light, #e2e8f0);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    animation: slideDown 0.2s ease;
    overflow: hidden;
    z-index: 1050;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.nav-mobile-inner {
    display: flex;
    flex-direction: column;
    padding: 8px 10px 14px;
    max-width: 480px;
    margin: 0 auto;
}

.nav-mobile-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-mid, #475569);
    text-decoration: none;
    transition: background 0.12s ease, color 0.12s ease;
}

.nav-mobile-link:hover {
    background: var(--bg-subtle, #f1f5f9);
    color: var(--text-dark, #0f172a);
}

.nav-mobile-link i {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
    color: var(--text-light, #94a3b8);
    flex-shrink: 0;
}

.nav-mobile-link:hover i {
    color: var(--primary, #0ea5e9);
}

.nav-mobile-publicar {
    background: rgba(14, 165, 233, 0.07);
    color: var(--primary, #0ea5e9);
    font-weight: 700;
    border: 1.5px solid rgba(14, 165, 233, 0.18);
    margin-bottom: 4px;
}

.nav-mobile-publicar:hover {
    background: rgba(14, 165, 233, 0.12);
    color: var(--primary-dark, #0284c7);
}

.nav-mobile-publicar i { color: var(--primary, #0ea5e9); }

.nav-mobile-danger { color: #ef4444; }
.nav-mobile-danger:hover {
    background: rgba(239, 68, 68, 0.06);
    color: #dc2626;
}
.nav-mobile-danger i { color: #ef4444; }

.nav-mobile-divider {
    height: 1px;
    background: var(--border-light, #e2e8f0);
    margin: 6px 0;
}

/* ============================================================
   DROPDOWN USUARIO (desktop)
   ============================================================ */
.nav-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px 5px 5px;
    border: 1.5px solid var(--border-light, #e2e8f0);
    border-radius: 50px;
    background: var(--bg-card, #fff);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.nav-user-btn:hover {
    border-color: var(--primary, #0ea5e9);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.nav-avatar-img {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.nav-avatar-placeholder {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary, #0ea5e9), var(--accent, #10b981));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.nav-username {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dark, #0f172a);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-chevron {
    font-size: 0.6rem;
    color: var(--text-light, #94a3b8);
    transition: transform 0.2s ease;
}

.nav-user-btn[aria-expanded="true"] .nav-chevron {
    transform: rotate(180deg);
}

.nav-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    animation: dropdownFadeIn 0.15s ease;
    z-index: 200;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-mid, #475569);
    text-decoration: none;
    transition: background 0.12s ease, color 0.12s ease;
}

.nav-dropdown-item:hover {
    background: var(--bg-subtle, #f1f5f9);
    color: var(--text-dark, #0f172a);
}

.nav-dropdown-item i {
    width: 16px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-light, #94a3b8);
}

.nav-dropdown-admin { color: var(--primary, #0ea5e9); font-weight: 600; }
.nav-dropdown-admin i { color: var(--primary, #0ea5e9); }
.nav-dropdown-danger { color: #ef4444; }
.nav-dropdown-danger i { color: #ef4444; }

.nav-dropdown-divider {
    height: 1px;
    background: var(--border-light, #e2e8f0);
    margin: 4px 0;
}

/* ============================================================
   TABLET / DESKTOP (≥ 768px) — activar layout completo
   ============================================================ */
@media (min-width: 768px) {

    .nav-inner {
        height: 64px;
        padding: 0 28px;
    }

    .nav-links {
        display: flex;
    }

    /* Restaurar nav-actions como caja flex en desktop */
    .nav-actions {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        gap: 6px;
        order: 3;
        flex-shrink: 0;
        margin-left: auto;
    }

    .btn-publicar,
    .btn-nav-secondary,
    .btn-nav-primary,
    .nav-user-menu {
        display: flex !important;
    }

    /* En desktop la hamburguesa NO existe */
    .nav-hamburger {
        display: none !important;
        position: static;
        transform: none;
    }

    .nav-mobile-menu {
        display: none !important;
    }

    .btn-publicar {
        align-items: center;
        gap: 6px;
        background: linear-gradient(135deg, var(--primary, #0ea5e9), var(--primary-dark, #0284c7));
        color: #fff;
        padding: 8px 16px;
        border-radius: 50px;
        font-size: 0.875rem;
        font-weight: 700;
        text-decoration: none;
        box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
        transition: all 0.2s ease;
        white-space: nowrap;
    }

    .btn-publicar:hover {
        transform: translateY(-1px);
        box-shadow: 0 6px 18px rgba(14, 165, 233, 0.4);
        color: #fff;
    }

    .btn-nav-secondary {
        align-items: center;
        gap: 6px;
        padding: 7px 14px;
        border-radius: 10px;
        font-size: 0.875rem;
        font-weight: 600;
        color: var(--text-mid, #475569);
        text-decoration: none;
        transition: background 0.15s ease;
        white-space: nowrap;
    }

    .btn-nav-secondary:hover {
        background: var(--bg-subtle, #f1f5f9);
        color: var(--text-dark, #0f172a);
    }

    .btn-nav-primary {
        align-items: center;
        gap: 6px;
        background: linear-gradient(135deg, var(--primary, #0ea5e9), var(--primary-dark, #0284c7));
        color: #fff;
        padding: 8px 16px;
        border-radius: 50px;
        font-size: 0.875rem;
        font-weight: 700;
        text-decoration: none;
        box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
        transition: all 0.2s ease;
        white-space: nowrap;
    }

    .btn-nav-primary:hover {
        transform: translateY(-1px);
        box-shadow: 0 6px 18px rgba(14, 165, 233, 0.4);
        color: #fff;
    }

    .nav-user-menu {
        position: relative;
        align-items: center;
    }
}

@media (min-width: 1024px) {
    .nav-inner { padding: 0 40px; }
    .nav-username { max-width: 130px; }
}

/* ============================================================
   Accesibilidad
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .navbar, .nav-hamburger span,
    .nav-mobile-menu, .nav-dropdown {
        animation: none;
        transition: none;
    }
}
