@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ─── VARIABLES ─── */
:root {
    --sidebar-bg:    #2C3E49;
    --accent:        #0084BC;
    --accent-dark:   #006fa0;
    --accent-light:  rgba(0,132,188,0.12);
    --bg:            #DDE6EA;
    --white:         #ffffff;
    --text:          #1a2332;
    --text-muted:    #64748b;
    --border:        #e2eaee;
    --shadow-sm:     0 1px 4px rgba(44,62,73,0.08);
    --shadow:        0 4px 20px rgba(44,62,73,0.10);
    --shadow-lg:     0 8px 40px rgba(44,62,73,0.14);
    --sidebar-w:     252px;
    --topbar-h:      64px;
    --r:             10px;
    --r-sm:          7px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

/* ─── LAYOUT ─── */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ─── OVERLAY MOBILE ─── */
#sidebarOverlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 150;
}

#sidebarOverlay.visible { display: block; }

/* ═══════════════════════════════
   SIDEBAR
═══════════════════════════════ */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    overflow-y: auto;
    overflow-x: hidden;
}

/* scrollbar fino en sidebar */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

/* ── Logo ── */
.sidebar-logo {
    width: 100%;
    padding: 0 20px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-logo img {
    height: 97px !important;
    width: auto !important;
    max-width: 90%;
    display: block;
    margin: 18px auto 10px;
}

/* ── User badge ── */
.user-badge {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 20px 14px;
    flex-shrink: 0;
}

.user-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: 0.82rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.15);
}

.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-name {
    color: #fff;
    font-size: 0.855rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.user-role {
    color: rgba(255,255,255,0.45);
    font-size: 0.74rem;
    margin-top: 1px;
}

/* ── Divider ── */
.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 4px 16px;
    flex-shrink: 0;
}

/* ── Nav label ── */
.nav-section-label {
    padding: 14px 20px 6px;
    font-size: 0.68rem;
    font-weight: 600;
    color: rgba(255,255,255,0.3);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ── Nav items ── */
.sidebar-menu { padding: 6px 0; flex: 1; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: rgba(255,255,255,0.58);
    font-size: 0.875rem;
    font-weight: 450;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
    cursor: pointer;
    white-space: nowrap;
}

.nav-item:hover {
    color: rgba(255,255,255,0.92);
    background: rgba(255,255,255,0.06);
}

.nav-item.active {
    color: #fff;
    background: rgba(0,132,188,0.20);
    border-left-color: var(--accent);
    font-weight: 500;
}

/* Fix global: iconos SVG outline en botones y nav */
button svg[fill="none"],
a svg[fill="none"] { stroke: currentColor; }

.nav-item svg {
    flex-shrink: 0;
    stroke: currentColor;
    opacity: 0.85;
}
.nav-item.active svg { opacity: 1; }

.sidebar-spacer { flex: 1; min-height: 16px; }

/* ── Bottom ── */
.sidebar-bottom { padding: 6px 0 18px; flex-shrink: 0; }

.nav-item.nav-logout { color: rgba(248,113,113,0.65); }
.nav-item.nav-logout:hover {
    color: #f87171;
    background: rgba(248,113,113,0.08);
    border-left-color: transparent;
}

/* ═══════════════════════════════
   MAIN CONTENT
═══════════════════════════════ */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ─── TOPBAR ─── */
.topbar {
    height: var(--topbar-h);
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 20px; }

.sidebar-toggle {
    display: none;
    background: none; border: none;
    cursor: pointer; padding: 7px;
    color: var(--text-muted);
    border-radius: var(--r-sm);
    transition: background 0.15s;
}
.sidebar-toggle:hover { background: var(--bg); }

.page-title { font-size: 1.05rem; font-weight: 600; color: var(--text); }

.topbar-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.topbar-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: 0.78rem;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--accent-light);
    cursor: pointer;
}

/* ─── PAGE CONTENT ─── */
.page-content {
    padding: 28px;
    flex: 1;
}

/* ─── CARDS ─── */
.card {
    background: var(--white);
    border-radius: var(--r);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.card-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ─── STAT CARDS ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--r);
    padding: 22px 24px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 18px;
    transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-lg); }

.stat-icon {
    width: 52px; height: 52px;
    border-radius: var(--r);
    background: var(--accent-light);
    display: flex; align-items: center; justify-content: center;
    color: var(--accent);
    flex-shrink: 0;
}

.stat-value {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
    letter-spacing: -0.02em;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ─── TABLE ─── */
.table-wrapper { overflow-x: auto; border-radius: var(--r-sm); }

table { width: 100%; border-collapse: collapse; }

thead th {
    background: var(--bg);
    padding: 11px 16px;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    white-space: nowrap;
}

thead th:first-child { border-radius: var(--r-sm) 0 0 0; }
thead th:last-child  { border-radius: 0 var(--r-sm) 0 0; }

tbody td {
    padding: 14px 16px;
    font-size: 0.875rem;
    border-bottom: 1px solid #f0f5f8;
    color: var(--text);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f6fbfd; }

/* ─── BUTTONS ─── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--r-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.15s ease;
    font-family: inherit;
    line-height: 1;
    white-space: nowrap;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }

.btn-secondary,
.btn-outline {
    background: var(--white);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover,
.btn-outline:hover { background: var(--bg); }

.btn-danger { background: #fee2e2; color: #dc2626; }
.btn-danger:hover { background: #fecaca; }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* ─── FORMS ─── */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}

