/* ============================================================
   OhMyFood Admin
   Stessa palette del sito pubblico: arancio brand, ambra,
   neutri caldi. La sidebar riprende il footer della landing.
   ============================================================ */

:root {
    /* Brand — allineati a frontend/src/index.css */
    --orange: #dd6c10;
    --orange-ink: #b35406;      /* variante accessibile su bianco */
    --orange-deep: #964302;
    --orange-tint: #fbe9da;
    --amber: #ebaa10;
    --amber-ink: #8a6104;
    --amber-tint: #fdf1d3;

    /* Neutri caldi */
    --ink: #37352f;
    --ink-soft: #5f5b52;
    --ink-muted: #6f695e;
    --surface: #ffffff;
    --surface-alt: #fffaf6;
    --surface-sunk: #fdf5ef;
    --line: #f0e2d6;
    --line-strong: #e3cdb9;

    /* Stato */
    --ok: #2f6b3f;
    --ok-tint: #eaf5ed;
    --info: #2f5d8a;
    --info-tint: #eaf1f8;
    --warn: #8a6104;
    --warn-tint: #fdf1d3;
    --bad: #b3261e;
    --bad-tint: #fdecea;

    /* Tipografia */
    --font-display: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

    /* Forma */
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 22px;
    --r-pill: 999px;

    --shadow-sm: 0 1px 2px rgba(55, 53, 47, .05), 0 4px 12px rgba(150, 67, 2, .05);
    --shadow-md: 0 2px 6px rgba(55, 53, 47, .06), 0 14px 32px rgba(150, 67, 2, .09);
    --shadow-lg: 0 8px 20px rgba(55, 53, 47, .08), 0 28px 60px rgba(150, 67, 2, .13);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-body);
    background: var(--surface-alt);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--orange-ink); text-decoration: none; }
.link:hover { text-decoration: underline; }

:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; border-radius: 4px; }

/* ---------- Layout ---------- */
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: 230px;
    background: var(--ink);
    color: rgba(255, 255, 255, .78);
    display: flex; flex-direction: column;
    padding: 20px 14px;
}

.brand {
    font-family: var(--font-display);
    font-size: 20px; font-weight: 800; letter-spacing: .5px;
    color: #fff; display: flex; flex-direction: column; gap: 2px;
    padding: 6px 10px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .14);
}
.brand-dot { color: var(--amber); font-size: 14px; }
.brand small { color: var(--amber); font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }

.sidebar nav { display: flex; flex-direction: column; gap: 4px; margin-top: 18px; flex: 1; }
.sidebar nav a {
    color: rgba(255, 255, 255, .72); padding: 10px 12px; border-radius: var(--r-sm);
    border-left: 2px solid transparent; transition: color .15s, background-color .15s;
}
.sidebar nav a:hover { color: #fff; background: rgba(255, 255, 255, .07); text-decoration: none; }
.sidebar nav a.active {
    color: #fff; background: rgba(221, 108, 16, .28);
    border-left-color: var(--orange);
}

.sidebar-foot { padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .14); }

.main { margin-left: 230px; padding: 26px 34px; }

.topbar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 22px; padding-bottom: 16px; border-bottom: 1px solid var(--line);
}
.topbar h1 { font-family: var(--font-display); font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.topbar-user strong { font-family: var(--font-display); font-weight: 700; }
.topbar-user small { color: var(--ink-muted); display: block; }
.avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--orange-ink);
    color: #fff; font-family: var(--font-display); font-weight: 800;
    display: grid; place-items: center;
}

