/* ==========================================================================
   app.css — Knife Throwing Companion
   ========================================================================== */

/* --------------------------------------------------------------------------
   Variables
   -------------------------------------------------------------------------- */
:root {
    --bg-dark:    #050507;
    --bg-card:    #111217;
    --accent:     #e02424;
    --neon:       #31f86a;
    --text-main:  #f7f7f7;
    --text-muted: #a0a0b3;
    --border:     rgba(255, 255, 255, 0.12);
}

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* --------------------------------------------------------------------------
   Body & App shell
   -------------------------------------------------------------------------- */
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background-color: #26282b;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    justify-content: center;
}

.app-shell {
    position: relative;
    width: 100%;
    max-width: 480px;
    padding: 1rem 1.25rem 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 130px;
    height: auto;
}

.logo-mark img {
    max-width: 100%;
    height: auto;
    display: block;
}

.app-title {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.accent-dot { color: var(--neon); }

.app-header-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.header-actions {
    position: absolute;
    top: 0.85rem;
    right: 1.25rem;
    z-index: 10;
    width: auto;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0;
}

.nav-dashboard {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 8px;
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.12);
    text-decoration: none;
    transition: color 0.12s, border-color 0.12s, background 0.12s;
}

.nav-dashboard:hover {
    color: var(--neon);
    border-color: rgba(49, 248, 106, 0.35);
    background: rgba(49, 248, 106, 0.06);
}

.nav-dashboard__icon {
    width: 0.95rem;
    height: 0.95rem;
    display: block;
}

.logout-btn {
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 0.35rem 0.6rem;
    font-size: 0.72rem;
    background: transparent;
    color: var(--text-main);
    cursor: pointer;
}

.logout-form { margin: 0; }

/* --------------------------------------------------------------------------
   Language switcher
   -------------------------------------------------------------------------- */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.lang-btn {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.2rem 0.3rem;
    border-radius: 4px;
    transition: color 0.12s;
}

.lang-btn:hover { color: var(--text-main); }

.lang-btn--active {
    color: var(--neon);
}

.lang-sep {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.2);
}

/* --------------------------------------------------------------------------
   Main content
   -------------------------------------------------------------------------- */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* --------------------------------------------------------------------------
   Card
   -------------------------------------------------------------------------- */
.card {
    background: radial-gradient(circle at top left, #1e1f29 0, var(--bg-card) 60%);
    border-radius: 1.25rem;
    padding: 1.25rem 1.15rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.65),
                0 0 0 1px rgba(255, 255, 255, 0.02);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.75rem;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.card-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Marketing card (guest home)
   -------------------------------------------------------------------------- */
.marketing-card {
    position: relative;
    overflow: hidden;
    border-color: rgba(224, 36, 36, 0.22);
    box-shadow:
        0 18px 40px rgba(0, 0, 0, 0.65),
        0 0 0 1px rgba(224, 36, 36, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.marketing-card::before {
    content: "";
    position: absolute;
    inset: -40% auto auto -20%;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(224, 36, 36, 0.28), transparent 70%);
    pointer-events: none;
}

.marketing-card__eyebrow {
    position: relative;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--neon);
    margin-bottom: 0.55rem;
}

.marketing-card__title {
    position: relative;
    font-size: 1.55rem;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: 0.01em;
    margin-bottom: 0.65rem;
}

.marketing-card__lead {
    position: relative;
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.marketing-card__points {
    position: relative;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin: 0;
    padding: 0;
}

.marketing-card__points li {
    position: relative;
    padding-left: 1.15rem;
    font-size: 0.86rem;
    line-height: 1.35;
    color: var(--text-main);
}

.marketing-card__points li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.4rem;
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 10px rgba(224, 36, 36, 0.55);
}

/* --------------------------------------------------------------------------
   CTA row (2 buttons side by side)
   -------------------------------------------------------------------------- */
.cta-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.85rem 1rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    width: 100%;
    transition: transform 0.08s ease-out, box-shadow 0.08s ease-out, background 0.12s ease-out;
}

.btn-primary {
    background: linear-gradient(135deg, #ff3232, #b31212);
    border-color: rgba(255, 255, 255, 0.08);
    color: #fff;
    box-shadow: 0 10px 30px rgba(224, 36, 36, 0.55);
}

.btn-secondary {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-main);
}

