/* ============================================================
   app.css — gastrocore v3 — rediseño visual agresivo
   ============================================================ */

:root {
    --sidebar-width: 224px;
    --primary:       #2563eb;
    --primary-dark:  #1d4ed8;
    --primary-light: #eff6ff;
    --body-bg:       #f1f5f9;
    --card-bg:       #ffffff;
    --border:        #e2e8f0;
    --text:          #0f172a;
    --text-muted:    #94a3b8;
    --text-sec:      #64748b;
    --sidebar-bg:    #0f172a;
    --radius:        14px;
    --radius-sm:     9px;
    --shadow-card:   0 1px 3px rgba(15,23,42,.06), 0 4px 12px rgba(15,23,42,.04);
    --shadow-hover:  0 4px 20px rgba(15,23,42,.10);
    --tr:            .15s ease;
}

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

html { scroll-behavior: smooth; }

body {
    background: var(--body-bg);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 13.5px;
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT ─────────────────────────────────────────── */
.wrapper { min-height: 100vh; display: flex; }
.main-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
main { padding: 24px; flex: 1; }

/* ── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
    scrollbar-width: none;
    border-right: 1px solid #1e293b;
}
.sidebar::-webkit-scrollbar { display: none; }

/* brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    padding: 20px 16px 16px;
    border-bottom: 1px solid #1e293b;
    margin-bottom: 8px;
}
.sidebar-brand img {
    height: 30px;
    filter: brightness(0) invert(1);
    opacity: .9;
}
.brand-text {
    font-size: 17px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -.5px;
}
.brand-text span { color: #60a5fa; }

/* nav links */
.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    margin: 1px 8px;
    border-radius: 8px;
    font-size: 13px;
    color: #94a3b8;
    text-decoration: none;
    transition: background var(--tr), color var(--tr);
    white-space: nowrap;
}
.sidebar .nav-link i { font-size: 15px; width: 18px; flex-shrink: 0; }
.sidebar .nav-link:hover { background: #1e293b; color: #e2e8f0; }
.sidebar .nav-link.active {
    background: #1e3a5f;
    color: #60a5fa;
    font-weight: 600;
}
.sidebar .nav-link.active i { color: #3b82f6; }

/* heading */
.sidebar-heading {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #334155;
    padding: 12px 20px 4px;
}

/* user footer */
.sidebar-user {
    margin-top: auto;
    padding: 12px 16px;
    border-top: 1px solid #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-user a { text-decoration: none; }

/* ── AVATAR ──────────────────────────────────────────── */
.avatar-sm {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; flex-shrink: 0;
}

/* ── TOPBAR ──────────────────────────────────────────── */
.topbar {
    height: 56px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 0 rgba(15,23,42,.06);
}
.topbar h5 {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--text) !important;
    letter-spacing: -.2px;
}
#sidebarToggle {
    background: none; border: none; cursor: pointer;
    color: var(--text-sec); padding: 6px; border-radius: 8px;
    line-height: 1; transition: background var(--tr);
}
#sidebarToggle:hover { background: var(--body-bg); }

/* ── STAT CARDS ──────────────────────────────────────── */
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    height: 100%;
    position: relative;
    overflow: hidden;
    transition: box-shadow var(--tr), transform var(--tr);
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), #7c3aed);
    opacity: 0;
    transition: opacity var(--tr);
}
.stat-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.stat-card:hover::before { opacity: 1; }

.stat-card .stat-icon {
    width: 44px; height: 44px;
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    margin-bottom: 14px;
}
.stat-card .stat-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.1;
    letter-spacing: -.5px;
}
.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
}

/* ── TABLE CARDS ─────────────────────────────────────── */
.table-card {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}
.table-card .table-card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    color: var(--text);
    background: #fff;
}

