/* ═══════════════════════════════════════════════════════════════════════════
   app.css — Estilos globales de Asistiendo
   Consolidado desde header.php, footer.php y componentes compartidos
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Base ─────────────────────────────────────────────────────────────── */
body {
    font-family: 'Montserrat', sans-serif;
    background-color: #f5f7fa;
    color: #212529;
}

/* ── Navbar ───────────────────────────────────────────────────────────── */
.navbar {
    background: #ffffff !important;
    border-bottom: 1px solid #e9ecef;
    box-shadow: 0 1px 8px rgba(0,0,0,.06);
    padding: .55rem 1rem;
    margin-bottom: 0;
}
.navbar-brand img { max-height: 44px; width: auto; }

/* Quick-links admin (solo desktop) */
.admin-nav-links {
    display: flex;
    gap: .15rem;
    align-items: center;
}
.admin-nav-links .anl {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .78rem;
    font-weight: 600;
    color: #495057;
    padding: .35rem .7rem;
    border-radius: 7px;
    text-decoration: none;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.admin-nav-links .anl:hover {
    background: #f1f3f5;
    color: #0d6efd;
}
.admin-nav-links .anl i { font-size: .8rem; }

/* Separador vertical */
.nav-vr {
    width: 1px;
    height: 22px;
    background: #dee2e6;
    margin: 0 .4rem;
}

/* ── Main container ───────────────────────────────────────────────────── */
.main-content {
    padding-top: 1.75rem;
    padding-bottom: 4.5rem;
    min-height: calc(100vh - 140px);
}

/* ── Page title bar ───────────────────────────────────────────────────── */
.page-header {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.1rem 1.4rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
    border-left: 4px solid #0d6efd;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
}
.page-header h2,
.page-header h4 { margin: 0; font-weight: 700; }
.page-header .text-muted { font-size: .85rem; margin-top: .1rem; }

/* ── Admin section headers ────────────────────────────────────────────── */
.section-title {
    display: flex;
    align-items: center;
    gap: .55rem;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #868e96;
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-bottom: .55rem;
    border-bottom: 2px solid #e9ecef;
}
.section-title i { font-size: .85rem; }

/* ── Cards ────────────────────────────────────────────────────────────── */
.card {
    border: 1px solid #e9ecef;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
    transition: box-shadow .2s ease;
}
.card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,.09);
}
.card-header {
    border-radius: 11px 11px 0 0 !important;
    font-weight: 600;
}

/* Admin action cards */
.admin-card {
    border-top: 3px solid transparent;
    text-align: center;
}
.admin-card .card-icon {
    font-size: 2.2rem;
    display: block;
    margin-bottom: .6rem;
}
.admin-card .card-title { font-size: .95rem; font-weight: 700; }
.admin-card .card-text  { font-size: .82rem; color: #6c757d; }
.admin-card .card-body  { padding: 1.4rem 1.1rem; }

/* ── Tables ───────────────────────────────────────────────────────────── */
.table {
    font-size: .875rem;
    border-collapse: separate;
    border-spacing: 0;
}
.table thead th {
    background: #f8f9fa;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #6c757d;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
    padding: .7rem .85rem;
}
.table tbody td { padding: .65rem .85rem; vertical-align: middle; }
.table tbody tr:hover { background-color: rgba(13,110,253,.03); }
.table-responsive { border-radius: 0 0 10px 10px; }

/* ── Table toolbar & search (tableUtils.js) ──────────────────────────── */
[data-tbl-wrap] {
    position: relative;
}
.tbl-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .6rem 1rem;
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    flex-wrap: wrap;
}
[data-tbl-wrap]:not(.card *) > .tbl-toolbar:first-child {
    border-top: 1px solid #e9ecef;
    border-radius: 10px 10px 0 0;
}
.tbl-search-box {
    position: relative;
    flex: 1;
    max-width: 280px;
}
.tbl-search-icon {
    position: absolute;
    left: .65rem;
    top: 50%;
    transform: translateY(-50%);
    color: #adb5bd;
    font-size: .75rem;
    pointer-events: none;
}
.tbl-search-input {
    width: 100%;
    padding: .32rem .75rem .32rem 2rem;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: .84rem;
    font-family: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    background: #fafafa;
}
.tbl-search-input:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 .18rem rgba(13,110,253,.14);
    background: #fff;
}
.tbl-count-badge {
    font-size: .77rem;
    color: #868e96;
    white-space: nowrap;
}
.tbl-count-badge [data-tbl-count] {
    font-weight: 700;
    color: #495057;
}

