/* ==========================================================================
 * GZL Servisi — app-level stylesheet.
 *
 * Loaded via $extraHead in templates/partials/header.php, which gzl-ui's
 * head.php emits AFTER tokens.css and gzl-ui.css. That ordering is
 * load-bearing: several rules below deliberately win ties against gzl-ui
 * selectors of equal specificity, and they do so by source order rather than
 * !important. Do not move the <link>.
 *
 * Scope rule: anything Servisi-specific lives here. Shared tokens and
 * components belong in ../../../gzl-ui/, which is symlinked into four other
 * apps — see that package's README before adding anything there.
 * ========================================================================== */

/* ==========================================================================
 * Status badges — the single canonical definition.
 *
 * Previously defined four separate times with four different colour sets:
 *   templates/admin/statistics/index.php   (hardcoded Material pastels)
 *   templates/requests/index.php           (token color-mix; -info was broken)
 *   templates/requests/show.php            (hardcoded pastels)
 *   templates/vehicles/show.php            (hardcoded pastels)
 * and not defined at all on templates/radio_stations/{index,show}.php, whose
 * eight badges rendered as plain grey.
 *
 * Markup is unchanged — `<span class="badge badge-soft-success">` still works,
 * including the computed suffixes at requests/index.php and requests/show.php.
 *
 * The tint is mixed against an OPAQUE surface, not `transparent`: these badges
 * sit inside table rows whose background changes on hover
 * (--bs-table-hover-bg, gzl-ui.css), and a translucent badge would let that
 * bleed through and shift its own contrast ratio on hover.
 *
 * Every variant clears WCAG AA (4.5:1) at 12px in BOTH themes via the
 * --gzl-*-ink tokens.
 * ========================================================================== */
.badge-soft,
.badge-soft-success,
.badge-soft-warning,
.badge-soft-danger,
.badge-soft-info,
.badge-soft-primary,
.badge-soft-secondary {
    --_tone: var(--gzl-muted);
    --_ink:  var(--gzl-ink-3);

    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    vertical-align: middle;

    background-color: color-mix(in srgb, var(--_tone) 14%, var(--gzl-surface-2));
    color: var(--_ink);
    border: 1px solid color-mix(in srgb, var(--_tone) 28%, var(--gzl-surface-2));
}

.badge-soft-success   { --_tone: var(--gzl-success); --_ink: var(--gzl-success-ink); }
.badge-soft-warning   { --_tone: var(--gzl-warn);    --_ink: var(--gzl-warn-ink); }
.badge-soft-danger    { --_tone: var(--gzl-danger);  --_ink: var(--gzl-danger-ink); }
.badge-soft-info      { --_tone: var(--gzl-info);    --_ink: var(--gzl-info-ink); }
.badge-soft-primary   { --_tone: var(--gzl-primary); --_ink: var(--gzl-primary-ink); }
/* Neutral uses ink-3 rather than muted: muted-on-its-own-tint measures
 * 4.83:1 light / 5.15:1 dark — passing, but with no headroom. */
.badge-soft-secondary { --_tone: var(--gzl-muted);   --_ink: var(--gzl-ink-3); }

/* ==========================================================================
 * Dark-theme repairs for Bootstrap helpers.
 *
 * Bootstrap 5.3 hardcodes .text-dark / .btn-light to light-theme values; they
 * do not respond to [data-bs-theme]. Servisi uses text-dark ~110 times and
 * bg-light ~84 times, so without these the app is unreadable in dark mode.
 * These patches previously existed only inside requests/index.php's <style>
 * block — every other page went without. Hoisted here so all pages get them.
 * ========================================================================== */
[data-bs-theme="dark"] .text-dark { color: var(--gzl-ink) !important; }

[data-bs-theme="dark"] .btn-light {
    --bs-btn-bg:                 var(--gzl-surface);
    --bs-btn-border-color:       var(--gzl-border);
    --bs-btn-color:              var(--gzl-ink);
    --bs-btn-hover-bg:           var(--gzl-surface-2);
    --bs-btn-hover-border-color: var(--gzl-muted);
    --bs-btn-hover-color:        var(--gzl-ink);
}

