/* ==========================================================================
   1. RESET Y VARIABLES GLOBALES
   ========================================================================== */
:root {
    --nav-bg: #1a252f;
    --nav-hover: #2c3e50;
    --nav-text: #ecf0f1;
    --nav-accent: #2563eb;
    --bg-body: #f8fafc;
    --text-color: #0f172a;
    --font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --border-color: #e2e8f0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-body);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-container {
    flex: 1 0 auto;
    width: 100%;
    max-width: 1750px;
    margin: 0 auto;
    padding: 24px 20px;
}

/* ==========================================================================
   2. NAVBAR Y CABECERA
   ========================================================================== */
.app-header {
    width: 100%;
    background-color: var(--nav-bg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    max-width: 1500px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 70px;
}

.navbar-brand {
    color: #ffffff;
    font-size: 1.4rem;
    font-weight: 800;
    text-decoration: none;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.nav-menu {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 100%;
}

.nav-item {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-link {
    color: var(--nav-text);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 6px;
    transition: background-color 0.2s ease, color 0.2s ease;
    cursor: pointer;
}

.nav-link:hover,
.nav-link.active {
    background-color: var(--nav-hover);
    color: #ffffff;
}

/* ==========================================================================
   3. MENÚS DESPLEGABLES (DROPDOWNS)
   ========================================================================== */
.dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
    padding: 6px 0;
    z-index: 1050;
    border: 1px solid var(--border-color);
    list-style: none;
    margin: 0;
}

.dropdown-menu-right {
    left: auto;
    right: 0;
}

.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu,
.nav-menu .dropdown:hover .dropdown-menu,
.user-menu:hover .dropdown-menu {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 10px 16px;
    color: #334155;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.dropdown-item:hover {
    background-color: #f1f5f9;
    color: var(--nav-accent);
}

.dropdown-item.text-danger {
    color: #dc2626;
}

.dropdown-item.text-danger:hover {
    background-color: #fee2e2;
}

.divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 6px 0;
}

/* ==========================================================================
   4. MENÚ DE USUARIO
   ========================================================================== */
.user-menu {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.user-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 14px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.user-btn:hover {
    background-color: var(--nav-hover);
}

.user-role {
    font-size: 0.8rem;
    background-color: #334155;
    color: #cbd5e1;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 500;
}

/* ==========================================================================
   5. COMPONENTES TOM SELECT
   ========================================================================== */
.ts-control {
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    padding: 9px 12px !important;
    font-size: 0.95rem !important;
}

.ts-dropdown {
    font-size: 0.95rem !important;
    z-index: 1000 !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1) !important;
}

/* ==========================================================================
   6. FOOTER
   ========================================================================== */
.app-footer {
    flex-shrink: 0;
    background-color: #ffffff;
    border-top: 1px solid var(--border-color);
    padding: 20px;
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
}