/* Sort indicators */
thead th[data-col] {
    user-select: none;
    white-space: nowrap;
}
thead th[data-col]:hover { color: #0d6efd; }
thead th[data-sd="a"] .tbl-sort-ind,
thead th[data-sd="d"] .tbl-sort-ind { color: #0d6efd; font-weight: 900; }
.tbl-sort-ind { font-size: .72rem; opacity: .55; transition: opacity .1s; }
thead th[data-col]:hover .tbl-sort-ind { opacity: 1; }

/* ── Pagination (tableUtils.js) ───────────────────────────────────────── */
.tbl-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .55rem 1rem;
    background: #fff;
    border-top: 1px solid #e9ecef;
    font-size: .79rem;
    flex-wrap: wrap;
    gap: .5rem;
}
[data-tbl-wrap]:not(.card *) > .tbl-pager:last-child {
    border-bottom: 1px solid #e9ecef;
    border-radius: 0 0 10px 10px;
}
.tbl-pager-info { color: #868e96; }
.tbl-pager-btns {
    display: flex;
    gap: .2rem;
    align-items: center;
}
.tbl-page-btn {
    min-width: 30px;
    height: 28px;
    padding: 0 .45rem;
    border: 1px solid #dee2e6;
    background: #fff;
    border-radius: 6px;
    font-size: .77rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s, color .12s, border-color .12s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    color: #495057;
}
.tbl-page-btn:hover:not(:disabled) {
    background: #f1f3f5;
    border-color: #ced4da;
    color: #212529;
}
.tbl-page-btn.active {
    background: #0d6efd;
    color: #fff;
    border-color: #0d6efd;
}
.tbl-page-btn:disabled { opacity: .38; cursor: default; }

/* ── Badges ───────────────────────────────────────────────────────────── */
.badge {
    font-weight: 600;
    font-size: .72rem;
    letter-spacing: .02em;
    padding: .35em .65em;
}

/* ── Alerts ───────────────────────────────────────────────────────────── */
.alert {
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: .875rem;
}
.alert-warning { border-left: 4px solid #ffc107; }
.alert-danger  { border-left: 4px solid #dc3545; }
.alert-success { border-left: 4px solid #198754; }
.alert-info    { border-left: 4px solid #0dcaf0; }
.alert-primary { border-left: 4px solid #0d6efd; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
    border-radius: 8px;
    font-weight: 600;
    font-size: .855rem;
    padding: .42rem 1rem;
    transition: transform .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,.12); }
.btn-sm { font-size: .78rem; padding: .3rem .7rem; border-radius: 6px; }
.btn-lg { padding: .6rem 1.4rem; font-size: .95rem; }

/* ── Form controls ────────────────────────────────────────────────────── */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    font-size: .875rem;
    padding: .45rem .85rem;
}
.form-control:focus, .form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 .2rem rgba(13,110,253,.15);
}
.form-label { font-weight: 600; font-size: .82rem; color: #495057; margin-bottom: .3rem; }

/* ── Smart Select (Tom Select overrides) ───────────────────────────── */
.ts-wrapper.single .ts-control {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    font-size: .875rem;
    padding: .45rem .85rem;
    min-height: calc(1.5em + .9rem + 2px);
    background: #fff;
}
.ts-wrapper.single .ts-control:focus,
.ts-wrapper.single.focus .ts-control {
    border-color: #86b7fe;
    box-shadow: 0 0 0 .2rem rgba(13,110,253,.15);
}
.ts-dropdown {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
    font-size: .875rem;
    z-index: 10000 !important;
}
.ts-dropdown .option { padding: .4rem .85rem; }
.ts-dropdown .option.active {
    background-color: #e7f1ff;
    color: #0d6efd;
}
.modal .ts-wrapper.single .ts-control {
    font-size: .82rem;
    padding: .35rem .7rem;
}
.modal-body { overflow: visible !important; }
.modal-dialog { overflow: visible; }

/* ── Modals ───────────────────────────────────────────────────────────── */
.modal-content { border-radius: 14px; border: none; box-shadow: 0 16px 48px rgba(0,0,0,.18); }
.modal-header  { border-radius: 13px 13px 0 0; padding: 1rem 1.4rem; }
.modal-footer  { border-radius: 0 0 13px 13px; padding: .75rem 1.4rem; }

/* ── Back button helper ───────────────────────────────────────────────── */
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .8rem;
    color: #6c757d;
    text-decoration: none;
    padding: .3rem .6rem;
    border-radius: 6px;
    transition: background .15s, color .15s;
}
.btn-back:hover { background: #e9ecef; color: #212529; }

/* ── Misc ─────────────────────────────────────────────────────────────── */
hr { border-color: #e9ecef; opacity: 1; }

/* ═══════════════════════════════════════════════════════════════════════════
   Footer
   ═══════════════════════════════════════════════════════════════════════════ */
.footer-inst {
    background: #1e293b;
    border-top: 3px solid #7c1a1a;
    margin-top: auto;
}
.footer-inst .footer-label {
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255,255,255,.35);
    margin-bottom: .5rem;
}
.footer-inst .footer-text {
    font-size: .8rem;
    color: rgba(255,255,255,.5);
    margin-bottom: .25rem;
}
.footer-social {
    color: rgba(255,255,255,.45);
    text-decoration: none;
    font-size: 1.25rem;
    transition: color .2s, transform .2s;
    display: inline-block;
}
.footer-social:hover {
    color: #fff;
    transform: translateY(-2px);
}
.footer-bottom {
    background: rgba(0,0,0,.25);
    padding: .55rem 0;
    font-size: .73rem;
    color: rgba(255,255,255,.3);
    text-align: center;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Componentes compartidos (deduplicados de múltiples vistas)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Stat chip — usado en 6+ vistas */
.stat-chip {
    display: inline-flex; align-items: center; gap: .45rem;
    padding: .35rem .85rem; border-radius: 50px; font-size: .82rem; font-weight: 600;
}

/* Icon button — usado en formulario_create, persona_list */
.btn-icon {
    width: 30px; height: 30px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 6px;
}

/* Avatar circle — usado en dashboard, usuarios */
.avatar-circle {
    width: 36px; height: 36px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .85rem; flex-shrink: 0;
}

/* Origen badge — usado en asistencia_admin_panel */
.origen-badge { font-size: .75rem; }

/* Tabla personas — vertical-align (de persona_list) */
.table-personas td, .table-personas th { vertical-align: middle; }

/* ═══════════════════════════════════════════════════════════════
   Grilla — Distribución Áulica
   ═══════════════════════════════════════════════════════════════ */
.color-picker-wrapper {
    display: inline-flex; align-items: center; gap: .5rem;
}
.color-picker-wrapper input[type="color"] {
    width: 36px; height: 36px; border: 2px solid #dee2e6;
    border-radius: 8px; cursor: pointer; padding: 2px;
}
.drag-handle {
    cursor: grab; color: #ced4da; font-size: .9rem;
}
.drag-handle:active { cursor: grabbing; }
tr.dragging { opacity: .5; }