/* Cards and their separators. vehicles/show.php hardcoded these as
 * rgba(0,0,0,.075) / rgba(0,0,0,.05) — invisible on a #101013 surface. */
[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .card-header {
    border-color: var(--gzl-border);
}

/* ==========================================================================
 * Shared app utilities
 * ========================================================================== */

/* Unified radius. Was redefined in 22 templates across two conflicting values
 * (1rem in 13, 1.25rem in 7). 1rem wins on majority; the 4px delta on the
 * other seven is imperceptible. */
.rounded-4 { border-radius: var(--gzl-r-lg, 1rem) !important; }

/* Soft warn surface — replaces dashboard's hardcoded #fffcf0, which was
 * near-white on a dark background. */
.bg-warning-light {
    background-color: color-mix(in srgb, var(--gzl-warn) 8%, var(--gzl-surface-2)) !important;
}

/* Chrome-less layout wrapper emitted by templates/partials/header.php for the
 * login / 2FA / password pages. It was previously styled nowhere at all —
 * .gzl-auth-shell's min-height:100vh happened to mask the omission. */
.gzl-auth-main {
    display: block;
    min-height: 100vh;
}

/* Detail-page card lift. Moved out of dashboard/index.php so the
 * prefers-reduced-motion block in gzl-ui.css can neutralise it. */
.card {
    transition: transform var(--gzl-dur) var(--gzl-ease);
}

/* ==========================================================================
 * /profile
 * Lives here rather than in a per-page <style> block — that pattern is what
 * produced the four conflicting badge definitions this file replaced.
 * ========================================================================== */
.profile-hero {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 28px 0 24px;
    flex-wrap: wrap;
}
.profile-hero__avatar {
    width: 72px;
    height: 72px;
    flex: 0 0 auto;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--gzl-primary-soft);
    color: var(--gzl-primary-ink);
    font-family: var(--gzl-font-display);
    font-size: 26px;
    font-weight: 600;
    letter-spacing: .02em;
}
.profile-hero__meta { min-width: 0; }
.profile-hero__meta h1 { margin: 2px 0 10px; font-size: 32px; line-height: 1.1; }
.profile-hero__tags { display: flex; flex-wrap: wrap; gap: 8px; }
.profile-hero__blurb { margin: 10px 0 0; max-width: 56ch; }

/* Definition list of read-only facts. Two columns on desktop, stacked on
 * mobile — a <dl> keeps the label/value relationship in the accessibility
 * tree, which a pile of <div>s would lose. */
.profile-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 24px;
    margin: 0;
}
.profile-facts dt {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--gzl-muted);
    margin-bottom: 4px;
}
.profile-facts dd { margin: 0; color: var(--gzl-ink); font-weight: 500; }
.profile-facts dd a { color: var(--gzl-ink); text-decoration: none; }
.profile-facts dd a:hover { color: var(--gzl-primary); text-decoration: underline; }

.profile-note {
    margin: 16px 0 0;
    padding-top: 14px;
    border-top: 1px solid var(--gzl-border-2);
}

.profile-security { display: flex; flex-direction: column; }
.profile-security__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--gzl-border-2);
}
.profile-security__row:first-child { padding-top: 0; }
.profile-security__row:last-child  { border-bottom: 0; padding-bottom: 0; }
.profile-security__label { color: var(--gzl-muted); font-size: 13px; }

/* The shared .gzl-stats grid is sized for wide dashboards; in the narrow
 * profile sidebar it needs to stack. */
.profile-stats { grid-template-columns: 1fr; gap: 10px; }

@media (max-width: 640px) {
    .profile-facts { grid-template-columns: 1fr; }
    .profile-hero { gap: 16px; padding-top: 20px; }
    .profile-hero__avatar { width: 56px; height: 56px; font-size: 20px; }
    .profile-hero__meta h1 { font-size: 26px; }
}
