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

:root {
    /* ───────── Luftwaffe DS v1.0 — tokens ───────── */
    /* Backgrounds */
    --bg0: #2e3444;
    --bg1: #363d4e;
    --bg2: #3e4658;
    --bg3: #475062;
    --bg4: #525e70;

    /* Accents */
    --vest:     #c9a84c;
    --vest2:    #a88830;
    --vest3:    #e8cc82;
    --leather:  #5c3d28;
    --leather2: #7a5238;
    --canvas:   #c0aa7a;
    --canvas2:  #8a7a58;
    --silver:   #8fa8b4;
    --silver2:  #b8ccd4;

    /* Text — text2 and text3 lightened from #a09878/#6a6250 to meet WCAG AA on --bg0 */
    --text1: #ddd4b8;
    --text2: #b8af8c;
    --text3: #928a72;

    /* Semantic */
    --ok:     #4a8a48;
    --warn:   #8a7020;
    --danger: #a83838;

    /* Typography */
    --font-display: 'Barlow Condensed', system-ui, sans-serif;
    --font-body:    'Barlow', system-ui, sans-serif;

    /* Spacing */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-7: 32px;
    --sp-8: 48px;

    /* Border radius */
    --radius-xs: 2px;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;

    /* Motion */
    --ease-fast:   100ms ease;
    --ease-normal: 200ms ease;
    --ease-slide:  250ms ease;
    --ease-reveal: 150ms ease;

    /* Scratch texture (apply to bars/headers) */
    --scratch: repeating-linear-gradient(
        92deg,
        transparent, transparent 3px,
        rgba(0,0,0,0.07) 3px, rgba(0,0,0,0.07) 4px
    );

    /* Shell metrics — keep in sync with .bottom-tab-bar in BottomTabBar.razor.css.
       62px = 56px tab-item min-height + 6px top padding. */
    --tab-bar-height: calc(62px + max(10px, env(safe-area-inset-bottom)));
}

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30%           { transform: translateY(-5px); opacity: 1; }
}

/* ─── Base elements ─────────────────────────────────── */
html, body {
    background: var(--bg0);
    color: var(--text1);
    font-family: var(--font-body);
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

a { color: var(--vest3); text-decoration: none; }
a:hover  { color: #fff; }
a:focus-visible {
    outline: 2px solid var(--vest3);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Wrapper used by legacy pages until they migrate */
.ds-wrapper {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
}

/* ─── Utilities ─────────────────────────────────────── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.stack-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.stack-col { display: flex; flex-direction: column; gap: 10px; }

.text-center { text-align: center; }
.auth-foot   { text-align: center; font-size: 12px; color: var(--text3); margin-top: 16px; }

/* ─── Buttons ───────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 11px 20px;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    border: 2px solid transparent;
    border-radius: 3px;
    cursor: pointer;
    transition: background var(--ease-fast), opacity var(--ease-fast);
    text-decoration: none;
    white-space: nowrap;
    min-height: 44px;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:focus-visible {
    outline: 2px solid var(--vest3);
    outline-offset: 2px;
}
.btn-primary    { background: var(--vest);   border-color: var(--vest2);     color: #2a1e08; }
.btn-primary:hover:not(:disabled)   { background: var(--vest3); }
.btn-primary:focus-visible          { outline-color: #fff; }
.btn-secondary  { background: var(--leather); border-color: var(--leather2); color: var(--text1); }
.btn-secondary:hover:not(:disabled) { background: var(--leather2); }
.btn-outline    { background: transparent;   border-color: var(--canvas2);   color: var(--canvas); }
.btn-outline:hover:not(:disabled)   { background: rgba(192,170,122,0.1); }
.btn-ghost      { background: transparent;   border-color: transparent;      color: var(--text2); }
.btn-ghost:hover:not(:disabled)     { color: var(--vest); }
.btn-danger     { background: var(--danger); border-color: #6e2d20;          color: #fff0f0; }
.btn-danger:hover:not(:disabled)    { background: #c04040; }
.btn-sm    { padding: 8px 14px;  font-size: 11px; min-height: 36px; }
.btn-lg    { padding: 14px 28px; font-size: 13px; min-height: 50px; }
.btn-block { width: 100%; }
.btn-icon  { display: inline-flex; align-items: center; }

/* ─── Icon button (small, square) ───────────────────── */
.icon-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--bg4);
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--canvas);
    transition: background var(--ease-fast), color var(--ease-fast);
    flex-shrink: 0;
}
.icon-btn:hover:not(:disabled)  { background: var(--bg3); }
.icon-btn:disabled              { opacity: 0.4; cursor: not-allowed; }
.icon-btn:focus-visible {
    outline: 2px solid var(--vest3);
    outline-offset: 1px;
}
.icon-btn-active                { color: var(--vest); }