/* ── TABLAS ──────────────────────────────────────────── */
.table { margin-bottom: 0; font-size: 13px; color: var(--text); }
.table thead th {
    background: #f8fafc !important;
    font-weight: 700 !important;
    font-size: 10.5px !important;
    text-transform: uppercase !important;
    letter-spacing: .7px !important;
    color: var(--text-muted) !important;
    border-bottom: 1px solid var(--border) !important;
    padding: 10px 16px !important;
    white-space: nowrap;
}
.table tbody td { padding: 10px 16px; vertical-align: middle; border-color: #f1f5f9; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-hover tbody tr { transition: background var(--tr); }
.table-hover tbody tr:hover { background: #f8fafc !important; }

/* ── BADGES ──────────────────────────────────────────── */
.badge-verde    { display:inline-flex;align-items:center;background:#dcfce7;color:#15803d;border-radius:6px;padding:3px 9px;font-size:11px;font-weight:700; }
.badge-amarillo { display:inline-flex;align-items:center;background:#fef9c3;color:#a16207;border-radius:6px;padding:3px 9px;font-size:11px;font-weight:700; }
.badge-rojo     { display:inline-flex;align-items:center;background:#fee2e2;color:#b91c1c;border-radius:6px;padding:3px 9px;font-size:11px;font-weight:700; }
.badge-azul     { display:inline-flex;align-items:center;background:#dbeafe;color:#1d4ed8;border-radius:6px;padding:3px 9px;font-size:11px;font-weight:700; }

/* ── BOTONES ─────────────────────────────────────────── */
.btn { border-radius: var(--radius-sm) !important; font-size: 13px; font-weight: 500; }
.btn-sm { font-size: 12px !important; padding: 4px 10px !important; }
.btn-primary {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 1px 3px rgba(37,99,235,.3);
}
.btn-primary:hover,
.btn-primary:focus {
    background: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
    box-shadow: 0 4px 12px rgba(37,99,235,.35);
}
.btn-success { box-shadow: 0 1px 3px rgba(22,163,74,.25); }
.btn-danger  { box-shadow: 0 1px 3px rgba(220,38,38,.25); }

/* ── FORMULARIOS ─────────────────────────────────────── */
.form-control,
.form-select {
    border-radius: var(--radius-sm) !important;
    font-size: 13.5px !important;
    border-color: #cbd5e1 !important;
    color: var(--text) !important;
    background: #f8fafc !important;
    transition: border-color var(--tr), box-shadow var(--tr), background var(--tr);
}
.form-control:focus,
.form-select:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(37,99,235,.12) !important;
    background: #fff !important;
}
.form-label {
    font-weight: 600 !important;
    font-size: 12px !important;
    color: var(--text-sec) !important;
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: 6px !important;
}
.input-group-text {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: var(--text-sec) !important;
    font-size: 13px !important;
}

/* ── ALERTS ──────────────────────────────────────────── */
.alert {
    border-radius: var(--radius-sm) !important;
    font-size: 13px !important;
    border-width: 1px !important;
}
.alert-success { background: #f0fdf4 !important; border-color: #86efac !important; color: #166534 !important; }
.alert-danger  { background: #fff5f5 !important; border-color: #fca5a5 !important; color: #991b1b !important; }
.alert-info    { background: #eff6ff !important; border-color: #93c5fd !important; color: #1e40af !important; }
.alert-warning { background: #fffbeb !important; border-color: #fcd34d !important; color: #92400e !important; }

/* ── PROGRESS ────────────────────────────────────────── */
.progress { border-radius: 99px !important; background: #e2e8f0 !important; }
.progress-bar { border-radius: 99px !important; transition: width .4s ease; }

/* ── LOGIN ───────────────────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #0a0e1a 0%, #0f172a 60%, #0c1a3d 100%);
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
    background: #fff;
    border-radius: 18px;
    padding: 44px 40px;
    width: 100%; max-width: 400px;
    box-shadow: 0 32px 80px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.04);
}

/* ── SIDEBAR OVERLAY ─────────────────────────────────── */
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.55); z-index: 199;
    backdrop-filter: blur(3px);
}
.sidebar-overlay.show { display: block; }

/* ── SCROLL TO TOP ───────────────────────────────────── */
.btn-scroll-top {
    position: fixed; bottom: 22px; right: 22px;
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--primary); color: #fff; border: none;
    cursor: pointer; display: none; align-items: center;
    justify-content: center; box-shadow: var(--shadow-hover);
    z-index: 500; font-size: 16px;
    transition: transform var(--tr), background var(--tr);
}
.btn-scroll-top.show { display: flex; }
.btn-scroll-top:hover { transform: translateY(-2px); background: var(--primary-dark); }

/* ── AVISO SUPERADMIN ────────────────────────────────── */
.superadmin-bar {
    background: linear-gradient(90deg, #fef3c7, #fde68a);
    border-bottom: 1px solid #fbbf24;
    padding: 8px 24px;
    font-size: 12.5px;
    color: #78350f;
    display: flex; align-items: center; justify-content: space-between;
}

/* ── FOOTER ──────────────────────────────────────────── */
footer { font-size: 11.5px; color: #cbd5e1; padding: 16px 24px; }

/* ── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        position: fixed; z-index: 200;
        transform: translateX(-100%);
        transition: transform .26s cubic-bezier(.4,0,.2,1);
    }
    .sidebar.show { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.4); }
    main { padding: 14px 12px; }
    .stat-card { padding: 14px; }
    .stat-card .stat-value { font-size: 17px; }
    .stat-card .stat-icon { width: 36px; height: 36px; font-size: 16px; margin-bottom: 10px; }
    .table thead th { padding: 8px 10px !important; }
    .table tbody td { padding: 8px 10px; }
    .topbar { padding: 0 14px; }
    .login-card { padding: 30px 20px; }
}
@media (max-width: 480px) {
    main { padding: 10px 8px; }
    .stat-card { padding: 12px; }
    .stat-card .stat-value { font-size: 15px; letter-spacing: -.3px; }
}
