/*
|==========================================================================
| Theme — the only stylesheet you need to edit
|==========================================================================
| Clean, Apple-inspired design. Everything is driven by the variables in
| :root below — change a colour once here to re-brand the whole app.
| No build step required. Just edit and save.
*/

:root {
    color-scheme: light dark;

    /* Brand colour — change this one line to re-skin the app */
    --accent: #0071e3;
    --accent-hover: #0061c3;
    --accent-soft: #eef5ff;

    /* Surfaces & text */
    --bg: #f5f5f7;
    --card: #ffffff;
    --surface: #ffffff;  /* alias of --card, for nested tiles */
    --field: #ffffff;
    --ink: #1d1d1f;          /* headings */
    --text: #3a3a3c;         /* body text */
    --muted: #6e6e73;        /* secondary text */
    --line: #e6e6eb;         /* borders */

    /* Status colours */
    --success: #1f9d57;  --success-soft: #e9f8ef;
    --danger:  #d83a32;  --danger-soft:  #fdecec;
    --warn:    #b5790a;  --warn-soft:    #fdf3e3;

    /* Shape & depth */
    --radius: 16px;
    --radius-sm: 12px;
    --radius-pill: 980px;
    --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 10px 30px rgba(0, 0, 0, .06);

    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --accent: #0a84ff;
        --accent-hover: #3d9bff;
        --accent-soft: #0b2c4d;

        /* Layered near-black greys (Apple style) — not pure black */
        --bg: #1c1c1e;       /* page */
        --card: #2c2c2e;     /* elevated surfaces */
        --surface: #2c2c2e;  /* alias of --card */
        --field: #1c1c1e;    /* inset fields */
        --ink: #f5f5f7;      /* headings */
        --text: #e3e3e8;     /* body */
        --muted: #a1a1a7;    /* secondary */
        --line: #3a3a3d;     /* borders */

        --success: #30d158; --success-soft: #12351f;
        --danger:  #ff6b63; --danger-soft:  #3a1f1e;
        --warn:    #ffd60a; --warn-soft:    #33290f;

        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    }
}

/* -------------------------------------------------------------------------
| Base
------------------------------------------------------------------------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { color: var(--ink); margin: 0; font-weight: 600; letter-spacing: -.01em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }

/* Icons (inline SVG) inherit text colour and size with the text */
.ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.18em; }
.ico--lg { width: 24px; height: 24px; }

/* -------------------------------------------------------------------------
| Layout helpers
------------------------------------------------------------------------- */
.page { max-width: 920px; margin: 0 auto; padding: 40px 20px; }
.page--narrow { max-width: 440px; }
.page--wide { max-width: 1080px; }
.page--auth { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }

.stack { display: flex; flex-direction: column; gap: 18px; }
.stack--sm { gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.center { text-align: center; }
.muted { color: var(--muted); }
.grow { flex: 1; }

.grid-2 { display: grid; gap: 18px; }
@media (min-width: 600px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* Auto-fitting card grid (features, etc.) */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-4 { margin-top: 20px; }
.mt-6 { margin-top: 28px; }

/* -------------------------------------------------------------------------
| Card
------------------------------------------------------------------------- */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
}
.card--flush { padding: 0; overflow: hidden; }
@media (min-width: 600px) { .card { padding: 32px; } }

.title { font-size: 24px; }
.subtitle { margin-top: 4px; color: var(--muted); font-size: 15px; }

/* -------------------------------------------------------------------------
| Forms
------------------------------------------------------------------------- */
.field { display: block; }
.label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }

.input {
    width: 100%;
    font: inherit;
    font-size: 15px;
    color: var(--ink);
    background: var(--field);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--muted); }
.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
textarea.input { resize: vertical; min-height: 96px; }

.field-error { margin-top: 6px; font-size: 13px; color: var(--danger); }