/* ---------- Cards & stats ---------- */
.card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-lg); padding: 20px; margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.card h2, .card-head h2 { font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.card h3 { font-family: var(--font-display); font-size: 14.5px; font-weight: 700; }

/* Bulk actions toolbar (pagina menù) */
.bulk-bar form { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.bulk-bar .btn-badge { font-size: 13px; padding: 6px 14px; }
.bulk-bar button:disabled { opacity: .4; cursor: not-allowed; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
    padding: 18px; display: flex; flex-direction: column; gap: 4px;
    border-top: 3px solid var(--orange);
    box-shadow: var(--shadow-sm);
}
.stat-label { color: var(--ink-muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .12em; }
.stat-value { font-family: var(--font-display); font-size: 28px; font-weight: 800; color: var(--orange-ink); }
.stat-value small { font-size: 14px; color: var(--ink-muted); font-weight: 400; }
.stat-sub { color: var(--ink-muted); font-size: 12.5px; }

/* ---------- Tabelle ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left; color: var(--ink-muted); font-family: var(--font-display); font-size: 11px;
    font-weight: 700; text-transform: uppercase; letter-spacing: .12em;
    padding: 8px 10px; border-bottom: 1px solid var(--line-strong);
}
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface-alt); }
.total-row td { font-family: var(--font-display); font-weight: 800; color: var(--orange-ink); }
.thumb { width: 46px; height: 46px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line-strong); }
.thumb-empty {
    width: 46px; height: 46px; border-radius: var(--r-sm); border: 1px dashed var(--line-strong);
    display: inline-grid; place-items: center; color: var(--ink-muted); font-size: 12px;
    background: var(--surface-sunk);
}
.empty { text-align: center; color: var(--ink-muted); padding: 24px !important; }

/* ---------- Badge ---------- */
.badge {
    display: inline-block; padding: 4px 11px; border-radius: var(--r-pill);
    font-family: var(--font-display);
    font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: capitalize;
    border: 1px solid transparent; cursor: default;
}
.badge-brand { background: var(--orange-tint); color: var(--orange-ink); border-color: rgba(221, 108, 16, .35); }
.badge-ok    { background: var(--ok-tint);     color: var(--ok);         border-color: rgba(47, 107, 63, .35); }
.badge-info  { background: var(--info-tint);   color: var(--info);       border-color: rgba(47, 93, 138, .3); }
.badge-warn  { background: var(--warn-tint);   color: var(--warn);       border-color: rgba(138, 97, 4, .3); }
.badge-bad   { background: var(--bad-tint);    color: var(--bad);        border-color: rgba(179, 38, 30, .3); }
.badge-muted { background: var(--surface-sunk); color: var(--ink-muted); border-color: var(--line-strong); }
.badge-method { background: var(--amber-tint); color: var(--amber-ink); border-color: rgba(138, 97, 4, .28); }
.btn-badge { cursor: pointer; }

/* ---------- Pulsanti & form ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 18px; border-radius: var(--r-pill); border: 1.5px solid transparent;
    font-family: var(--font-display);
    font-size: 13px; font-weight: 700; cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s, transform .15s;
    text-decoration: none; color: var(--ink); background: var(--surface-sunk);
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--orange-ink); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--orange-deep); transform: translateY(-1px); }
.btn-outline { border-color: var(--line-strong); color: var(--ink); background: var(--surface); }
.btn-outline:hover { border-color: var(--orange); color: var(--orange-ink); background: var(--orange-tint); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-ok:hover { background: #275936; transform: translateY(-1px); }
.btn-danger { background: var(--bad-tint); color: var(--bad); border-color: rgba(179, 38, 30, .35); }
.btn-danger:hover { background: #f9dcd9; }
.btn-sm { padding: 6px 13px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* La sidebar è scura: il pulsante "Esci" va invertito */
.sidebar .btn-outline { border-color: rgba(255, 255, 255, .24); color: rgba(255, 255, 255, .82); background: transparent; }
.sidebar .btn-outline:hover { border-color: var(--amber); color: var(--amber); background: rgba(255, 255, 255, .06); }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-family: var(--font-display); font-size: 11.5px; font-weight: 700; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .1em; }
.field input, .field textarea, .field select {
    background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: var(--r-md);
    color: var(--ink); padding: 10px 12px; font-size: 14px; font-family: inherit;
    width: 100%;
    transition: border-color .16s, box-shadow .16s;
}
.field input:hover, .field textarea:hover, .field select:hover { border-color: #d6b89e; }
.field input:focus, .field textarea:focus, .field select:focus {
    outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(221, 108, 16, .18);
}
.stack { display: flex; flex-direction: column; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); cursor: pointer; margin-bottom: 12px; }
.check input, .row-check { accent-color: var(--orange-ink); }

.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form select {
    background: var(--surface); border: 1.5px solid var(--line-strong); color: var(--ink);
    border-radius: var(--r-sm); padding: 6px 8px; font-size: 12px;
}
.inline-form select:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(221, 108, 16, .18); }

.filters { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.filters .field { margin-bottom: 0; }

/* ---------- Modale ---------- */
.modal {
    position: fixed; inset: 0; background: rgba(55, 53, 47, .5);
    backdrop-filter: blur(3px);
    display: none; align-items: center; justify-content: center; z-index: 50;
    padding: 20px;
}
.modal.open { display: flex; }
.modal-box {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    padding: 26px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
}
.modal-box h3 { font-family: var(--font-display); font-size: 19px; font-weight: 800; margin-bottom: 12px; color: var(--ink); }
.modal-text { color: var(--ink-soft); margin-bottom: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* Riepilogo dentro alla modale di conferma */
.modal-recap {
    border: 1px solid var(--line); border-radius: var(--r-md);
    background: var(--surface-sunk); padding: 14px 16px; margin-bottom: 18px;
    display: flex; flex-direction: column; gap: 4px; font-size: 13.5px;
}
.modal-recap strong { font-family: var(--font-display); }

/* ---------- Avvisi ---------- */
.alert { padding: 12px 16px; border-radius: var(--r-md); margin-bottom: 16px; font-size: 13.5px; }
.alert-success { background: var(--ok-tint); border: 1px solid rgba(47, 107, 63, .35); color: var(--ok); }
.alert-error { background: var(--bad-tint); border: 1px solid rgba(179, 38, 30, .35); color: var(--bad); }

/* ---------- Login ---------- */
.login-body {
    min-height: 100vh; display: grid; place-items: center;
    background:
        radial-gradient(ellipse 60% 45% at 50% 0%, var(--orange-tint), transparent 65%),
        var(--surface-alt);
}
.login-card {
    width: 100%; max-width: 400px; background: var(--surface);
    border: 1px solid var(--line); border-top: 3px solid var(--orange);
    border-radius: var(--r-lg); padding: 34px;
    box-shadow: var(--shadow-lg);
}
.login-brand {
    border-bottom: none; padding: 0 0 20px; text-align: center; align-items: center;
    color: var(--ink);
}
.login-brand small { color: var(--orange-ink); }
.login-brand .brand-dot { color: var(--orange); }
.login-hint { margin-top: 18px; text-align: center; color: var(--ink-muted); font-size: 12px; line-height: 1.7; }

.muted { color: var(--ink-muted); }
.small { font-size: 12.5px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

@media (max-width: 860px) {
    .sidebar { display: none; }
    .main { margin-left: 0; padding: 18px; }
    .grid-2 { grid-template-columns: 1fr; }
}
