/*
|--------------------------------------------------------------------------
| Panel de administración — Sabores del Desierto
|--------------------------------------------------------------------------
| CSS estático sin dependencias (deploy en hosting compartido sin build).
| Paleta minimalista: azules clínicos sobre superficies blancas y fondo
| gris suave, tipografía Figtree, radios suaves y sombras sutiles.
*/

:root {
    --primary: #0F52BA;
    --primary-hover: #0C4399;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;

    --bg: #F8FAFC;
    --surface: #FFFFFF;
    --text: #1E293B;
    --text-muted: #64748B;
    --border: #E2E8F0;
    --border-soft: #F1F5F9;

    --radius: 0.75rem;
    --radius-lg: 1rem;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(15, 82, 186, 0.12), 0 2px 4px -2px rgba(15, 82, 186, 0.12);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Figtree', ui-sans-serif, system-ui, sans-serif;
    font-size: 0.875rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

.mono, .mono-link { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 0.8125rem; }

/* ── Topbar ─────────────────────────────────────────────────────────── */

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0.65rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--text); }
.logo:hover { color: var(--text); }

.logo-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius);
    background: var(--primary);
    color: #fff;
    flex-shrink: 0;
}

.logo-tile-lg { width: 3rem; height: 3rem; border-radius: var(--radius-lg); }

.logo-text { font-weight: 700; font-size: 1rem; letter-spacing: -0.01em; }
.logo-text em { font-style: normal; color: var(--primary); }
.logo-text-lg { font-size: 1.25rem; }

.status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    background: var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.topbar-nav { display: flex; align-items: center; gap: 0.25rem; }

.nav-link {
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius);
    color: var(--text-muted, #64748b);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
}

.nav-link:hover { color: var(--text); background: #F1F5F9; }
.nav-link.active { color: var(--primary); background: #EFF6FF; }

.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }

.user-chip {
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    background: #EFF6FF;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.75rem;
}

/* ── Layout ─────────────────────────────────────────────────────────── */

.main { max-width: 1440px; margin: 0 auto; padding: 1.5rem; }

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.page-title { margin: 0; font-size: 1.375rem; font-weight: 800; letter-spacing: -0.02em; }
.page-subtitle { margin: 0.2rem 0 0; color: var(--text-muted); font-size: 0.8125rem; }

.back-link { font-size: 0.8125rem; color: var(--text-muted); display: inline-block; margin-bottom: 0.35rem; }
.back-link:hover { color: var(--primary); }

.detail-head-actions { display: flex; align-items: center; gap: 0.75rem; }

.hint {
    margin: -0.5rem 0 1rem;
    padding: 0.6rem 0.9rem;
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    border-radius: var(--radius);
    color: #92400E;
    font-size: 0.8125rem;
}

/* ── Tarjetas ───────────────────────────────────────────────────────── */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
}

.card-filters { padding: 1rem 1.25rem; margin-bottom: 1rem; }

.card-table { overflow: hidden; margin-bottom: 1.5rem; }

.card-section { padding: 1.25rem 1.5rem; margin-bottom: 1rem; }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; }

.section-title { margin: 0 0 0.9rem; font-size: 1rem; font-weight: 700; }
.section-subtitle { margin: 1.25rem 0 0.5rem; font-size: 0.8125rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }

/* ── Login (guest) ──────────────────────────────────────────────────── */

.guest-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.card-login {
    width: 100%;
    max-width: 26rem;
    padding: 2rem;
    margin-top: 1.25rem;
    box-shadow: var(--shadow-md);
}

.card-title { margin: 0; font-size: 1.125rem; font-weight: 800; letter-spacing: -0.01em; }
.card-subtitle { margin: 0.3rem 0 1.25rem; color: var(--text-muted); font-size: 0.8125rem; }

.guest-footer { margin-top: 2rem; color: var(--text-muted); font-size: 0.75rem; text-align: center; }

/* ── Formularios ────────────────────────────────────────────────────── */

.form { display: flex; flex-direction: column; gap: 1rem; }

.form-group { display: flex; flex-direction: column; gap: 0.3rem; }

.form-group label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); }

