/* Single stylesheet for every non-admin page: the marketing site (base.html/home.html),
   auth (login.html/register.html), and the sell/order popups. They can't all
   {% extends %} one template (the popups are standalone documents opened in a popup
   window), so this file is the shared source of truth instead — edit tokens or
   components here and every page picks it up. Admin/Jazzmin styling lives separately
   in admin_theme.css. */

:root {
    --color-bg: #f4fbf9;
    --color-surface: #ffffff;
    --color-text: #263238;
    --color-muted: #6c757d;
    --color-accent: #78c2ad;
    --color-accent-dark: #5fa88f;
    --color-border: #dbe8e3;
    --color-danger: #dd3333;
    --font-sans: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 56px;

    --radius-sm: 8px;
    --radius-md: 12px;
}

/* Mirrors Jazzmin's own dark-mode resolution (jazzmin/js/main.js): an explicit choice
   stored under the same localStorage key wins, otherwise fall back to the OS
   preference. Each page sets the matching data-bs-theme attribute on <html> via an
   inline script before this stylesheet paints, so no extra "prefers-color-scheme"
   media block is needed here — navigating between these pages and /admin/ never
   flips the theme unexpectedly. */
:root[data-bs-theme="dark"] {
    --color-bg: #14211d;
    --color-surface: #1c2b26;
    --color-text: #e7f1ee;
    --color-muted: #9fb3ad;
    --color-accent: #8fd0bd;
    --color-accent-dark: #a9dccb;
    --color-border: #33473f;
    --color-danger: #ff6b6b;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
}

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

/* --- buttons: shared by the marketing site, auth forms, and the popups' own
   <button> actions. */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 15px;
}
button.btn { font-family: inherit; }
.btn + .btn { margin-left: var(--space-3); }
.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { background: var(--color-accent-dark); }
.btn-outline { background: transparent; border-color: var(--color-accent); color: var(--color-accent); }
.btn-outline:hover { background: var(--color-accent); color: #fff; }
.btn-block { width: 100%; }

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 32px;
}
.card-auth { max-width: 360px; margin: 0 auto; }
.card-auth h2 { margin-top: 0; }

/* --- form rows: used by login/register AND both popups. */
.row { margin-bottom: 16px; }
.row label { display: block; margin-bottom: 6px; font-weight: 500; }
.row input,
.row select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 15px;
}
.row-checkbox {
    display: grid;
    grid-template-columns: 20px 1fr;
    align-items: start;
    gap: 8px;
}
.row-checkbox label { grid-column: 2; grid-row: 1; margin: 0; font-size: 14px; font-weight: 400; }
.row-checkbox input { grid-column: 1; grid-row: 1; width: auto; margin-top: 3px; }
.row-checkbox .errorlist { grid-column: 1 / -1; }
.helptext { color: var(--color-muted); font-size: 13px; margin-top: 4px; }
.errorlist { color: var(--color-danger); padding-left: 18px; margin: 4px 0; }
.error { color: var(--color-danger); margin-bottom: 12px; font-size: 14px; }
.form-footnote { margin-top: var(--space-4); color: var(--color-muted); }
.actions { text-align: right; }

/* --- marketing site layout (base.html). */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 40px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}
.site-header .logo { font-weight: 700; font-size: 20px; }
.site-header nav { display: flex; align-items: center; }
.site-header nav a { margin-left: 16px; font-weight: 500; }
.site-header nav .logout-form { display: inline; margin-left: 16px; }
.site-header nav .lang-switcher { display: inline-flex; margin-left: 16px; }
.site-header nav .lang-switcher select {
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 14px;
    cursor: pointer;
}
.site-header nav .link-button {
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    font-weight: 500;
    color: var(--color-accent);
    cursor: pointer;
}
.site-header nav .link-button:hover { text-decoration: underline; }
.container { max-width: 960px; margin: 0 auto; padding: 0 24px; }
.page-content { padding-top: var(--space-7); padding-bottom: var(--space-7); }
.site-footer {
    text-align: center;
    color: var(--color-muted);
    padding: 32px 0;
    font-size: 14px;
}
.site-footer p { margin: 0 0 var(--space-2); }
.site-footer p:last-child { margin-bottom: 0; }
.site-footer-notice { font-size: 13px; }
.site-footer-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 18px; }

/* --- public legal documents. */
.legal-document { max-width: 800px; margin: 0 auto; line-height: 1.65; }
.legal-document h1 { margin-top: 0; line-height: 1.2; }
.legal-document h2 { margin-top: 32px; line-height: 1.3; }
.legal-document h3 { margin-top: 24px; }
.legal-document li + li { margin-top: 6px; }
.legal-meta { color: var(--color-muted); }
.legal-warning {
    margin-bottom: 24px;
    padding: 16px;
    border: 1px solid var(--color-danger);
    border-radius: var(--radius-sm);
}
.legal-details { padding-left: 0; list-style: none; }

/* --- mandatory first-time/revised legal acceptance. */
.legal-acceptance-intro,
.legal-acceptance-form { max-width: 800px; margin: 0 auto var(--space-5); }
.legal-acceptance-intro h1 { margin-top: 0; }
.legal-acceptance-documents { max-width: 880px; margin: 0 auto var(--space-5); }
.legal-acceptance-document {
    margin-bottom: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
}
.legal-acceptance-document summary {
    padding: var(--space-4) var(--space-5);
    cursor: pointer;
    font-weight: 700;
}
.legal-acceptance-document > .legal-document {
    max-width: none;
    border: 0;
    border-top: 1px solid var(--color-border);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}
.legal-acceptance-form .row-checkbox { margin-bottom: var(--space-4); }

/* --- home.html sections. */
.hero { text-align: center; padding: var(--space-6) 0 var(--space-8); }
.hero h1 { font-size: 40px; margin-bottom: var(--space-3); }
.hero p { font-size: 18px; color: var(--color-muted); max-width: 640px; margin: 0 auto var(--space-5); }
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-4);
}
.features-grid .card p { color: var(--color-muted); }

/* --- sell/order popups: standalone documents, no header/footer/container, just a
   compact form. */
body.popup { padding: 20px; background: var(--color-surface); }
body.popup h3 { margin: 0 0 var(--space-4); font-size: 16px; font-weight: 700; }
