/* ========================================
   IMPORTS Y CONFIGURACIÓN
======================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #1e3a8a;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --accent: #1e3a8a;
    --accent-dark: #1e40af;
    --success: #059669;
    --danger: #dc2626;
    --warning: #f59e0b;
    --info: #3b82f6;
    --light: #f8fafc;
    --gray: #6b7280;
    --gray-light: #e2e8f0;
    --white: #ffffff;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', sans-serif;
    color: var(--primary);
    line-height: 1.6;
}

/* ========================================
   LOGIN - ESTRUCTURA DOS COLUMNAS
======================================== */
.login-wrapper {
    display: flex;
    height: 100vh;
}

/* COLUMNA IZQUIERDA - BRANDING */
.login-left {
    flex: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px;
    overflow: hidden;
}

.login-left::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    border-radius: 50%;
    top: -200px;
    right: -200px;
    animation: pulse 15s ease-in-out infinite;
}

.login-left::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
    bottom: -150px;
    left: -150px;
    animation: pulse 20s ease-in-out infinite reverse;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

.brand-content {
    position: relative;
    z-index: 1;
    text-align: center;
    color: white;
}

.brand-logo {
    width: 140px;
    height: 140px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.brand-logo i {
    font-size: 5rem;
    color: white;
}

.brand-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 20px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 1.3rem;
    font-weight: 400;
    opacity: 0.95;
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.6;
}

.brand-features {
    margin-top: 50px;
    display: flex;
    gap: 40px;
    justify-content: center;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1rem;
    opacity: 0.9;
}

.feature-item i {
    font-size: 1.5rem;
}

/* COLUMNA DERECHA - FORMULARIO */
.login-right {
    flex: 1;
    background: var(--light);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

.login-form-container {
    width: 100%;
    max-width: 480px;
    animation: slideIn 0.6s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.login-form-header {
    margin-bottom: 40px;
}

.login-form-header h2 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 12px;
}

.login-form-header p {
    font-size: 1.1rem;
    color: var(--gray);
}

/* ========================================
   FORMULARIOS
======================================== */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
    font-size: 1.2rem;
    pointer-events: none;
}

.form-control {
    width: 100%;
    padding: 16px 20px 16px 52px;
    border: 2px solid var(--gray-light);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: #1e3a8a;
    box-shadow: 0 0 0 4px rgba(30, 58, 138, 0.1);
}

.form-select {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid var(--gray-light);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--white);
}

.form-select:focus {
    outline: none;
    border-color: #1e3a8a;
    box-shadow: 0 0 0 4px rgba(30, 58, 138, 0.1);
}

/* ========================================
   BOTONES
======================================== */
.btn {
    padding: 14px 28px;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn-login {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: var(--border-radius);
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    margin-top: 10px;
}

.btn-login:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-primary {
    background: #1e3a8a;
    color: var(--white);
    box-shadow: 0 4px 15px rgba(30, 58, 138, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(30, 58, 138, 0.4);
    background: #1e40af;
    color: var(--white);
}

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

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

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

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

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.w-100 { width: 100%; }

/* ========================================
   ALERTAS
======================================== */
.alert {
    padding: 16px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: none;
    animation: slideDown 0.4s ease-out;
}

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

.alert-danger {
    background: #fef2f2;
    color: #991b1b;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
}

.login-footer {
    text-align: center;
    margin-top: 40px;
    color: var(--gray);
    font-size: 0.9rem;
}

/* ========================================
   NAVBAR
======================================== */
.navbar {
    background: var(--white) !important;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    padding: 16px 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--primary) !important;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-brand i {
    color: #1e3a8a;
}

.nav-link {
    color: var(--primary) !important;
    font-weight: 500;
    padding: 8px 16px !important;
    border-radius: 8px;
    transition: var(--transition);
}

.nav-link:hover {
    background: var(--light);
}

.navbar-text {
    color: var(--gray) !important;
    font-weight: 500;
}

/* ========================================
   CONTENEDOR PRINCIPAL
======================================== */
.container-fluid {
    padding: 30px;
    min-height: calc(100vh - 120px);
    background: var(--light);
}

/* ========================================
   CARDS
======================================== */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    border: none;
    margin-bottom: 24px;
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
}

.card-header {
    background: #1e3a8a;
    color: var(--white);
    padding: 20px 24px;
    font-weight: 600;
    font-size: 1.1rem;
    border: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body {
    padding: 24px;
}

/* ========================================
   CARDS DE ESTADÍSTICAS
======================================== */
.stat-card {
    text-align: center;
    padding: 32px 24px;
    cursor: pointer;
    transition: var(--transition);
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-8px);
}

.stat-card i {
    font-size: 3.5rem;
    margin-bottom: 16px;
    opacity: 0.9;
}

.stat-card h3 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 8px;
    line-height: 1;
}

.stat-card p {
    font-size: 1rem;
    color: var(--gray);
    font-weight: 500;
    margin: 0;
}

.border-primary { border: 2px solid rgba(30, 58, 138, 0.2) !important; }
.border-secondary { border: 2px solid rgba(100, 116, 139, 0.2) !important; }
.border-warning { border: 2px solid rgba(245, 158, 11, 0.2) !important; }
.border-info { border: 2px solid rgba(59, 130, 246, 0.2) !important; }

