/* public/css/navigation.css - ESTILOS PARA NAVEGACIÓN UNIFICADA */
/* Rediseño: "Technical Industrial Manual" — dark + amber accent */

/* =============== NAVEGACIÓN PRINCIPAL UNIFICADA =============== */
.main-navigation {
    background: var(--nav-bg, #0F172A);
    padding: 0;
    box-shadow: 0 2px 15px rgba(0,0,0,0.35);
    border-bottom: 2px solid var(--nav-border, #D97706);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    width: 100%;
}

/* Compensar el nav fixed — empuja el contenido hacia abajo */
body {
    padding-top: 62px; /* 60px nav + 2px border */
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    min-height: 60px;
}

.nav-brand {
    color: white;
    font-size: 1.4rem;
    font-weight: 700;
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
    letter-spacing: 0.5px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* Información del usuario en la navegación */
.user-info-nav {
    color: rgba(255,255,255,0.5);
    font-weight: 400;
    font-family: var(--font-body, 'Barlow', sans-serif);
    font-size: 0.68rem;
    letter-spacing: 0.3px;
    margin-top: 1px;
    display: block;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 18px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.82rem;
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    transition: color 0.2s ease, background 0.2s ease, border-bottom-color 0.2s ease;
    border-bottom: 3px solid transparent;
    border-top: 3px solid transparent; /* balance visual */
    background: none;
    cursor: pointer;
}

.nav-link:hover {
    color: white;
    background: rgba(255,255,255,0.06);
    border-bottom-color: rgba(217,119,6,0.5);
    text-decoration: none;
}

.nav-link.active {
    color: white;
    background: rgba(217,119,6,0.1);
    border-bottom-color: var(--nav-active, #D97706);
}

/* Botón de logout */
.nav-logout {
    padding: 0 14px !important;
    font-size: 0.75rem !important;
    min-height: 36px !important;
    opacity: 0.65;
    margin-left: 8px;
    border: 1px solid rgba(255,255,255,0.15) !important;
    border-bottom: 1px solid rgba(255,255,255,0.15) !important;
    border-top: 1px solid rgba(255,255,255,0.15) !important;
    border-radius: var(--radius, 8px) !important;
}

.nav-logout:hover {
    opacity: 1;
    background: rgba(220,38,38,0.15) !important;
    border-color: rgba(220,38,38,0.4) !important;
    border-bottom-color: rgba(220,38,38,0.4) !important;
}

/* =============== DROPDOWN ADMIN =============== */
.nav-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.dropdown-toggle::after {
    content: " ▾";
    font-size: 0.65rem;
    margin-left: 4px;
    opacity: 0.7;
    transition: transform 0.25s ease;
}

.dropdown-toggle:hover::after {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--bg-surface, #1E293B);
    min-width: 230px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
    border-radius: var(--radius, 8px);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.25s ease;
    z-index: 1001;
    border: 1px solid rgba(255,255,255,0.08);
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 18px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: var(--font-body, 'Barlow', sans-serif);
    transition: background 0.15s ease, color 0.15s ease;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    text-transform: none;
    letter-spacing: normal;
}

.dropdown-item:hover {
    background: rgba(217,119,6,0.12);
    color: white;
    text-decoration: none;
    padding-left: 22px;
}

.dropdown-item.active {
    background: var(--accent, #D97706);
    color: white;
}

.dropdown-item.active:hover {
    background: var(--accent-hover, #B45309);
}

.dropdown-item:last-child {
    border-bottom: none;
}

/* =============== RESPONSIVE DESIGN =============== */

/* ≤1200px: ocultar icons SVG y subtítulo — links más compactos */
@media (max-width: 1200px) {
    .nav-icon {
        display: none;
    }

    .user-info-nav {
        display: none;
    }

    .nav-link {
        padding: 0 11px;
        font-size: 0.78rem;
    }
}

/* ≤900px (móvil landscape, tablet portrait): ocultar brand, links en una fila scrollable */
@media (max-width: 900px) {
    body {
        padding-top: 52px; /* 50px nav + 2px border */
    }

    .nav-container {
        padding: 0 10px;
        min-height: 50px;
        flex-wrap: nowrap;
        overflow: hidden;
    }

    .nav-brand {
        display: none;
    }

    .nav-links {
        flex: 1;
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 0;
        justify-content: flex-start;
    }

    .nav-links::-webkit-scrollbar {
        display: none;
    }

    .nav-link {
        padding: 0 10px;
        font-size: 0.72rem;
        min-height: 50px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .nav-logout {
        padding: 0 10px !important;
        font-size: 0.72rem !important;
        min-height: 36px !important;
        flex-shrink: 0;
    }

    .dropdown-menu {
        position: fixed;
        top: 50px;
        right: 10px;
        left: auto;
        min-width: 200px;
    }
}

/* ≤480px: un poco más compacto */
@media (max-width: 480px) {
    .nav-link {
        padding: 0 8px;
        font-size: 0.68rem;
    }

    .nav-logout {
        padding: 0 8px !important;
        font-size: 0.68rem !important;
    }
}

/* =============== ANIMACIONES =============== */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-menu.show {
    animation: slideDown 0.25s ease;
}

/* Indicador de carga para navegación */
.nav-loading {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--bg-surface, #1E293B), var(--accent, #D97706), var(--bg-surface, #1E293B));
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow: hidden;
}

.nav-loading.active {
    opacity: 1;
    animation: loading-bar 1.6s infinite;
}

@keyframes loading-bar {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* =============== ICONOGRAFÍA SVG =============== */
.nav-icon {
    width: 15px;
    height: 15px;
    vertical-align: middle;
    margin-right: 5px;
    opacity: 0.8;
    flex-shrink: 0;
    transition: opacity 0.2s ease;
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
    opacity: 1;
}

@media (max-width: 480px) {
    .nav-icon {
        width: 13px;
        height: 13px;
        margin-right: 3px;
    }
}

/* =============== COMPATIBILIDAD =============== */
.main-navigation * {
    box-sizing: border-box;
}

.main-navigation .nav-link {
    text-transform: uppercase !important;
    letter-spacing: 0.8px !important;
}

.main-navigation .dropdown-item {
    text-transform: none !important;
    letter-spacing: normal !important;
}
