
/* ==========================================================================
   VARIABLES Y SISTEMA DE DISEÑO
   ========================================================================== */
:root {
    /* Paleta de Colores Curada */
    --primary: #1e3c72;
    --primary-light: #2a5298;
    --primary-gradient: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    --accent: #d4af37; /* Dorado premium */
    --accent-gradient: linear-gradient(135deg, #d4af37 0%, #f9e076 100%);
    
    /* Estados */
    --success: #10b981; /* Esmeralda */
    --warning: #f59e0b; /* Ambar */
    --danger: #ef4444;  /* Coral */
    --info: #3b82f6;    /* Azul brillante */
    
    /* Neutros */
    --bg-app: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    /* Efectos */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 30px rgba(30, 60, 114, 0.08);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   RESET Y CONFIGURACIÓN BÁSICA
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-light);
}

input, select, textarea, button {
    font-family: inherit;
    font-size: inherit;
}

/* ==========================================================================
   CONTENEDOR DE APLICACIÓN
   ========================================================================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ==========================================================================
   BARRA LATERAL (SIDEBAR)
   ========================================================================== */
.sidebar {
    width: 280px;
    background: var(--primary-gradient);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 40px;
    padding: 0 10px;
}

.brand-logo {
    width: 40px;
    height: 40px;
    background: var(--accent-gradient);
    color: var(--primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 22px;
    box-shadow: 0 4px 10px rgba(212, 175, 55, 0.3);
}

.brand-name {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.brand-name span {
    color: #f9e076;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-md);
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.user-avatar {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 15px;
}

.user-role {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.sidebar-nav {
    flex-grow: 1;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 8px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px 18px;
    color: rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-nav a i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.sidebar-nav a:hover,
.sidebar-nav li.active a {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    box-shadow: inset 4px 0 0 var(--accent);
}

.sidebar-nav a.logout-link:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ff8a8a;
    box-shadow: none;
}

.sidebar-footer {
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
}

.sidebar-footer .version {
    display: inline-block;
    margin-top: 5px;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.7);
}

/* ==========================================================================
   CONTENIDO PRINCIPAL Y HEADER
   ========================================================================== */
.main-content {
    flex-grow: 1;
    margin-left: 280px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.top-bar {
    background-color: var(--bg-card);
    height: 80px;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: var(--shadow-sm);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

#sidebar-toggle {
    display: none;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: rgba(16, 185, 129, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse 1.6s infinite;
}

.status-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--success);
}

.content-body {
    padding: 40px;
    flex-grow: 1;
}

/* ==========================================================================
   ALERTA ESTILOS
   ========================================================================== */
.alert {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 25px;
    border-left: 5px solid;
    position: relative;
    box-shadow: var(--shadow-md);
    animation: slideDown 0.3s ease;
}

.alert-success {
    background-color: #ecfdf5;
    border-color: var(--success);
    color: #065f46;
}

.alert-danger {
    background-color: #fef2f2;
    border-color: var(--danger);
    color: #991b1b;
}

.alert-warning {
    background-color: #fffbeb;
    border-color: var(--warning);
    color: #92400e;
}

.alert-close {
    background: none;
    border: none;
    font-size: 22px;
    margin-left: auto;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    transition: var(--transition);
}

.alert-close:hover {
    opacity: 1;
}

/* ==========================================================================
   GRID DE INDICADORES (TARJETAS RESUMEN)
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.stat-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-title {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-main);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: var(--shadow-sm);
}

.stat-card.active .stat-icon {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.stat-card.warning .stat-icon {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.stat-card.suspended .stat-icon {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.stat-card.pending .stat-icon {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

/* ==========================================================================
   SECCIONES Y TARJETAS PRINCIPALES
   ========================================================================== */
.card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    margin-bottom: 40px;
    overflow: hidden;
}

.card-header {
    padding: 25px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #fafbfc;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body {
    padding: 30px;
}

/* ==========================================================================
   BOTONES E INTERACTIVOS
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(30, 60, 114, 0.25);
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(30, 60, 114, 0.35);
}

.btn-accent {
    background: var(--accent-gradient);
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.2);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(212, 175, 55, 0.3);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background-color: #f1f5f9;
    border-color: var(--text-muted);
}

.btn-danger {
    background-color: var(--danger);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background-color: #dc2626;
    transform: translateY(-2px);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-muted);
}

.btn-icon:hover {
    background-color: #f1f5f9;
    color: var(--text-main);
}

/* Enlace a WhatsApp directo con icono */
.btn-wa {
    background-color: #25d366;
    color: #ffffff;
}

.btn-wa:hover {
    background-color: #20ba5a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.25);
}

/* ==========================================================================
   TABLAS PREMIUM
   ========================================================================== */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 18px 24px;
    background-color: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
}

td {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 14px;
    vertical-align: middle;
}

tr:hover td {
    background-color: #fafbfc;
}

/* Badges de Estado */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-active {
    background-color: rgba(16, 185, 129, 0.1);
    color: #065f46;
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: #92400e;
}

.badge-suspended {
    background-color: rgba(239, 68, 68, 0.1);
    color: #991b1b;
}

.badge-pending {
    background-color: rgba(59, 130, 246, 0.1);
    color: #1e40af;
}

.badge-cancelled {
    background-color: rgba(148, 163, 184, 0.1);
    color: #475569;
}

/* ==========================================================================
   ACCIONES RÁPIDAS Y FORMULARIOS
   ========================================================================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background-color: #ffffff;
    color: var(--text-main);
    transition: var(--transition);
}

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

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* ==========================================================================
   LOGIN SCREEN
   ========================================================================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 10% 20%, rgb(4, 21, 52) 0%, rgb(30, 60, 114) 100.2%);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    animation: zoomIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.login-header {
    text-align: center;
}

.login-logo {
    width: 60px;
    height: 60px;
    background: var(--accent-gradient);
    color: var(--primary);
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 32px;
    margin-bottom: 15px;
    box-shadow: 0 6px 15px rgba(212, 175, 55, 0.4);
}

.login-title {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 5px;
}

/* ==========================================================================
   ANIMACIONES
   ========================================================================== */
@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

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

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.fade-in {
    animation: slideDown 0.3s ease;
}

/* ==========================================================================
   RESPONSIVIDAD Y ADAPTABILIDAD
   ========================================================================== */
@media (max-width: 1024px) {
    .sidebar {
        left: -280px;
    }
    .sidebar.active {
        left: 0;
    }
    .main-content {
        margin-left: 0;
    }
    #sidebar-toggle {
        display: flex;
    }
}

@media (max-width: 640px) {
    .content-body {
        padding: 20px;
    }
    .top-bar {
        padding: 0 20px;
    }
    .card-body {
        padding: 20px;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
