/* ===== RESET Y VARIABLES ===== */
:root {
    --sidebar-width: 280px;
    --sidebar-width-mobile: 280px;
    --header-height: 70px;
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #93c5fd;
    --secondary-color: #1e293b;
    --text-color: #0f172a;
    --text-light: #64748b;
    --text-white: #ffffff;
    --bg-light: #f1f5f9;
    --bg-white: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-hover: 0 10px 25px rgba(0, 0, 0, 0.12);
    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-light);
    color: var(--text-color);
    overflow-x: hidden;
}

/* ===== WRAPPER PRINCIPAL ===== */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    color: var(--text-white);
    position: fixed;
    left: 0;
    top: 0;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease, width 0.3s ease;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

/* Sidebar Header */
.sidebar-header {
    padding: 20px 20px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.sidebar-header .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-white);
    text-decoration: none;
}

.sidebar-header .logo i {
    color: var(--primary-color);
    font-size: 24px;
}

.sidebar-header .logo span {
    letter-spacing: -0.5px;
}

/* Botón cerrar sidebar (visible solo en móvil) */
.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.sidebar-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

/* Perfil de usuario */
.user-profile {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.user-profile .avatar {
    font-size: 40px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-profile .user-info {
    flex: 1;
    min-width: 0;
}

.user-profile .user-info h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 3px;
    color: var(--text-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-profile .user-info .role-badge {
    font-size: 11px;
    background: var(--primary-color);
    padding: 2px 12px;
    border-radius: 20px;
    display: inline-block;
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* Navegación */
.sidebar-nav {
    padding: 12px 0 20px;
    flex: 1;
    overflow-y: auto;
}

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

.sidebar-nav .nav-item {
    margin: 2px 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.sidebar-nav .nav-item a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    font-size: 14px;
    font-weight: 500;
}

.sidebar-nav .nav-item a i {
    width: 20px;
    font-size: 16px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav .nav-item a span {
    flex: 1;
}

.sidebar-nav .nav-item .badge {
    background: var(--primary-color);
    font-size: 10px;
    padding: 1px 10px;
    border-radius: 20px;
    font-weight: 600;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.sidebar-nav .nav-item:hover a {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-white);
}

.sidebar-nav .nav-item.active a {
    background: var(--primary-color);
    color: var(--text-white);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.35);
}

.sidebar-nav .nav-item.active a i {
    color: var(--text-white);
}

.sidebar-nav .logout-item {
    margin-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 10px;
}

.sidebar-nav .logout-item a {
    color: rgba(239, 68, 68, 0.7);
}

.sidebar-nav .logout-item a:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* Footer del sidebar */
.sidebar-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

/* ===== CONTENIDO PRINCIPAL ===== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: calc(100% - var(--sidebar-width));
    transition: margin-left 0.3s ease, width 0.3s ease;
}

/* Header superior */
.main-header {
    background: var(--bg-white);
    padding: 16px 30px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 999;
    border-bottom: 1px solid #e2e8f0;
    gap: 15px;
    flex-wrap: wrap;
}

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

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

.main-header .page-title h2 i {
    color: var(--primary-color);
}

.main-header .page-title small {
    font-size: 13px;
    color: var(--text-light);
    display: block;
    margin-top: 2px;
    font-weight: 400;
}

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

.btn-mobile {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-color);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: var(--transition);
}

.btn-mobile:hover {
    background: var(--bg-light);
}

.main-header .header-actions .notification {
    position: relative;
    font-size: 18px;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
    padding: 4px;
}

.main-header .header-actions .notification:hover {
    color: var(--text-color);
}

.main-header .header-actions .notification .dot {
    position: absolute;
    top: 0;
    right: 0;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-white);
}

.main-header .header-actions .user-name {
    font-weight: 500;
    color: var(--text-color);
    font-size: 14px;
}

/* Contenido de la página */
.page-content {
    padding: 25px 30px;
    flex: 1;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* ===== CARDS ===== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: var(--bg-white);
    padding: 22px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid transparent;
}

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

.card .card-icon {
    font-size: 24px;
    color: var(--primary-color);
    margin-bottom: 10px;
    display: inline-block;
}

.card h3 {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 500;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card .number {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1.2;
}

/* ===== OVERLAY PARA MÓVIL ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(4px);
    transition: var(--transition);
}

.sidebar-overlay.active {
    display: block;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablets y móviles grandes */
@media (max-width: 1024px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Móviles y tablets pequeñas */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width-mobile);
        box-shadow: 2px 0 30px rgba(0, 0, 0, 0.3);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-close {
        display: block;
    }
    
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    .btn-mobile {
        display: block !important;
    }
    
    .main-header {
        padding: 12px 16px;
    }
    
    .main-header .page-title h2 {
        font-size: 18px;
    }
    
    .main-header .page-title small {
        font-size: 12px;
    }
    
    .page-content {
        padding: 16px 18px;
    }
    
    .cards-grid {
        grid-template-columns: 1fr 1fr;
        gap: 14px;
    }
    
    .card {
        padding: 16px 18px;
    }
    
    .card .number {
        font-size: 22px;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
}

/* Móviles pequeños */
@media (max-width: 480px) {
    .sidebar {
        width: 100% !important;
        max-width: 300px;
    }
    
    .sidebar-header {
        padding: 15px 16px;
    }
    
    .sidebar-header .logo {
        font-size: 17px;
    }
    
    .sidebar-header .logo i {
        font-size: 20px;
    }
    
    .user-profile {
        padding: 12px 16px;
        gap: 10px;
    }
    
    .user-profile .avatar {
        font-size: 32px;
    }
    
    .user-profile .user-info h4 {
        font-size: 13px;
    }
    
    .user-profile .user-info .role-badge {
        font-size: 10px;
    }
    
    .sidebar-nav .nav-item {
        margin: 1px 10px;
    }
    
    .sidebar-nav .nav-item a {
        padding: 8px 14px;
        font-size: 13px;
    }
    
    .sidebar-nav .nav-item a i {
        font-size: 15px;
        width: 18px;
    }
    
    .sidebar-nav .nav-item .badge {
        font-size: 9px;
        padding: 0px 8px;
    }
    
    .sidebar-footer {
        font-size: 10px;
        padding: 8px 16px;
    }
    
    .main-header .page-title h2 {
        font-size: 16px;
    }
    
    .main-header .page-title small {
        font-size: 11px;
    }
    
    .main-header .header-actions .user-name {
        display: none;
    }
    
    .page-content {
        padding: 12px 14px;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .card {
        padding: 14px 16px;
    }
    
    .card .number {
        font-size: 20px;
    }
    
    .card h3 {
        font-size: 11px;
    }
    
    .card .card-icon {
        font-size: 18px;
        margin-bottom: 8px;
    }
    
    .main-header .flex-header {
        gap: 10px;
    }
    
    .btn-mobile {
        font-size: 18px;
        padding: 4px 8px;
    }
}

/* ============================================================
   UTILIDADES
   ============================================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-column { display: flex; flex-direction: column; }
.gap-10 { gap: 10px; }
.gap-15 { gap: 15px; }
.gap-20 { gap: 20px; }
.w-100 { width: 100%; }
.h-100 { height: 100%; }

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

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.35);
}

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

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.35);
}

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

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
}

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

/* ===== STATUS BADGES ===== */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    letter-spacing: 0.3px;
}

.status-badge.success {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.primary {
    background: #dbeafe;
    color: #1e40af;
}

.status-badge.warning {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.danger {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.info {
    background: #e0f2fe;
    color: #075985;
}

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

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

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ===== TABLAS ===== */
.table-container {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.table-container h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 16px;
}

.table-container table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 600px;
}

.table-container table thead {
    background: #f8fafc;
}

.table-container table th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e2e8f0;
}

.table-container table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-color);
}

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

.table-container table tbody tr:hover {
    background: #f8fafc;
}

/* ===== SCROLLBAR DE TABLAS ===== */
.table-container::-webkit-scrollbar {
    height: 6px;
}

.table-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.table-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 420px;
    padding: 40px 35px;
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #3b82f6, #10b981, #3b82f6);
    background-size: 200% 100%;
    animation: gradientMove 3s ease infinite;
}

@keyframes gradientMove {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.login-header {
    text-align: center;
    margin-bottom: 35px;
}

.login-header .logo-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
}

.login-header .logo-icon i {
    font-size: 32px;
    color: white;
}

.login-header h1 {
    font-size: 24px;
    color: #0f172a;
    font-weight: 700;
    margin-bottom: 5px;
}

.login-header p {
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
}

/* ============================================================
   FORMULARIO CORREGIDO
   ============================================================ */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

.form-group .input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.form-group .input-wrapper i:first-child {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 16px;
    z-index: 1;
    pointer-events: none;
}

.form-group .input-wrapper input {
    width: 100%;
    padding: 12px 46px 12px 45px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s;
    background: #f8fafc;
    color: #0f172a;
    flex: 1;
}

.form-group .input-wrapper input:focus {
    outline: none;
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.form-group .toggle-password {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    transition: color 0.3s;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    line-height: 1;
    width: 32px;
    height: 32px;
}

.form-group .toggle-password:hover {
    color: #475569;
    background: rgba(0, 0, 0, 0.05);
}

.form-group .toggle-password:focus {
    outline: none;
}

.form-group .toggle-password i {
    font-size: 17px;
    pointer-events: none;
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
}

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

.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease;
}

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

.alert-danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.alert i {
    font-size: 18px;
}

.login-footer {
    text-align: center;
    margin-top: 25px;
    color: #94a3b8;
    font-size: 13px;
}

.login-footer a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 600;
}

.login-footer a:hover {
    text-decoration: underline;
}

@media (max-width: 480px) {
    .login-container {
        padding: 30px 20px;
    }
    
    .login-header h1 {
        font-size: 20px;
    }
    
    .form-group .input-wrapper input {
        padding: 10px 40px 10px 40px;
        font-size: 13px;
    }
    
    .form-group .toggle-password {
        padding: 4px 6px;
        font-size: 16px;
        right: 6px;
        width: 28px;
        height: 28px;
    }
    
    .form-group .toggle-password i {
        font-size: 15px;
    }
}
/*fin de login*/