.choice { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.choices { display: flex; flex-wrap: wrap; gap: 16px; }
input[type="checkbox"], input[type="radio"], .input { accent-color: var(--accent); }

/* -------------------------------------------------------------------------
| Buttons
------------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font: inherit; font-size: 15px; font-weight: 500; line-height: 1;
    padding: 11px 20px;
    border: 1px solid transparent; border-radius: var(--radius-pill);
    background: var(--accent); color: #fff; cursor: pointer;
    transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn--block { width: 100%; }
.btn--sm { padding: 8px 14px; font-size: 13px; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--bg); }
.btn--icon { padding: 9px; }

/* -------------------------------------------------------------------------
| Badges, alerts
------------------------------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: var(--radius-pill);
    font-size: 12px; font-weight: 500;
    background: var(--accent-soft); color: var(--accent);
}
.badge--green { background: var(--success-soft); color: var(--success); }
.badge--red { background: var(--danger-soft); color: var(--danger); }
.badge--gray { background: var(--line); color: var(--muted); }

.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 14px; }
.alert + .alert { margin-top: 10px; }
.alert--info { background: var(--accent-soft); color: var(--accent); }
.alert--error { background: var(--danger-soft); color: var(--danger); }
.alert--success { background: var(--success-soft); color: var(--success); }

/* -------------------------------------------------------------------------
| Navbar
------------------------------------------------------------------------- */
.nav { position: sticky; top: 0; z-index: 30; background: var(--card); border-bottom: 1px solid var(--line); }
.nav__inner { max-width: 1080px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.nav__brand { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); }
.nav__brand:hover { text-decoration: none; }
.nav__links { display: flex; align-items: center; gap: 4px; }
.nav__link { color: var(--muted); padding: 7px 13px; border-radius: var(--radius-pill); font-size: 14px; font-weight: 500; }
.nav__link:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.nav__avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
@media (max-width: 520px) { .nav__link--hide { display: none; } }

/* Dropdown menu */
.menu { position: relative; }
.menu__btn { background: none; border: none; padding: 0; cursor: pointer; border-radius: 50%; }
.menu__panel {
    position: absolute; right: 0; margin-top: 8px; min-width: 210px;
    background: var(--card); border: 1px solid var(--line);
    border-radius: 14px; box-shadow: var(--shadow); padding: 6px; display: none;
}
.menu__panel.open { display: block; }
.menu__item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--text); font-size: 14px; }
.menu__item:hover { background: var(--bg); text-decoration: none; }
.menu__item .ico { color: var(--muted); }
.menu__item--danger { color: var(--danger); }
.menu__sep { height: 1px; background: var(--line); margin: 6px 0; }

/* -------------------------------------------------------------------------
| Brand mark / avatars
------------------------------------------------------------------------- */
.brand-mark { width: 32px; height: 32px; border-radius: 9px; }
.avatar-lg { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }

.avatar-upload { position: relative; width: 96px; margin: 0 auto; }
.avatar-upload img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.avatar-upload label {
    position: absolute; right: -2px; bottom: -2px; width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent); color: #fff; border-radius: 50%; cursor: pointer;
    border: 2px solid var(--card);
}

/* -------------------------------------------------------------------------
| Stat cards (admin)
------------------------------------------------------------------------- */
.stats { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 800px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat__icon { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); }
.stat__num { font-size: 22px; font-weight: 600; color: var(--ink); line-height: 1.1; }
.stat__label { font-size: 13px; color: var(--muted); }

/* -------------------------------------------------------------------------
| Table
------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; padding: 12px 16px; font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--text); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg); }
.table .right { text-align: right; }
.cell-user { display: flex; align-items: center; gap: 12px; }
.cell-user img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); flex: none; }
.cell-user b { color: var(--ink); font-weight: 600; }

/* Section divider inside cards */
.divider { height: 1px; background: var(--line); border: 0; margin: 24px 0; }

/* Toolbar (card header strip) */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--line); }

/* Search input with leading icon */
.search { position: relative; }
.search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .input { padding-left: 38px; }

/* Pagination */
.pager { display: flex; gap: 6px; flex-wrap: wrap; }
.pager a { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 10px; border-radius: 10px; font-size: 13px; font-weight: 500; color: var(--text); }
.pager a:hover { background: var(--bg); text-decoration: none; }
.pager a.is-active { background: var(--accent); color: #fff; }

/* Inline action buttons (table) */
.act { display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border: none; background: none; border-radius: 9px; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--muted); }
.act:hover { background: var(--bg); }
.act--green { color: var(--success); }
.act--warn { color: var(--warn); }
.act--danger { color: var(--danger); }

/* Quiet header band for profile pages (flat, no gradient) */
.cover { height: 72px; background: var(--accent-soft); }
.cover--admin { background: var(--bg); }

/* Footer */
.footer { border-top: 1px solid var(--line); margin-top: 56px; }
.footer__inner { max-width: 1080px; margin: 0 auto; padding: 28px 20px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 13px; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--ink); }

/* Empty state */
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty__icon { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 14px; background: var(--bg); color: var(--muted); margin-bottom: 12px; }

/* g-recaptcha spacing */
.g-recaptcha { margin: 4px 0; }