/* ─── Badges ────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    font-family: var(--font-display);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    border-radius: 2px;
}
.badge-rank    { background: var(--vest2); color: #2a1e08; }
.badge-active  { background: rgba(74,138,72,0.25);  color: #88c888;        border: 1px solid rgba(74,138,72,0.35); }
.badge-alert   { background: var(--danger); color: #fff0f0; }
.badge-intel   { background: rgba(143,168,180,0.2); color: var(--silver2); border: 1px solid rgba(143,168,180,0.3); }
.badge-neutral { background: rgba(192,170,122,0.15); color: var(--canvas); border: 1px solid rgba(192,170,122,0.3); }

/* ─── Form fields ───────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label {
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text2);
}
.field input,
.field select,
.field textarea {
    width: 100%;
    background: var(--bg0);
    border: 1px solid var(--bg4);
    border-radius: 3px;
    padding: 12px 13px;
    font-family: var(--font-body);
    font-size: 16px;            /* 16px to prevent iOS zoom on focus */
    color: var(--text1);
    outline: none;
    transition: border-color var(--ease-normal), box-shadow var(--ease-normal);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--vest);
    box-shadow: 0 0 0 2px rgba(201,168,76,0.18);
}
.field input::placeholder,
.field textarea::placeholder { color: var(--text3); }
.field-error label              { color: #e89898; }
.field-error input,
.field-error textarea           { border-color: var(--danger); }
.field-error input:focus,
.field-error textarea:focus     { box-shadow: 0 0 0 2px rgba(168,56,56,0.18); }
.field-hint { font-size: 12px; color: var(--text3); }
.field-error .field-hint        { color: #e89898; }

.checkbox-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--text2);
}

/* ─── Alerts ────────────────────────────────────────── */
.alert {
    padding: 12px 14px;
    border-left: 3px solid;
    border-radius: 3px;
    background: rgba(0,0,0,0.2);
    margin-bottom: 8px;
    line-height: 1.5;
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text2);
}
.alert-title {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 3px;
}
.alert-info     { border-color: var(--silver); }
.alert-info     .alert-title { color: var(--silver2); }
.alert-warning  { border-color: var(--vest); }
.alert-warning  .alert-title { color: var(--vest3); }
.alert-danger   { border-color: var(--danger); }
.alert-danger   .alert-title { color: #e89898; }
.alert-success  { border-color: var(--ok); }
.alert-success  .alert-title { color: #88c888; }

/* ─── Section title ─────────────────────────────────── */
.section-title {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--vest3);
    margin: 24px 0 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(200,168,76,0.18);
}

/* ─── Comp cards (used by Home, Login, Register, Profile, Components, NotFound, Messages) ─── */
.comp-row { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.comp-card {
    background: var(--bg1);
    border: 1px solid var(--bg2);
    border-radius: 4px;
    padding: 16px;
}
.comp-card-title {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--vest3);
    margin-bottom: 12px;
}
.comp-card p {
    font-family: var(--font-body);
    color: var(--text2);
    line-height: 1.55;
    font-size: 13px;
}

/* ─── Motion preferences ────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