.form-control,
.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    font-size: 0.875rem;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
    appearance: none;
}

.form-control:focus,
.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,132,188,0.13);
}

.form-control::placeholder,
.form-input::placeholder { color: #aab4be; }

select.form-control,
select.form-input { cursor: pointer; }

/* ─── BADGES ─── */
.badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.73rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger  { background: #fee2e2; color: #dc2626; }
.badge-info    { background: var(--accent-light); color: var(--accent); }
.badge-gray    { background: #f1f5f9; color: #64748b; }

/* ─── ALERTS ─── */
.alert {
    padding: 13px 16px;
    border-radius: var(--r-sm);
    font-size: 0.875rem;
    margin-bottom: 18px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.alert-danger  { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; }
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.alert-info    { background: var(--accent-light); color: var(--accent); border: 1px solid rgba(0,132,188,0.2); }

/* ─── EMPTY STATE ─── */
.empty-state {
    text-align: center;
    padding: 56px 24px;
    color: var(--text-muted);
}
.empty-state svg { margin: 0 auto 16px; opacity: 0.35; }
.empty-state h3 { font-size: 1rem; font-weight: 600; margin-bottom: 6px; }
.empty-state p { font-size: 0.875rem; }

/* ─── PAGE HEADER ─── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h2 { font-size: 1.3rem; font-weight: 700; color: var(--text); }
.page-header p  { font-size: 0.85rem; color: var(--text-muted); margin-top: 3px; }

/* ─── AVATAR CIRCLE ─── */
.avatar-circle {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ══════════════════════════════════
   LOGIN PAGE
══════════════════════════════════ */
.login-page {
    min-height: 100vh;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-wrap {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 44px 40px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 8px;
}

.login-brand h1 { font-size: 1.5rem; color: var(--text); letter-spacing: -0.02em; }
.login-brand h1 strong { color: var(--accent); }

.login-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 30px;
}

.login-card .btn-primary {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 0.9rem;
}

.login-footer {
    margin-top: 22px;
    text-align: center;
    font-size: 0.77rem;
    color: var(--text-muted);
}

/* ─── MODAL ─── */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1000;
    padding: 24px;
    overflow-y: auto;
    justify-content: center;
    align-items: flex-start;
}
.modal-overlay.is-open {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: var(--r);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 530px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    animation: modalIn 0.18s ease;
    margin: auto;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96) translateY(-6px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1rem; font-weight: 600; }

.modal-close {
    background: none; border: none;
    width: 32px; height: 32px;
    border-radius: var(--r-sm);
    font-size: 1.4rem; line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
    font-family: inherit;
}
.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-body { padding: 22px 24px 24px; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
    padding: 18px 24px 20px;
    border-top: 1px solid var(--border);
}

/* ─── MODAL INTRO ─── */
.modal-intro {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* ─── OPTION CARDS ─── */
.option-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.option-card {
    border: 2px solid var(--border);
    border-radius: var(--r);
    padding: 18px 16px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.option-card:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}
.option-card-soon {
    opacity: 0.55;
    cursor: not-allowed;
}
.option-card-soon:hover {
    border-color: var(--border);
    background: none;
}

.option-card-icon {
    width: 42px; height: 42px;
    border-radius: var(--r-sm);
    background: var(--accent-light);
    color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}
.option-card:not(.option-card-soon):hover .option-card-icon {
    background: var(--accent);
    color: #fff;
}

.option-card strong {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    display: block;
}
.option-card span {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ─── BACK BUTTON ─── */
.btn-back {
    background: none; border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    margin-bottom: 18px;
    font-family: inherit;
    transition: color 0.15s;
}
.btn-back:hover { color: var(--text); }

/* ─── FORM CHECK ─── */
.form-checks { margin-bottom: 4px; }

.form-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    cursor: pointer;
}
.form-check input[type="checkbox"] {
    width: 17px; height: 17px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--accent);
    cursor: pointer;
}
.form-check span {
    font-size: 0.875rem;
    color: var(--text);
    line-height: 1.45;
}

/* ──────────────────────────────────
   RESPONSIVE
────────────────────────────────── */
/* ─── PAGINACIÓN ─── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-top: 1px solid var(--border);
    gap: 12px;
    flex-wrap: wrap;
    background: var(--white);
}
.pagination-info {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    font-weight: 500;
}
.pagination-controls {
    display: flex;
    align-items: center;
    gap: 3px;
}
.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
    line-height: 1;
}
.page-btn:hover:not(:disabled):not(.active) { background: var(--accent-light); color: var(--accent); }
.page-btn.active { background: var(--accent); color: #fff; cursor: default; font-weight: 600; }
.page-btn:disabled { opacity: 0.25; cursor: not-allowed; }
.page-btn-dots { background: none; cursor: default; color: #cbd5e1; min-width: 24px; padding: 0; font-size: 1rem; letter-spacing: 1px; }
.page-btn-dots:hover { background: none; color: #cbd5e1; }

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .sidebar-toggle { display: flex; }
    .page-content { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
    .topbar { padding: 0 16px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .login-card { padding: 32px 24px; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .option-cards { grid-template-columns: 1fr; }
    .modal-overlay { padding: 12px; }
    .modal-body { padding: 18px 16px 20px; }
    .modal-header { padding: 16px 16px 14px; }
}
