/* ── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f1f5f9;
    color: #1e293b;
    display: flex;
    min-height: 100vh;
}
a { color: #6366f1; text-decoration: none; }
a:hover { color: #4f46e5; }
code { background: #e2e8f0; padding: 2px 7px; border-radius: 4px; font-size: .85rem; }

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
    width: 260px;
    min-height: 100vh;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform .3s;
}
.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-header i { font-size: 1.5rem; color: #818cf8; }
.sidebar-nav { flex: 1; padding: 16px 0; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: #94a3b8;
    font-size: .95rem;
    font-weight: 500;
    transition: all .15s;
    border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #e2e8f0; }
.nav-item.active { background: rgba(99,102,241,.12); color: #a5b4fc; border-left-color: #6366f1; }
.nav-item i { width: 20px; text-align: center; font-size: 1rem; }
.sidebar-footer { padding: 16px 24px; border-top: 1px solid rgba(255,255,255,.06); font-size: .75rem; color: #475569; }

/* ── Main Content ──────────────────────────────────────── */
.main-content { margin-left: 260px; flex: 1; min-height: 100vh; }
.topbar {
    background: #fff;
    padding: 18px 32px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0; z-index: 50;
}
.menu-toggle { display: none; background: none; border: none; font-size: 1.3rem; cursor: pointer; color: #475569; }
.page-title { font-size: 1.4rem; font-weight: 700; color: #0f172a; }
.content { padding: 28px 32px; }

/* ── Flash Messages ────────────────────────────────────── */
.flash-container { padding: 12px 32px 0; }
.flash {
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .9rem;
    font-weight: 500;
    animation: flashIn .3s ease;
}
@keyframes flashIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.flash-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.flash-close { margin-left: auto; background: none; border: none; font-size: 1.2rem; cursor: pointer; color: inherit; opacity: .6; }
.flash-close:hover { opacity: 1; }

/* ── Stats Grid ────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 28px; }
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    border: 1px solid #e2e8f0;
}
.stat-icon { width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; color: #fff; }
.bg-indigo { background: linear-gradient(135deg, #6366f1, #818cf8); }
.bg-green  { background: linear-gradient(135deg, #22c55e, #4ade80); }
.bg-blue   { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.bg-amber  { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.stat-value { font-size: 1.7rem; font-weight: 800; color: #0f172a; display: block; }
.stat-label { font-size: .85rem; color: #64748b; }

/* ── Cards ─────────────────────────────────────────────── */
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    border: 1px solid #e2e8f0;
    margin-bottom: 24px;
    overflow: hidden;
}
.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h2 { font-size: 1.05rem; font-weight: 700; color: #0f172a; display: flex; align-items: center; gap: 10px; }
.card-header h2 i { color: #6366f1; font-size: .95rem; }
.card-body { padding: 24px; }
.card-body.no-padding { padding: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* ── Forms ─────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; flex: 1; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; color: #374151; margin-bottom: 6px; }
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: .9rem;
    color: #1e293b;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.form-control-sm {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: .82rem;
    background: #fff;
    cursor: pointer;
}
.form-row { display: flex; gap: 16px; }
.form-hint { display: block; font-size: .78rem; color: #94a3b8; margin-top: 4px; }
.inline-form { display: inline; }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
}
.btn-primary { background: #6366f1; color: #fff; }
.btn-primary:hover { background: #4f46e5; color: #fff; }
.btn-outline { background: transparent; border: 1px solid #d1d5db; color: #374151; padding: 8px 16px; }
.btn-outline:hover { background: #f8fafc; border-color: #9ca3af; color: #374151; }
.btn-sm { padding: 6px 14px; font-size: .82rem; }
.btn-xs { padding: 5px 8px; font-size: .8rem; border-radius: 6px; }
.btn-ghost { background: transparent; color: #64748b; }
.btn-ghost:hover { background: #f1f5f9; color: #6366f1; }
.btn-danger-ghost { background: transparent; color: #94a3b8; }
.btn-danger-ghost:hover { background: #fef2f2; color: #ef4444; }

/* ── Status Badge ──────────────────────────────────────── */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all .15s;
}
.status-badge.active { background: #dcfce7; color: #166534; }
.status-badge.active:hover { background: #bbf7d0; }
.status-badge.inactive { background: #f1f5f9; color: #94a3b8; }
.status-badge.inactive:hover { background: #e2e8f0; color: #64748b; }

/* ── Admin Table ───────────────────────────────────────── */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table thead th {
    padding: 12px 18px;
    text-align: left;
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
.admin-table tbody td {
    padding: 14px 18px;
    border-bottom: 1px solid #f1f5f9;
    font-size: .9rem;
    vertical-align: middle;
}
.admin-table tbody tr:hover { background: #f8fafc; }
.row-inactive { opacity: .5; }
.font-medium { font-weight: 600; }
.text-muted { color: #94a3b8; font-size: .82rem; }
.action-btns { display: flex; gap: 4px; align-items: center; }

/* ── Item List (Dashboard) ─────────────────────────────── */
.item-list { display: flex; flex-direction: column; }
.item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}
.item-row:last-child { border-bottom: none; }
.item-name { font-weight: 600; font-size: .92rem; display: block; }
.item-meta { font-size: .8rem; color: #94a3b8; }
.item-actions { display: flex; gap: 4px; }
.empty-text { color: #94a3b8; font-size: .9rem; text-align: center; padding: 16px; }

/* ── Modal ─────────────────────────────────────────────── */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal.show { display: flex; }
.modal-content {
    background: #fff;
    border-radius: 16px;
    width: 400px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: scale(1); } }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid #f1f5f9;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-header button { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #94a3b8; }

/* ── Toast ─────────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
    background: #0f172a;
    color: #fff;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: .88rem;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
    animation: toastIn .3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ── Toggle Label (checkbox) ────────────────────────────── */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: .9rem;
    font-weight: 500;
    color: #374151;
    padding: 10px 0;
}
.toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #6366f1;
    cursor: pointer;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 1024px) {
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: block; }
    .form-row { flex-direction: column; gap: 0; }
    .content { padding: 20px 16px; }
    .topbar { padding: 14px 16px; }
    .admin-table { display: block; overflow-x: auto; }
}
