/*
 * Formidable portal design system - shared components used across portal
 * templates (cards, buttons, form fields, page titles). Visual language
 * matches the public landing page: sky-blue accent, navy "night" dark mode,
 * Plus Jakarta Sans for UI text, Libre Caslon Display for page titles.
 *
 * Tailwind (CDN, loaded after this file) handles layout; its `blue`/`gray`
 * scales are remapped to the same palette in base.html, so utility classes
 * in templates pick up the theme too. Component rules here are single-class
 * selectors so Tailwind utilities on the same element (py-3, w-full, ...)
 * still win.
 */

:root {
    --fm-font-sans: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
    --fm-font-display: "Libre Caslon Display", Georgia, serif;

    --fm-bg: #f6f9fc;
    --fm-surface: #ffffff;
    --fm-surface-muted: #f6f9fc;
    --fm-border: #dde6f0;
    --fm-border-strong: #c2d0e0;
    --fm-text: #0f172a;
    --fm-text-muted: #63799a;
    --fm-accent: #0284c7;
    --fm-accent-hover: #0369a1;
    --fm-accent-text: #ffffff;
    --fm-ring: rgba(14, 165, 233, 0.28);
    --fm-shadow: 0 1px 2px rgba(15, 33, 64, 0.04), 0 1px 3px rgba(15, 33, 64, 0.06);
}

.dark {
    --fm-bg: #07111e;
    --fm-surface: #0c1f38;
    --fm-surface-muted: #0a1a30;
    --fm-border: #1a2f4f;
    --fm-border-strong: #26406a;
    --fm-text: #e6eef8;
    --fm-text-muted: #8fa3bc;
    --fm-accent: #0ea5e9;
    --fm-accent-hover: #38bdf8;
    --fm-accent-text: #ffffff;
    --fm-ring: rgba(56, 189, 248, 0.32);
    --fm-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.5);
}

body {
    font-family: var(--fm-font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection { background: #0ea5e9; color: #ffffff; }

/* ---- Page titles: editorial serif, like the landing page headlines ---- */

.page-title {
    font-family: var(--fm-font-display);
    font-weight: 400;
    font-size: 2.25rem;
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: var(--fm-text);
}
@media (min-width: 640px) { .page-title { font-size: 2.6rem; } }

.page-subtitle {
    margin-top: 0.5rem;
    font-size: 0.95rem;
    color: var(--fm-text-muted);
}

/* ---- Card ---- */

.card {
    background: var(--fm-surface);
    border: 1px solid var(--fm-border);
    border-radius: 1rem;
    box-shadow: var(--fm-shadow);
}

/* ---- Buttons ---- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border-radius: 9999px;
    border: 1px solid transparent;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25rem;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 150ms, border-color 150ms, color 150ms, box-shadow 150ms;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--fm-ring); }
.btn:disabled { opacity: 0.55; pointer-events: none; }

.btn-primary {
    background: var(--fm-accent);
    color: var(--fm-accent-text);
    box-shadow: 0 1px 2px rgba(2, 132, 199, 0.25);
}
.btn-primary:hover { background: var(--fm-accent-hover); }

.btn-secondary {
    background: var(--fm-surface);
    color: var(--fm-text);
    border-color: var(--fm-border-strong);
}
.btn-secondary:hover { background: var(--fm-surface-muted); border-color: var(--fm-accent); }

/* ---- Form fields ---- */

.field-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--fm-text);
}

.field-input {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--fm-border-strong);
    border-radius: 0.75rem;
    background: var(--fm-surface);
    color: var(--fm-text);
    font-size: 0.875rem;
    line-height: 1.25rem;
    transition: border-color 150ms, box-shadow 150ms;
}
.field-input::placeholder { color: var(--fm-text-muted); opacity: 0.8; }
.field-input:focus { outline: none; border-color: var(--fm-accent); box-shadow: 0 0 0 3px var(--fm-ring); }
.field-input:disabled { opacity: 0.6; cursor: not-allowed; }
/* Dropdowns: our own chevron instead of the browser's, which Chrome/Safari
   draw against the right border whatever the padding. Multi-selects keep the
   native look (no arrow). */
select.field-input:not([multiple]) {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2364748b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.125rem;
}
/* background-color, not the `background` shorthand - that would wipe the chevron */
.dark .field-input { background-color: var(--fm-surface-muted); }
.dark select.field-input:not([multiple]) {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2394a3b8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
}
.dark select.field-input option { background: #0c1f38; }

.form-radio {
    width: 1rem;
    height: 1rem;
    accent-color: var(--fm-accent);
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--fm-accent); }

/* ---- Empty state ---- */

.empty-state {
    padding: 2.5rem 2rem;
    border: 1px dashed var(--fm-border-strong);
    border-radius: 1rem;
    color: var(--fm-text-muted);
    text-align: center;
}

/* ---- Brand lockup (portal/includes/logo.html) ---- */

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.6rem;
    background: linear-gradient(to bottom, #173a61, #0a182b);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    color: #7dd3fc;
}
.brand-word {
    font-family: var(--fm-font-display);
    font-size: 1.6rem;
    line-height: 1;
    letter-spacing: -0.008em;
}

/* ---- Sign-in pages: card floating in the night sky ---- */

.auth-sky {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: 100vh;
    background: radial-gradient(ellipse at top, #18395e, #0c1f38 55%, #07111e);
}
.auth-sky > .auth-sky-bg { position: absolute; inset: 0; z-index: -1; }
