:root {
    --primary-color: #2E7D32;
    /* Verde Bosque (Botones, Header) */
    --primary-hover: #1B5E20;
    /* Verde Oscuro (Hover) */
    --accent-color: #4CAF50;
    /* Verde Hoja Vivo (Iconos, Badges) */

    /* Neutros */
    --bg-body: #F9FAFB;
    /* Gris muy claro (Casi blanco) */
    --bg-card: #FFFFFF;
    /* Blanco puro */
    --text-main: #111827;
    /* Casi negro */
    --text-muted: #6B7280;
    /* Gris medio */
    --border-color: #E5E7EB;
    /* Gris suave para bordes */

    /* Sombras Premium (Suaves y difusas) */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);

    /* Dimensiones */
    --radius: 12px;
    /* Bordes redondeados modernos */
    --header-height: 70px;
}

/* --- Reset & Base --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'DM Sans', sans-serif;
    /* Estética Google Sans */
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    /* Texto nítido en Mac */
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.3s;
}

ul {
    list-style: none;
}

/* --- Layout --- */
.main-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

/* --- Tipografía --- */
h1,
h2,
h3 {
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
    /* Tracking moderno */
    margin-bottom: 1rem;
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.5rem;
}

/* --- Tarjetas (Cards) --- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
    /* Efecto elevación sutil */
}

/* --- Formularios Minimalistas --- */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
    font-size: 0.95rem;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    /* Bordes suaves */
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #FAFAFA;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
    /* Glow verde suave */
}

/* --- Botones Premium --- */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    border: none;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.2);
}

.btn-secondary {
    background-color: white;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: #F3F4F6;
    border-color: #D1D5DB;
}

.btn-danger {
    background-color: #EF4444;
    color: white;
}

/* --- Tablas Limpias --- */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    min-width: 600px;
}

th {
    background-color: #F8FAFC;
    text-align: left;
    padding: 16px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background-color: #F9FAFB;
}

/* --- Utilidades --- */
.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 1rem;
}

.w-100 {
    width: 100%;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* --- Badges (Etiquetas de estado) --- */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-success {
    background: #DCFCE7;
    color: #166534;
}

/* Verde suave */
.badge-warning {
    background: #FEF3C7;
    color: #92400E;
}

/* Amarillo suave */
.badge-danger {
    background: #FEE2E2;
    color: #991B1B;
}

/* Rojo suave */

/* =========================================
   NUEVO NAVBAR (CORREGIDO Y CENTRADO)
   ========================================= */

/* 1. Wrapper General y Fuente */
.navbar-wrapper {
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 1000;
    font-family: 'DM Sans', sans-serif !important;
    /* Forzar fuente */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

/* 2. Fila Superior (Blanca) */
.nav-top {
    background-color: #FFFFFF;
    height: 80px;
    border-bottom: 1px solid #E5E7EB;
}

/* Contenedor flexible */
.nav-top .container.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

/* LADOS: Definimos un ancho fijo para Izquierda y Derecha para equilibrar el centro */
.nav-side {
    width: 250px;
    /* Ancho fijo para equilibrar */
    display: flex;
    align-items: center;
}

.left-side {
    justify-content: flex-start;
}

/* Logo a la izquierda */
.right-side {
    justify-content: flex-end;
}

/* Usuario a la derecha */

/* Logo */
.brand-logo {
    height: 50px;
    width: auto;
    display: block;
}

/* TÍTULO CENTRAL: Ahora sí quedará centrado matemáticamente */
.nav-center-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #111827;
    text-transform: uppercase;
    letter-spacing: -0.5px;
    text-align: center;
    flex-grow: 1;
    /* Ocupa todo el espacio disponible en medio */
    font-family: 'DM Sans', sans-serif;
}

/* Sección Usuario */
.nav-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    text-align: right;
    line-height: 1.2;
}

.user-name {
    display: block;
    font-weight: 700;
    font-size: 0.9rem;
    color: #111827;
}

.user-role {
    font-size: 0.75rem;
    color: #6B7280;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.separator-vertical {
    height: 30px;
    width: 1px;
    background-color: #E5E7EB;
}

.btn-logout {
    font-size: 1.2rem;
    color: #9CA3AF;
    transition: 0.2s;
    padding: 5px;
}

.btn-logout:hover {
    color: #EF4444;
    transform: scale(1.1);
}

/* 3. Fila Inferior (Gris - Menú) */
.nav-bottom {
    background-color: #F8F9FA;
    height: 50px;
    border-bottom: 1px solid #E5E7EB;
}

