/* ===========================================
   GLOBAL.CSS - ESTILOS GLOBALES OPTIMIZADOS Y CORREGIDOS
   VERSIÓN: 6.0 - CON ESTILOS DEL NAVBAR INTEGRADOS
   =========================================== */

/* ========== VARIABLES GLOBALES ========== */
:root {
    /* Colores principales */
    --primary-color: #8a1a1a;
    --primary-dark: #5a0505;
    --primary-light: #fdf2f2;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --primary-red: #ca1a1c;
    --dark-red: #8a1a1a;
    --light-red: #ff4444;
    --primary-blue: #007bff;
    --dark-blue: #0056b3;
    --light-blue: #e3f2fd;
    --azul-oscuro: #212529;

    /* Colores de texto */
    --text-dark: #333333;
    --text-medium: #555555;
    --text-light: #666666;
    --text-white: #ffffff;

    /* Fondos */
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --bg-gray: #f0f0f0;
    --bg-dark: #333333;

    /* Bordes */
    --border-color: #dee2e6;
    --border-radius: 8px;
    --border-radius-sm: 4px;
    --border-radius-lg: 12px;

    /* Sombras */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.1);

    /* Espaciado */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;

    /* Tipografía */
    --font-family-base: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-xxl: 1.5rem;

    /* Layout */
    --header-height: 56px;
}

/* ========== RESET Y ESTILOS BASE ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
    min-height: 100vh;
}

/* ========== TIPOGRAFÍA (CORREGIDO: SIN SUBRAYADOS) ========== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: var(--space-md);
}

h1 { font-size: var(--font-size-xxl); font-weight: 700; }
h2 { font-size: var(--font-size-xl); }
h3 { font-size: var(--font-size-lg); }

p {
    margin-bottom: var(--space-md);
}

a {
    color: var(--primary-color);
    text-decoration: none !important;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: none !important;
}

/* ========== NAVBAR PRINCIPAL (AGREGADO) ========== */
.navbar-main {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
    width: 100%;
    margin: 0 !important;
    border-bottom: none;
}

.navbar-main .container {
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 15px;
    padding-right: 15px;
    width: 100%;
}

.navbar-main.scrolled {
    background: white !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.navbar-brand-main {
    color: var(--primary-red) !important;
    font-weight: 700;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    text-decoration: none !important;
}

.navbar-brand-main:hover {
    color: var(--dark-red) !important;
    transform: translateY(-2px);
}

.navbar-brand-main i {
    margin-right: 10px;
    font-size: 1.5rem;
}

/* Enlaces del navbar */
.nav-item-main {
    margin: 0 5px;
}

.nav-link-main {
    color: #333 !important;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 10px 18px !important;
    border-radius: 6px;
    transition: all 0.3s ease;
    position: relative;
    text-decoration: none !important;
}

/* Línea roja para el enlace activo */
.nav-link-main.active::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-red);
}

.nav-link-main:hover {
    color: var(--primary-red) !important;
    background-color: rgba(202, 26, 28, 0.1);
    transform: translateY(-2px);
}

.nav-link-main i {
    margin-right: 8px;
    font-size: 1.1rem;
}

/* Botones de autenticación */
.auth-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Botón "Registrarse" (blanco con borde rojo) */
.btn-register {
    background: white;
    color: var(--primary-red) !important;
    border: 2px solid var(--primary-red);
    border-radius: 6px;
    padding: 8px 20px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-register:hover {
    background: var(--primary-red);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(202, 26, 28, 0.3);
}

/* Botón "Ingresar" (rojo que se pone azul al hacer hover) */
.btn-login {
    background: var(--primary-red);
    color: white !important;
    border: none;
    border-radius: 6px;
    padding: 8px 20px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-login:hover {
    background: var(--azul-oscuro);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(34, 33, 99, 0.3);
}

/* Usuario logueado */
.user-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    padding: 8px 15px;
    border-radius: 50px;
    border: 2px solid var(--primary-red);
}

.user-info i {
    color: var(--primary-red);
    font-size: 1.1rem;
    margin-right: 8px;
}

.user-name {
    color: #333;
    font-weight: 600;
    font-size: 0.95rem;
}

.btn-logout {
    background: #6c757d;
    color: white !important;
    border: none;
    border-radius: 6px;
    padding: 8px 18px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-logout:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(108, 117, 125, 0.3);
}

/* Responsive del navbar */
@media (max-width: 992px) {
    .navbar-main {
        padding: 10px 0;
    }

    .auth-buttons,
    .user-section {
        margin-top: 10px;
        justify-content: center;
    }

    .nav-item-main {
        margin: 3px 0;
    }

    .nav-link-main {
        padding: 10px 15px !important;
        text-align: center;
    }

    .nav-link-main::before {
        display: none;
    }

    .user-info {
        justify-content: center;
        width: 100%;
        padding: 6px 12px;
    }
}

/* ========== BOTONES ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    font-size: var(--font-size-base);
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none !important;
    gap: 8px;
}

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

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ========== FORMULARIOS ========== */
.form-control {
    width: 100%;
    padding: 10px 15px;
    font-size: var(--font-size-base);
    color: var(--text-dark);
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(138, 26, 26, 0.1);
}

.form-label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 500;
    color: var(--text-dark);
}