input[type="text"], input[type="email"], input[type="password"], input[type="date"], select {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 82, 186, 0.12);
}

input::placeholder { color: #94A3B8; }

.filters {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
    gap: 0.75rem;
    align-items: end;
}

.filter-actions { display: flex; gap: 0.5rem; }

.checkbox { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem; color: var(--text-muted); }
.checkbox input { width: auto; }

/* ── Botones ────────────────────────────────────────────────────────── */

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: background 0.15s, transform 0.05s;
}

.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-primary:active { transform: scale(0.99); }

.btn-block { width: 100%; }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem;
    border: none;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.btn-ghost:hover { background: var(--border-soft); color: var(--text); }

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius);
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
}

.btn-icon:hover { background: #EFF6FF; color: var(--primary); }

/* ── Tablas ─────────────────────────────────────────────────────────── */

.table-meta { padding: 0.75rem 1.25rem; color: var(--text-muted); font-size: 0.75rem; border-bottom: 1px solid var(--border-soft); }

.table-scroll { overflow-x: auto; }

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

.table th {
    padding: 0.8rem 1.25rem;
    text-align: left;
    background: var(--border-soft);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.table td { padding: 0.7rem 1.25rem; border-top: 1px solid var(--border-soft); white-space: nowrap; }
.table tbody tr { transition: background 0.1s; }
.table tbody tr:hover { background: #FAFBFD; }

.table-inner th, .table-inner td { padding: 0.5rem 0.75rem; }
.table-inner th { font-size: 0.65rem; }

.table-action { text-align: right; width: 1%; }

.empty-row { text-align: center; color: var(--text-muted); padding: 2.5rem 1rem !important; }

/* ── Badges de estado ───────────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: 9999px;
    border: 1px solid;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-lg { font-size: 0.8125rem; padding: 0.3rem 0.9rem; }

.badge-pendiente { background: #F1F5F9; color: #475569; border-color: #E2E8F0; }
.badge-procesando { background: #FFFBEB; color: #B45309; border-color: #FDE68A; }
.badge-procesado { background: #ECFDF5; color: #047857; border-color: #A7F3D0; }
.badge-error { background: #FEF2F2; color: #B91C1C; border-color: #FECACA; }

/* ── Detalle ────────────────────────────────────────────────────────── */

.detail-list { margin: 0; display: grid; grid-template-columns: 1fr; gap: 0.6rem; }
.detail-list.two-col { grid-template-columns: repeat(2, 1fr); }

.detail-list > div { display: flex; flex-direction: column; gap: 0.1rem; }
.detail-list dt { font-size: 0.7rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.detail-list dd { margin: 0; font-weight: 500; }

.code {
    margin: 0;
    padding: 1rem;
    background: #0F172A;
    color: #E2E8F0;
    border-radius: var(--radius);
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.75rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.code-error { background: #FEF2F2; color: #991B1B; }

/* ── Flash / errores ────────────────────────────────────────────────── */

.flash { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.8125rem; border: 1px solid; }
.flash ul { margin: 0; padding-left: 1.1rem; }

.flash-success { background: #ECFDF5; color: #047857; border-color: #A7F3D0; }
.flash-error { background: #FEF2F2; color: #B91C1C; border-color: #FECACA; }

/* ── Paginación ─────────────────────────────────────────────────────── */

.pagination { display: flex; gap: 0.35rem; padding: 0.9rem 1.25rem; border-top: 1px solid var(--border-soft); flex-wrap: wrap; }

.page-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

a.page-item:hover { background: #EFF6FF; color: var(--primary); }

.page-item.active { background: var(--primary); color: #fff; font-weight: 600; box-shadow: var(--shadow-md); }
.page-item.disabled { opacity: 0.4; }

/* ── Responsive ─────────────────────────────────────────────────────── */

@media (max-width: 900px) {
    .filters { grid-template-columns: repeat(2, 1fr); }
    .filter-actions { grid-column: span 2; }
}

@media (max-width: 600px) {
    .topbar-inner { padding: 0.65rem 1rem; }
    .user-chip { display: none; }
    .main { padding: 1rem; }
    .detail-list.two-col { grid-template-columns: 1fr; }
}