.text-primary { color: #1e3a8a !important; }
.text-secondary { color: var(--gray) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }

/* ========================================
   BADGES
======================================== */
.badge {
    padding: 6px 14px;
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.bg-secondary { background: var(--gray) !important; }
.bg-primary { background: #1e3a8a !important; }
.bg-info { background: var(--info) !important; }
.bg-warning { background: var(--warning) !important; color: var(--white) !important; }
.bg-success { background: var(--success) !important; }
.bg-danger { background: var(--danger) !important; }
.bg-dark { background: var(--primary) !important; }
.bg-purple { background: #9b59b6 !important; }

/* ========================================
   TABLAS
======================================== */
.table-responsive {
    border-radius: var(--border-radius);
    overflow: hidden;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: var(--light);
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    padding: 16px;
    border: none;
}

.table tbody td {
    padding: 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-light);
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: var(--light);
}

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

/* ========================================
   FOOTER
======================================== */
.footer {
    background: var(--white);
    padding: 24px 0;
    border-top: 1px solid var(--gray-light);
    margin-top: auto;
}

/* ========================================
   UTILIDADES
======================================== */
.text-muted { color: var(--gray) !important; }
.text-center { text-align: center; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-auto { margin-top: auto; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }

/* ========================================
   RESPONSIVE
======================================== */
@media (max-width: 992px) {
    .login-wrapper {
        flex-direction: column;
    }
    
    .login-left {
        min-height: 40vh;
        padding: 40px 30px;
    }
    
    .brand-title {
        font-size: 2.5rem;
    }
    
    .brand-subtitle {
        font-size: 1.1rem;
    }
    
    .brand-features {
        flex-direction: column;
        gap: 20px;
        margin-top: 30px;
    }
    
    .login-right {
        padding: 40px 30px;
    }
    
    .login-form-header h2 {
        font-size: 2rem;
    }
    
    .stat-card h3 {
        font-size: 2.5rem;
    }
    
    .container-fluid {
        padding: 20px 15px;
    }
}

/* ========================================
   DASHBOARD CON SIDEBAR
======================================== */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
    background: var(--light);
}

/* SIDEBAR */
.sidebar {
    width: 280px;
    background: var(--white);
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
}

.sidebar-header {
    padding: 30px 25px;
    border-bottom: 1px solid var(--gray-light);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    color: var(--primary);
}

.sidebar-brand-icon {
    width: 50px;
    height: 50px;
    background: #1e3a8a;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.sidebar-brand-text h3 {
    font-size: 1.3rem;
    font-weight: 800;
    margin: 0;
    line-height: 1;
}

.sidebar-brand-text p {
    font-size: 0.8rem;
    color: var(--gray);
    margin: 4px 0 0 0;
}

.sidebar-user {
    padding: 20px 25px;
    background: var(--light);
    border-bottom: 1px solid var(--gray-light);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 45px;
    height: 45px;
    background: #1e3a8a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
}

.user-details h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
    color: var(--primary);
}

.user-details p {
    font-size: 0.8rem;
    color: var(--gray);
    margin: 2px 0 0 0;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
}

.menu-section {
    margin-bottom: 30px;
}

.menu-section-title {
    padding: 0 25px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray);
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 25px;
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
    position: relative;
}

.menu-item:hover {
    background: var(--light);
    color: #1e3a8a;
}

.menu-item.active {
    background: linear-gradient(90deg, rgba(30, 58, 138, 0.1) 0%, transparent 100%);
    color: #1e3a8a;
    font-weight: 600;
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: #1e3a8a;
}

.menu-item i {
    font-size: 1.3rem;
    width: 24px;
    text-align: center;
}

.menu-item span {
    font-size: 0.95rem;
}

.menu-item-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

.sidebar-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--gray-light);
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px;
    background: var(--light);
    border: none;
    border-radius: 10px;
    color: var(--danger);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-logout:hover {
    background: var(--danger);
    color: white;
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    margin-left: 280px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-header {
    background: var(--white);
    padding: 20px 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.page-title-wrapper h1 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title-wrapper p {
    color: var(--gray);
    margin: 5px 0 0 0;
    font-size: 0.95rem;
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.content-wrapper {
    flex: 1;
    padding: 30px;
}

/* DASHBOARD STATS MEJORADAS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.stat-card-new {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card-new::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: #1e3a8a;
}

.stat-card-new:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.primary {
    background: rgba(30, 58, 138, 0.1);
    color: #1e3a8a;
}

.stat-icon.secondary {
    background: rgba(100, 116, 139, 0.1);
    color: var(--gray);
}

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

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

.stat-content h3 {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary);
    margin: 0 0 5px 0;
}

.stat-content p {
    color: var(--gray);
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0;
}

/* QUICK ACTIONS */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.quick-action-btn {
    padding: 18px;
    background: var(--white);
    border: 2px solid var(--gray-light);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
}

.quick-action-btn:hover {
    border-color: #1e3a8a;
    background: rgba(30, 58, 138, 0.05);
    color: #1e3a8a;
    transform: translateY(-2px);
}

.quick-action-btn i {
    font-size: 1.8rem;
}

/* TABLA MEJORADA */
.data-table-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.data-table-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.data-table-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

/* FIX TABLA RESPONSIVE - INFRACCIONES */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table td {
    white-space: normal;
    word-wrap: break-word;
    max-width: 300px;
}

/* RESPONSIVE */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .table td {
        font-size: 0.85rem;
        padding: 12px 8px;
    }
    
    .table th {
        font-size: 0.75rem;
        padding: 12px 8px;
    }
}
