/* ──────────────────────────────────────────────
   ARMomentsVIP Nucleus — panel.css v1.0
   Tema: LIGHT (único) · Acento: índigo #6366f1
   ────────────────────────────────────────────── */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8fafc;
    color: #0f172a;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Swal2 Theme Override ───────────────────── */
.swal2-popup .swal2-title { color: #0f172a !important; }
.swal2-popup .swal2-confirm { background: #6366f1 !important; border-color: #6366f1 !important; }
.swal2-popup .swal2-confirm:hover { background: #4f46e5 !important; }
.swal2-popup .swal2-cancel { background: #e2e8f0 !important; color: #475569 !important; }
.swal2-popup .swal2-cancel:hover { background: #cbd5e1 !important; }
.swal2-icon.swal2-success .swal2-success-ring { border-color: #6366f1 !important; }
.swal2-toast.swal2-success { border-left: 4px solid #6366f1; }
.swal2-toast.swal2-error { border-left: 4px solid #ef4444; }
.swal2-container { z-index: 10001 !important; }

/* ── Login ──────────────────────────────────── */
.login-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 20px;
    background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 50%, #e0e7ff 100%);
}
.login-card {
    background: #ffffff; border-radius: 16px; padding: 40px;
    width: 100%; max-width: 380px;
    box-shadow: 0 4px 24px rgba(99,102,241,0.10);
    border: 1px solid #e2e8f0;
}
.login-card h1 {
    font-size: 1.5rem; margin-bottom: 8px; text-align: center;
    color: #6366f1; font-weight: 800; letter-spacing: -0.02em;
}
.login-card .subtitle {
    text-align: center; color: #64748b; font-size: 0.9rem; margin-bottom: 30px;
}
.btn-login {
    width: 100%; padding: 14px;
    background: #6366f1; color: #fff; border: none; border-radius: 8px;
    font-size: 1rem; font-weight: 700; cursor: pointer; transition: all 0.2s;
}
.btn-login:hover { background: #4f46e5; box-shadow: 0 4px 12px rgba(99,102,241,0.35); }
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Layout ─────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 250px; background: #ffffff; padding: 28px 16px;
    display: flex; flex-direction: column; gap: 4px;
    position: fixed; top: 0; left: 0; bottom: 0;
    overflow-y: auto; z-index: 100;
    border-right: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.sidebar-brand {
    font-size: 1.25rem; font-weight: 800; color: #6366f1;
    padding: 0 12px 20px; border-bottom: 1px solid #e2e8f0;
    margin-bottom: 16px; letter-spacing: -0.02em;
}
.sidebar a {
    display: block; padding: 10px 14px; color: #475569;
    text-decoration: none; border-radius: 8px;
    font-size: 0.9rem; font-weight: 500; transition: all 0.15s ease;
}
.sidebar a i { width: 20px; text-align: center; margin-right: 4px; }
.sidebar a:hover { background: #eef2ff; color: #4f46e5; }
.sidebar a.active { background: #6366f1; color: #ffffff; font-weight: 600; }
.sidebar-footer {
    margin-top: auto; padding-top: 16px; border-top: 1px solid #e2e8f0;
}
.sidebar-footer .user-info {
    font-size: 0.85rem; color: #64748b; padding: 0 12px; margin-bottom: 10px;
}

.main { flex: 1; margin-left: 250px; padding: 36px 40px; }

/* ── Header ─────────────────────────────────── */
.main-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px; gap: 16px; flex-wrap: wrap;
}
.main-header h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }
.header-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.section-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 16px; }
.section-desc { color: #64748b; font-size: 0.9rem; margin-bottom: 24px; max-width: 720px; }
.section-desc a { color: #6366f1; }

/* ── Stats ──────────────────────────────────── */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px; margin-bottom: 32px;
}
.stat-card {
    background: #ffffff; border-radius: 12px; padding: 22px;
    border: 1px solid #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.stat-card .label {
    font-size: 0.75rem; color: #64748b; margin-bottom: 8px;
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}
.stat-card .value { font-size: 1.9rem; font-weight: 800; color: #6366f1; }
.stat-card .sub { font-size: 0.78rem; color: #94a3b8; margin-top: 4px; }

/* ── Tables ─────────────────────────────────── */
.table-wrap {
    overflow-x: auto; background: #ffffff; border-radius: 12px;
    border: 1px solid #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 13px 16px; text-align: left; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
th {
    color: #64748b; font-weight: 600; font-size: 0.72rem;
    text-transform: uppercase; letter-spacing: 0.05em; background: #f8fafc;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }
.empty-row { text-align: center; color: #94a3b8; padding: 24px !important; }
.nowrap { white-space: nowrap; }
.text-muted { color: #94a3b8; }
td.num, th.num { text-align: right; white-space: nowrap; }

.celda-nombre { font-weight: 600; }
.celda-sub { font-size: 0.75rem; color: #94a3b8; margin-top: 2px; }
.code-chip {
    display: inline-block; padding: 3px 10px; border-radius: 6px;
    background: #eef2ff; color: #4f46e5; font-family: 'Consolas', monospace;
    font-size: 0.8rem; font-weight: 700; letter-spacing: 0.03em;
}

/* ── Forms ──────────────────────────────────── */
.form-card {
    background: #ffffff; border-radius: 12px; padding: 28px;
    border: 1px solid #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    margin-bottom: 24px;
}
.form-card h2 { font-size: 1.1rem; margin-bottom: 20px; font-weight: 700; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-group { margin-bottom: 16px; flex: 1; min-width: 200px; }
.form-group label { display: block; font-size: 0.85rem; color: #475569; margin-bottom: 6px; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 14px; background: #ffffff;
    border: 1px solid #cbd5e1; border-radius: 8px; color: #0f172a;
    font-size: 0.9rem; transition: border-color 0.15s; font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.10);
}
.form-group input[type="file"] { padding: 8px; background: #f8fafc; }

/* ── Buttons ────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px; border: 1px solid transparent; border-radius: 8px;
    font-size: 0.875rem; font-weight: 600; cursor: pointer;
    text-decoration: none; transition: all 0.15s ease; line-height: 1.4;
    font-family: inherit;
}
.btn-primary { background: #6366f1; color: #fff; border-color: #6366f1; }
.btn-primary:hover { background: #4f46e5; box-shadow: 0 2px 8px rgba(99,102,241,0.3); }
.btn-success { background: #059669; color: #fff; border-color: #059669; }
.btn-success:hover { background: #047857; }
.btn-danger { background: #ffffff; color: #dc2626; border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; border-color: #dc2626; }
.btn-outline { background: #ffffff; color: #475569; border-color: #cbd5e1; }
.btn-outline:hover { background: #f1f5f9; border-color: #94a3b8; }
.btn-indigo { background: #ffffff; color: #6366f1; border-color: #6366f1; }
.btn-indigo:hover { background: #eef2ff; box-shadow: 0 2px 8px rgba(99,102,241,0.25); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; flex-shrink: 0; }
.btn-icon-red { background: #fff; color: #dc2626; border-color: #fca5a5; }
.btn-icon-red:hover { background: #fee2e2; }
.btn-icon-green { background: #fff; color: #16a34a; border-color: #86efac; }
.btn-icon-green:hover { background: #dcfce7; }
.btn-icon-indigo { background: #fff; color: #6366f1; border-color: #c7d2fe; }
.btn-icon-indigo:hover { background: #eef2ff; }

.cell-actions { white-space: nowrap; display: flex; gap: 6px; }

/* ── Buscador ───────────────────────────────── */
.search-bar { position: relative; }
.header-actions .search-bar { width: 220px; }
.search-bar i {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: #94a3b8; font-size: 0.8rem;
}
.search-bar input {
    width: 100%; padding: 8px 12px 8px 34px; border-radius: 8px;
    border: 1px solid #e2e8f0; background: #fff;
    font-size: 0.82rem; transition: all 0.15s; font-family: inherit;
}
.search-bar input:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.10); }

/* ── Modal QR ───────────────────────────────── */
.qr-modal-card { text-align: center; max-width: 380px; }
.qr-url { color: #64748b; font-size: 0.8rem; margin-bottom: 16px; word-break: break-all; }
.qr-img-wrap { background: #fff; padding: 16px; border-radius: 12px; display: inline-block; margin-bottom: 20px; border: 1px solid #e2e8f0; }
.qr-img-wrap img { width: 240px; height: 240px; }

/* ── Badges ─────────────────────────────────── */
.badge {
    display: inline-block; padding: 4px 12px; border-radius: 20px;
    font-size: 0.75rem; font-weight: 600;
}
.badge-green { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.badge-gray { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }
.badge-red { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.badge-indigo { background: #eef2ff; color: #4f46e5; border: 1px solid #c7d2fe; }

/* ── Modal ──────────────────────────────────── */
.modal-overlay {
    display: none; position: fixed; inset: 0; z-index: 9999;
    background: rgba(15,23,42,0.45); backdrop-filter: blur(4px);
    align-items: center; justify-content: center; padding: 20px; overflow: hidden;
}
.modal-overlay.active { display: flex; }
.modal-card {
    background: #fff; border-radius: 16px; padding: 28px;
    width: 100%; max-width: 460px; box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    max-height: calc(100vh - 40px); overflow-y: auto;
}
.modal-card h3 { font-size: 1.1rem; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ── Loader ─────────────────────────────────── */
.loader-overlay {
    display: none; position: fixed; inset: 0; z-index: 10000;
    background: rgba(248,250,252,0.75);
    align-items: center; justify-content: center; flex-direction: column; gap: 12px;
}
.loader-overlay.active { display: flex; }
.loader-spinner {
    width: 40px; height: 40px; border: 4px solid #e2e8f0;
    border-top-color: #6366f1; border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-text { font-size: 0.9rem; color: #475569; font-weight: 500; }

/* ── Gráfico de barras (estadísticas) ───────── */
.est-grafico-wrap { padding: 16px; }
.est-grafico {
    display: flex; align-items: flex-end; gap: 2px;
    height: 180px; overflow-x: auto; padding-bottom: 4px;
}
.est-barra-col {
    flex: 1 0 6px; min-width: 6px; max-width: 28px;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
    height: 100%; cursor: default;
}
.est-barra-valor { font-size: .6rem; color: #64748b; line-height: 1; margin-bottom: 2px; min-height: 10px; }
.est-barra {
    width: 100%; border-radius: 3px 3px 0 0; transition: opacity .15s ease;
    background: linear-gradient(180deg, #6366f1, #4f46e5);
}
.est-barra-col:hover .est-barra { opacity: .75; }
.est-barra-fecha { font-size: .55rem; color: #94a3b8; margin-top: 4px; white-space: nowrap; }
.est-grafico .est-barra-col:nth-child(even) .est-barra-fecha { visibility: hidden; }
.est-grafico-leyenda { margin: 10px 0 0; font-size: .8rem; color: #64748b; }

/* ── Responsive ─────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { width: 100%; position: relative; flex-direction: row; overflow-x: auto; padding: 12px; }
    .sidebar-brand { border: none; padding: 0 12px 0 0; margin: 0; white-space: nowrap; }
    .sidebar a { white-space: nowrap; }
    .sidebar-footer { display: none; }
    .main { margin-left: 0; padding: 20px; }
    .layout { flex-direction: column; }
}