/* CENTRADO DE LOS LINKS */
.nav-links-container {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    /* ESTO CENTRA LOS LINKS */
}

.nav-links {
    display: flex;
    gap: 40px;
    /* Más espacio entre links */
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

.nav-links li a {
    text-decoration: none;
    color: #4B5563;
    font-weight: 600;
    /* Peso de fuente estilo Google Sans Medium */
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    font-family: 'DM Sans', sans-serif;
}

.nav-links li a:hover {
    color: #2E7D32;
}

.nav-links li a i {
    font-size: 1rem;
    color: #9CA3AF;
    transition: 0.2s;
}

.nav-links li a:hover i {
    color: #2E7D32;
}

/* Responsive */
@media (max-width: 900px) {
    .nav-center-title {
        display: none;
    }

    .nav-side {
        width: auto;
    }

    /* Liberar ancho en móviles */
    .nav-links-container {
        justify-content: flex-start;
        overflow-x: auto;
    }
}

/* =========================================
   MENÚ COLAPSABLE CON PIN DINÁMICO
   ========================================= */

/* Contenedor del menú */
.nav-links-container {
    position: relative;
}

/* Lista de navegación - Estado Colapsado (default) */
.nav-links {
    gap: 28px;
    /* Mayor separación entre iconos cuando colapsado */
    transition: gap 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding-right: 50px;
    /* Espacio para el pin absoluto */
}

/* Lista de navegación - Estado Expandido */
.nav-links.expanded {
    gap: 32px;
    padding-right: 0;
    /* Sin padding extra cuando está expandido */
}

/* ========== PIN ITEM - Contenedor ========== */
.nav-pin-item {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
}

/* Pin Item cuando el menú está expandido - fluye inline */
.nav-links.expanded .nav-pin-item {
    position: static;
    transform: none;
    margin-left: 8px;
}

/* ========== BOTÓN PIN ========== */
.nav-pin-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #9CA3AF;
    font-size: 0.95rem;
    padding: 8px 10px;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-pin-btn:hover {
    color: var(--primary-color);
    background-color: rgba(46, 125, 50, 0.1);
}

/* Pin activo (fijado) */
.nav-pin-btn.pinned {
    color: var(--primary-color);
}

.nav-pin-btn i {
    transition: transform 0.3s ease;
}

.nav-pin-btn.pinned i {
    transform: rotate(45deg);
}

/* ========== LABELS ========== */
/* Labels ocultos por defecto (menú colapsado) */
.nav-links .nav-label {
    display: inline-block;
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Labels visibles cuando expandido */
.nav-links.expanded .nav-label {
    opacity: 1;
    max-width: 150px;
    margin-left: 8px;
}

/* ========== ICONOS ========== */
/* Iconos más grandes y destacados cuando solo iconos */
.nav-links li:not(.nav-pin-item) a i {
    font-size: 1.25rem;
    transition: font-size 0.3s ease, color 0.2s ease;
}

.nav-links.expanded li:not(.nav-pin-item) a i {
    font-size: 1rem;
}

/* ========== TOOLTIPS ========== */
/* Tooltip para iconos solos (cuando colapsado) */
.nav-links:not(.expanded) li:not(.nav-pin-item) a {
    position: relative;
}

.nav-links:not(.expanded) li:not(.nav-pin-item) a::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -38px;
    left: 50%;
    transform: translateX(-50%);
    background: #1F2937;
    color: white;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
    z-index: 1001;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Flecha del tooltip */
.nav-links:not(.expanded) li:not(.nav-pin-item) a::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: #1F2937;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 1001;
}

.nav-links:not(.expanded) li:not(.nav-pin-item) a:hover::after,
.nav-links:not(.expanded) li:not(.nav-pin-item) a:hover::before {
    opacity: 1;
    visibility: visible;
}

.nav-links:not(.expanded) li:not(.nav-pin-item) a:hover::after {
    transform: translateX(-50%) translateY(2px);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {

    /* Ocultar pin en móviles */
    .nav-pin-item {
        display: none !important;
    }

    /* Labels siempre visibles en móvil */
    .nav-links .nav-label {
        opacity: 1 !important;
        max-width: none !important;
        margin-left: 8px;
    }

    .nav-links li:not(.nav-pin-item) a i {
        font-size: 1rem;
    }

    .nav-links {
        gap: 20px;
        padding-right: 0;
    }

    /* Ocultar tooltips en móvil */
    .nav-links li a::after,
    .nav-links li a::before {
        display: none !important;
    }
}