.btn .badge {
    font-size: 0.7rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary .badge { border-color: rgba(255, 255, 255, 0.25); }

.btn:active {
    transform: translateY(1px) scale(0.99);
    box-shadow: none;
}

.btn-primary:active {
    box-shadow: 0 4px 16px rgba(224, 36, 36, 0.55);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   Stats strip
   -------------------------------------------------------------------------- */
.stats-strip {
    display: flex;
    justify-content: space-between;
    margin-top: 0.75rem;
    border-radius: 999px;
    padding: 0.45rem 0.85rem;
    background: linear-gradient(90deg, rgba(49, 248, 106, 0.08), rgba(224, 36, 36, 0));
}

.stat-item {
    display: flex;
    flex-direction: column;
    font-size: 0.75rem;
    text-align: center;
}

.stat-label { color: var(--text-muted); }
.stat-value { font-weight: 500; }
.stat-value.positive { color: var(--neon); }

.score-ratio {
    font-variant-numeric: tabular-nums;
}

.score-ratio__current {
    color: #ff9f43;
    font-weight: 600;
}

.score-ratio__sep {
    color: var(--text-muted);
    margin: 0 0.05rem;
}

.score-ratio__max {
    color: var(--neon);
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   Admin usage overview
   -------------------------------------------------------------------------- */
.admin-usage {
    margin-top: 0.85rem;
}

.admin-usage__groups {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0.35rem;
}

.admin-usage__group-title {
    margin: 0 0 0.55rem;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.admin-usage__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
}

.admin-metric {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.65rem 0.7rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-metric__value {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-main);
    display: block;
}

.admin-metric__label {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.3;
    display: block;
}

@media (max-width: 520px) {
    .admin-usage__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@supports not (display: grid) {
    .admin-usage__grid {
        display: flex;
        flex-wrap: wrap;
    }

    .admin-metric {
        flex: 1 1 42%;
    }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
footer {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-pill {
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.3rem 0.6rem;
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.form-stack--lg { gap: 0.9rem; margin-top: 0.9rem; }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.form-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.2rem;
}

.form-control,
.form-select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: #181921;
    color: #f7f7f7;
    font-size: 0.9rem;
    font-family: inherit;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent);
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

/* --------------------------------------------------------------------------
   Score pad (training throw entry)
   -------------------------------------------------------------------------- */
.throw-entry {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.throw-entry__label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.score-pad {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.score-pad__btn {
    position: relative;
    cursor: pointer;
    margin: 0;
}

.score-pad__btn input {
    position: absolute;
    opacity: 0;
    inset: 0;
    margin: 0;
    cursor: pointer;
}

.score-pad__btn span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.55rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: #181921;
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 600;
    user-select: none;
    transition: border-color 0.12s, background 0.12s, color 0.12s;
}

.score-pad__btn input:checked + span {
    border-color: rgba(49, 248, 106, 0.55);
    background: rgba(49, 248, 106, 0.12);
    color: var(--neon);
}

.score-pad__btn input:focus-visible + span {
    outline: 2px solid rgba(49, 248, 106, 0.45);
    outline-offset: 2px;
}

.score-pad__btn--drop span {
    min-width: 3.4rem;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 500;
}

.score-pad__btn--drop input:checked + span {
    border-color: rgba(224, 36, 36, 0.55);
    background: rgba(224, 36, 36, 0.12);
    color: #ff8f8f;
}

/* --------------------------------------------------------------------------
   Radio card (mode selector)
   -------------------------------------------------------------------------- */
.radio-options {
    display: flex;
    gap: 0.75rem;
}

.radio-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.radio-card input[type="radio"] { display: none; }

.radio-label {
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0.45rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    transition: all 0.15s;
}

.radio-card input:checked + .radio-label {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(220, 38, 38, 0.1);
}

/* --------------------------------------------------------------------------
   Alerts
   -------------------------------------------------------------------------- */
.alert {
    padding: 0.6rem 0.85rem;
    border-radius: 10px;
    font-size: 0.85rem;
    margin-top: 0.75rem;
}

.alert-error {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.08);
    border: 1px solid rgba(255, 107, 107, 0.2);
}

.alert-success {
    color: var(--neon);
    background: rgba(49, 248, 106, 0.08);
    border: 1px solid rgba(49, 248, 106, 0.2);
}

.flash-msg {
    font-size: 0.8rem;
    margin-top: 0.4rem;
}

.flash-msg--error  { color: #ff6b6b; }
.flash-msg--success { color: var(--neon); }

/* --------------------------------------------------------------------------
   Items list (sessions / games)
   -------------------------------------------------------------------------- */
.items-list {
    list-style: none;
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.item-link {
    padding: 0.55rem 0.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.item-link:active { opacity: 0.75; }

.item-primary {
    font-size: 0.9rem;
    font-weight: 500;
}

.item-secondary {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.item-meta {
    text-align: right;
    font-size: 0.75rem;
}

.item-status--done    { color: var(--neon); }
.item-status--ongoing { color: var(--accent); }

/* --------------------------------------------------------------------------
   Recap table (throw history)
   -------------------------------------------------------------------------- */
.recap-table {
    font-size: 0.78rem;
    border-radius: 0.9rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 0.9rem;
}

.recap-table__header {
    display: grid;
    background: rgba(0, 0, 0, 0.35);
    padding: 0.4rem 0.6rem;
    color: var(--text-muted);
}

.recap-table__row {
    display: grid;
    padding: 0.35rem 0.6rem;
}

.recap-table__row--odd  { background: rgba(0, 0, 0, 0.15); }
.recap-table__row--even { background: transparent; }

/* Column templates */
.recap-table--training .recap-table__header,
.recap-table--training .recap-table__row {
    grid-template-columns: 0.9fr 0.9fr 1fr 1.4fr;
}

.recap-table--dart .recap-table__header,
.recap-table--dart .recap-table__row {
    grid-template-columns: 0.6fr 0.4fr 1.5fr 0.9fr 0.8fr;
}

.trend-up      { color: #31f86a; }
.trend-down    { color: #e02424; }
.trend-neutral { color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Page navigation
   -------------------------------------------------------------------------- */
.page-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 0.9rem;
    font-size: 0.8rem;
}

.page-nav__back    { color: var(--text-muted); text-decoration: none; }
.page-nav__action  { color: var(--neon);       text-decoration: none; }

.page-nav__actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Delete button (inline, text-style) */
.btn-delete {
    background: none;
    border: none;
    color: #ff6b6b;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.btn-delete:hover { opacity: 1; }

.delete-form { display: inline; }

/* --------------------------------------------------------------------------
   Section headings inside a card
   -------------------------------------------------------------------------- */
.section-title {
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
}

.section-heading {
    padding-left: 0.75rem;
    border-left: 3px solid var(--accent);
    margin-bottom: 0.75rem;
}

.section-heading .card-title {
    font-size: 1.3rem;
    letter-spacing: 0.03em;
}

.section-heading .card-subtitle {
    margin-top: 0.15rem;
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */
.mt-xs { margin-top: 0.3rem; }
.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 0.8rem; }
.mt-lg { margin-top: 0.9rem; }
.mt-xl { margin-top: 1rem;   }

.text-muted  { color: var(--text-muted); }
.text-neon   { color: var(--neon);       }
.text-accent { color: var(--accent);     }
.text-error  { color: #ff6b6b;           }

.text-xs   { font-size: 0.75rem; }
.text-sm   { font-size: 0.8rem;  }
.text-base { font-size: 0.9rem;  }

.fw-medium { font-weight: 500; }
.fw-bold   { font-weight: 700; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
    .app-shell {
        max-width: 640px;
        padding-top: 2rem;
    }
}

/* --------------------------------------------------------------------------
   Round toast (after validating 3 throws)
   -------------------------------------------------------------------------- */
.round-toast {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(5, 5, 7, 0.72);
    pointer-events: none;
    animation: round-toast-in 0.35s ease-out;
}

.round-toast--out {
    animation: round-toast-out 0.4s ease-in forwards;
}

.round-toast__card {
    width: min(100%, 320px);
    padding: 1.6rem 1.4rem 1.45rem;
    border-radius: 18px;
    text-align: center;
    background: #111217;
    border: 2px solid var(--accent);
    box-shadow:
        0 0 0 1px rgba(49, 248, 106, 0.18),
        0 0 36px rgba(224, 36, 36, 0.35),
        0 18px 40px rgba(0, 0, 0, 0.45);
    animation: round-toast-pop 0.4s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.round-toast__kicker {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--neon);
    margin-bottom: 0.45rem;
}

.round-toast__title {
    font-size: 2.15rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1;
    color: var(--text-main);
}

.round-toast__total {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0;
}

@keyframes round-toast-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes round-toast-out {
    to { opacity: 0; }
}

@keyframes round-toast-pop {
    from { transform: scale(0.82) rotate(-3deg); opacity: 0; }
    to   { transform: scale(1) rotate(0deg); opacity: 1; }
}
