/* ══ LIGHT MODE (default) ══════════════════════════════════════════════════ */
:root {
    --primary:       #6c63ff;
    --primary-dark:  #574fd6;
    --accent:        #ff6584;
    --bg-dark:       #f0f2f8;
    --bg-card:       #ffffff;
    --bg-sidebar:    #f7f8fc;
    --sidebar-width: 260px;
    --text:          #1a1a2e;
    --text-main:     #1a1a2e;
    --text-muted:    #6b7280;
    --text-light:    #ffffff;
    --border:        rgba(108,99,255,0.15);
    --success:       #16a34a;
    --danger:        #dc2626;
    --warning:       #d97706;
    --info:          #0891b2;
    --radius:        12px;
    --radius-sm:     8px;
    --shadow:        0 4px 20px rgba(0,0,0,0.10);
    --transition:    all 0.25s cubic-bezier(.4,0,.2,1);
    --glass:         rgba(108,99,255,0.06);
    --glass-border:  rgba(108,99,255,0.12);
}

/* ══ DARK MODE ═════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
    --bg-dark:       #0f0f1a;
    --bg-card:       #1a1a2e;
    --bg-sidebar:    #12121f;
    --text:          #e0e0f0;
    --text-main:     #e0e0f0;
    --text-muted:    #8888aa;
    --text-light:    #ffffff;
    --border:        rgba(108,99,255,0.18);
    --success:       #28d68c;
    --danger:        #ff4e6a;
    --warning:       #f5a623;
    --info:          #00bcd4;
    --shadow:        0 8px 32px rgba(0,0,0,0.45);
    --glass:         rgba(255,255,255,0.04);
    --glass-border:  rgba(255,255,255,0.08);
}

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

html { font-size: 15px; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.6;
}

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

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }

/* ===================== ALERTAS ===================== */
.alert {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease;
}
.alert-success { background: rgba(40,214,140,0.12); border-left: 4px solid var(--success); color: var(--success); }
.alert-danger   { background: rgba(255,78,106,0.12); border-left: 4px solid var(--danger);  color: var(--danger); }
.alert-warning  { background: rgba(245,166,35,0.12); border-left: 4px solid var(--warning); color: var(--warning); }
.alert-info     { background: rgba(0,188,212,0.12);  border-left: 4px solid var(--info);    color: var(--info); }

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

/* ===================== BOTONES ===================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover  { background: var(--primary-dark); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 15px rgba(108,99,255,0.4); }
.btn-danger   { background: rgba(255,78,106,0.15); color: var(--danger); border: 1px solid rgba(255,78,106,0.3); }
.btn-danger:hover   { background: var(--danger); color: #fff; }
.btn-success  { background: rgba(40,214,140,0.15); color: var(--success); border: 1px solid rgba(40,214,140,0.3); }
.btn-success:hover  { background: var(--success); color: #fff; }
.btn-secondary { background: var(--glass); color: var(--text-muted); border: 1px solid var(--glass-border); }
.btn-secondary:hover { background: var(--glass-border); color: var(--text-main); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ===================== FORMULARIOS ===================== */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.form-control {
    width: 100%;
    padding: 11px 14px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 0.92rem;
    transition: var(--transition);
    outline: none;
    font-family: 'Inter', sans-serif;
}
.form-control:focus {
    border-color: var(--primary);
    background: rgba(108,99,255,0.07);
    box-shadow: 0 0 0 3px rgba(108,99,255,0.18);
}
.form-control::placeholder { color: var(--text-muted); }
select.form-control option { background: var(--bg-card); color: var(--text-main); }

/* ===================== CARDS ===================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 24px;
    box-shadow: var(--shadow);
}

/* ===================== TABLAS ===================== */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
thead tr { background: rgba(108,99,255,0.08); }
th {
    padding: 13px 16px;
    text-align: left;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.9rem;
    vertical-align: middle;
}
tbody tr { transition: var(--transition); }
tbody tr:hover { background: var(--glass); }
tbody tr:last-child td { border-bottom: none; }

/* ===================== BADGES ===================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.badge-success { background: rgba(40,214,140,0.15); color: var(--success); }
.badge-danger  { background: rgba(255,78,106,0.15); color: var(--danger); }
.badge-primary { background: rgba(108,99,255,0.15); color: var(--primary); }
.badge-warning { background: rgba(245,166,35,0.15); color: var(--warning); }

/* ===================== STAT CARDS ===================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(0,0,0,0.4); }
.stat-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.stat-icon.purple { background: rgba(108,99,255,0.18); }
.stat-icon.green  { background: rgba(40,214,140,0.15); }
.stat-icon.pink   { background: rgba(255,101,132,0.15); }
.stat-icon.cyan   { background: rgba(0,188,212,0.15); }
.stat-number { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.stat-label  { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.05em; }

/* ===================== PAGE HEADER ===================== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 26px;
    gap: 14px;
    flex-wrap: wrap;
}
.page-header h1 { font-size: 1.5rem; font-weight: 700; }
.page-header p  { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }

/* ===================== LAYOUT APP ===================== */
.app-wrapper { display: flex; min-height: 100vh; }

/* ---- SIDEBAR ---- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: var(--transition);
    overflow-y: auto;
}
.sidebar-brand {
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--border);
}
.sidebar-brand .logo {
    font-size: 1.15rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.sidebar-brand .subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.sidebar-user {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}
.user-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.95rem;
    color: #fff;
    flex-shrink: 0;
    text-transform: uppercase;
}
.user-info .user-name  { font-size: 0.88rem; font-weight: 600; line-height: 1.3; }
.user-info .user-role  { font-size: 0.72rem; color: var(--primary); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }

.sidebar-nav { flex: 1; padding: 14px 12px; }
.nav-section-title {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 10px 8px 6px;
    opacity: 0.6;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 2px;
    transition: var(--transition);
    cursor: pointer;
}
.nav-item .icon { font-size: 1.05rem; width: 22px; text-align: center; }
.nav-item:hover { background: var(--glass); color: var(--text-main); }
.nav-item.active { background: rgba(108,99,255,0.15); color: var(--primary); font-weight: 700; }
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 12px;
    width: 3px; height: 28px;
    background: var(--primary);
    border-radius: 2px;
}
.nav-item { position: relative; }
.sidebar-footer {
    padding: 14px 12px;
    border-top: 1px solid var(--border);
}

/* ---- TOPBAR ---- */
.topbar {
    height: 64px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
}
.topbar-title { font-size: 1rem; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* ---- CONTENT ---- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.content-area { padding: 28px; flex: 1; }

/* ===================== LOGIN ===================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    position: relative;
    overflow: hidden;
    padding-top: 100px;
}
.login-bg {
    position: fixed; inset: 0;
    background:
        linear-gradient(160deg, rgba(245,245,251,.85) 0%, rgba(255,255,255,.70) 50%, rgba(230,228,255,.80) 100%),
        url('../img/hero_bg.jpg') center/cover no-repeat;
    pointer-events: none;
    z-index: 0;
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 44px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.5s ease;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
.login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo .logo-text {
    font-size: 1.7rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.login-logo .logo-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.login-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 6px;
}
.login-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 28px;
}
.btn-login {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(108,99,255,0.45); }