/* ========== ALERTAS ========== */
.alert {
    padding: var(--space-md);
    border-radius: var(--border-radius);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.alert-custom {
    border-radius: 8px;
    border: none;
    box-shadow: var(--shadow-sm);
    animation: slideIn 0.5s ease;
    margin-bottom: 0 !important;
}

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

/* ========== UTILIDADES ========== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.d-flex { display: flex; }
.d-none { display: none; }
.d-block { display: block; }

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

.flex-column { flex-direction: column; }
.flex-row { flex-direction: row; }

.w-100 { width: 100%; }
.w-auto { width: auto; }

.mt-1 { margin-top: var(--space-xs); }
.mt-2 { margin-top: var(--space-sm); }
.mt-3 { margin-top: var(--space-md); }
.mt-4 { margin-top: var(--space-lg); }

.mb-1 { margin-bottom: var(--space-xs); }
.mb-2 { margin-bottom: var(--space-sm); }
.mb-3 { margin-bottom: var(--space-md); }
.mb-4 { margin-bottom: var(--space-lg); }

.p-1 { padding: var(--space-xs); }
.p-2 { padding: var(--space-sm); }
.p-3 { padding: var(--space-md); }
.p-4 { padding: var(--space-lg); }

/* ========== CONTAINERS ========== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

/* ========== ESTRUCTURA DEL PANEL ========== */
.panel-container {
    display: flex;
    gap: 25px;
    margin: 20px auto;
    max-width: 1600px;
    padding: 0 20px;
    width: 100%;
}

/* SIDEBAR */
.panel-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    height: fit-content;
    position: sticky;
    top: 20px;
    overflow: hidden;
    z-index: 100;
}

.sidebar-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 20px;
    text-align: center;
    border-radius: 12px 12px 0 0;
}

.user-avatar-container {
    margin-bottom: 15px;
}

.user-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 3px solid white;
    object-fit: cover;
    margin: 0 auto;
    display: block;
}

.user-info h5 {
    font-size: 1.1rem;
    margin-bottom: 5px;
    font-weight: 600;
    color: black;
}

.user-info small {
    font-size: 0.8rem;
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.2);
    padding: 3px 8px;
    border-radius: 10px;
    display: inline-block;
}

.sidebar-menu {
    padding: 15px 0;
}

.sidebar-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    margin: 5px 10px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: #444;
    text-decoration: none !important;
    border-radius: 8px;
    transition: all 0.3s ease;
    margin: 0 10px;
    white-space: nowrap;
    position: relative;
    border-left: 3px solid transparent;
}

.sidebar-menu a:hover {
    background: var(--primary-light);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    text-decoration: none !important;
}

.sidebar-menu a.active {
    background: var(--primary-light);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
    text-decoration: none !important;
}

.sidebar-menu a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--primary-color);
    border-radius: 0 3px 3px 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-menu a:hover::before,
.sidebar-menu a.active::before {
    opacity: 1;
}

.sidebar-menu i {
    width: 20px;
    text-align: center;
    margin-right: 10px;
    font-size: 1rem;
    color: #666;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background: #f8f9fa;
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #8f0513, #c91325);
    color: white;
    border: none;
    border-radius: 10px;
    text-decoration: none !important;
    font-weight: 600;
    transition: all 0.3s ease;
    margin: 0 10px;
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(199, 10, 29, 0.3);
    color: white;
    text-decoration: none !important;
}

/* Contenido principal */
.panel-content {
    flex: 1;
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
}

/* Botón móvil */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    border: none;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* RESPONSIVE */
@media (max-width: 992px) {
    .panel-container {
        flex-direction: column;
        padding: 0 15px;
    }

    .panel-sidebar {
        width: 100%;
        position: static;
        margin-bottom: 20px;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .sidebar-mobile-hidden {
        display: none;
    }
}

@media (max-width: 768px) {
    .panel-content {
        padding: 15px;
    }
}

@media (max-width: 576px) {
    .panel-container {
        padding: 0 10px;
    }
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-gray);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* ========== PROTEGER FOOTER DE ESTILOS EXTERNOS ========== */
footer.bg-dark {
    background-color: #212529 !important;
    color: white !important;
}

footer.bg-dark * {
    color: inherit !important;
}

footer.bg-dark a {
    color: #e9ecef !important;
    text-decoration: none !important;
}

footer.bg-dark a:hover {
    color: #ffffff !important;
    text-decoration: none !important;
}

/* ===== ESTILO PARA ACTIVE EN ROJO ===== */
.sidebar-menu a.active-rojo {
    border-left: 4px solid #ff0000 !important;
    background: linear-gradient(90deg, rgba(255, 0, 0, 0.15), rgba(255, 0, 0, 0.05)) !important;
    color: #8a1a1a !important;
    font-weight: 700 !important;
    text-decoration: none !important;
}

.sidebar-menu a.active-rojo i {
    color: #8a1a1a !important;
}

.sidebar-menu a.active-rojo:hover {
    background: linear-gradient(90deg, rgba(255, 0, 0, 0.25), rgba(255, 0, 0, 0.1)) !important;
    transform: translateX(5px);
    text-decoration: none !important;
}

.sidebar-menu a.active-rojo::after {
    content: '';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background-color: #ff0000;
    border-radius: 50%;
    animation: pulsoRojo 1.5s infinite;
}

@keyframes pulsoRojo {
    0% { opacity: 1; transform: translateY(-50%) scale(1); }
    50% { opacity: 0.5; transform: translateY(-50%) scale(1.3); }
    100% { opacity: 1; transform: translateY(-50%) scale(1); }
}