/*
 * The central admin panel (routes/admin.php). Deliberately plain and
 * standalone — no Vite build, no per-site theming — since it serves every
 * site from one hostname.
 */

:root {
    --bg: #f4f5f7;
    --surface: #fff;
    --text: #1f2328;
    --muted: #6a737d;
    --border: #dfe2e6;
    --accent: #2f6fdb;
    --accent-dark: #2459b3;
    --danger: #c9372c;
    --success: #1f883d;
    --warning: #9a6700;
    --radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
}

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

body { margin: 0; background: var(--bg); }

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

h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 0.75rem; }

code { background: var(--bg); padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.9em; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.muted { color: var(--muted); font-size: 0.9em; }

/* Layout */

.topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 1.25rem;
    background: #1f2328;
    color: #fff;
}

.topbar .brand { color: #fff; font-weight: 700; }

.site-switcher select {
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    border: none;
    font: inherit;
    max-width: 60vw;
}

.logout { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.logout span { color: #c9d1d9; font-size: 0.9em; }
.logout .link { background: none; border: none; color: #fff; cursor: pointer; font: inherit; text-decoration: underline; }

.shell { display: flex; min-height: calc(100vh - 48px); }

.sidebar {
    flex: 0 0 200px;
    padding: 1rem 0.75rem;
    border-right: 1px solid var(--border);
    background: var(--surface);
}

.sidebar a {
    display: block;
    padding: 0.45rem 0.75rem;
    border-radius: 6px;
    color: var(--text);
}

.sidebar a:hover { background: var(--bg); text-decoration: none; }
.sidebar a.active { background: #e8f0fd; color: var(--accent-dark); font-weight: 600; }

.content { flex: 1; min-width: 0; padding: 1.5rem; max-width: 1100px; }

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

@media (max-width: 760px) {
    .shell { flex-direction: column; }
    .sidebar { display: flex; flex-wrap: wrap; gap: 0.25rem; border-right: none; border-bottom: 1px solid var(--border); }
    .content { padding: 1rem; }
    .logout span { display: none; }
}

/* Surfaces */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 1.25rem; }
.grid-2 .card p { margin: 0 0 0.5rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat { color: var(--muted); margin: 0; }
.stat span { display: block; font-size: 2rem; font-weight: 700; color: var(--text); }
.stat:hover { text-decoration: none; border-color: var(--accent); }

.alert { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; }
.alert-success { background: #dafbe1; border-color: #aceebb; color: #116329; }
.alert-error { background: #ffebe9; border-color: #ffcecb; color: #a40e26; }
.alert-info { background: #ddf4ff; border-color: #b6e3ff; color: #0a3069; }

/* Tables */

.table { width: 100%; border-collapse: separate; border-spacing: 0; padding: 0; overflow: hidden; }
.table th, .table td { padding: 0.6rem 0.9rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table thead th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); background: #fafbfc; }
.table tbody tr:last-child td { border-bottom: none; }
.table tfoot th, .table tfoot td { border-top: 1px solid var(--border); border-bottom: none; }
.table .num { text-align: right; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.thumb-cell { width: 48px; }
.thumb-cell img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; display: block; }

@media (max-width: 760px) {
    .table { display: block; overflow-x: auto; }
}

.badge { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.badge-on { background: #dafbe1; color: var(--success); }
.badge-off { background: #eaeef2; color: var(--muted); }
.badge-promo { background: #fff8c5; color: var(--warning); }

.status { display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; background: #eaeef2; }
.status-new { background: #ddf4ff; color: #0969da; }
.status-paid { background: #fff8c5; color: var(--warning); }
.status-shipped { background: #fbefff; color: #8250df; }
.status-completed { background: #dafbe1; color: var(--success); }
.status-canceled { background: #ffebe9; color: var(--danger); }

.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.filters input, .filters select { padding: 0.45rem 0.6rem; border: 1px solid var(--border); border-radius: 6px; font: inherit; background: var(--surface); }
.filters input { min-width: 220px; }

.pagination { display: flex; justify-content: center; gap: 1.25rem; color: var(--muted); }

/* Forms */

.form { max-width: 760px; }

.field { margin-bottom: 1rem; flex: 1; min-width: 0; }
.field > label { display: block; font-weight: 600; margin-bottom: 0.3rem; }

.field input:not([type=checkbox]):not([type=file]),
.field select,
.field textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font: inherit;
    background: var(--surface);
    color: var(--text);
}

.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(47, 111, 219, 0.15);
}

.field .invalid { border-color: var(--danger); }
.field .help { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.85rem; }
.field .error { margin: 0.3rem 0 0; color: var(--danger); font-size: 0.85rem; }

.field-checkbox label, label.inline { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; cursor: pointer; }
label.inline { margin: 0.5rem 0; }

.thumb { display: block; max-width: 160px; max-height: 160px; border-radius: 6px; border: 1px solid var(--border); margin-bottom: 0.25rem; }

.row { display: flex; gap: 1rem; }
@media (max-width: 640px) { .row { flex-direction: column; gap: 0; } }

fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1rem 0; margin: 0 0 1rem; }
legend { font-weight: 600; padding: 0 0.35rem; }

.form-actions { display: flex; align-items: center; gap: 1rem; margin-top: 0.5rem; }
.push-right { margin-left: auto; }

.button {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.button:hover { background: var(--accent-dark); text-decoration: none; }
.button-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.button-secondary:hover { background: var(--bg); }
.button-danger { background: var(--surface); color: var(--danger); border-color: #ffcecb; }
.button-danger:hover { background: #ffebe9; }
.button-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.inline-form { display: inline; }

/* Login */

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; }
.login-card { width: 100%; max-width: 360px; }
.login-card h1 { margin-bottom: 1.25rem; }
.login-card .button { width: 100%; }
