/* =============================================================================
   Boule Liga – Styles
   Mobile-first, ohne Framework. Übernimmt den fett/abgerundet/kontrastreichen
   Look der alten App, aber als eigenständige CSS-Datei.
   ============================================================================= */

/* ---------- Variablen ---------------------------------------------------- */
:root {
    --bg:           #f1f5f9;
    --bg-card:      #ffffff;
    --bg-soft:      #f8fafc;
    --border:       #e2e8f0;
    --text:         #0f172a;
    --text-mute:    #64748b;
    --text-soft:    #94a3b8;
    --text-faint:   #cbd5e1;

    --blue:         #2563eb;
    --blue-dark:    #1d4ed8;
    --blue-shadow:  rgba(37, 99, 235, 0.18);

    --red:          #ef4444;
    --red-dark:     #dc2626;
    --red-shadow:   rgba(239, 68, 68, 0.18);

    --green:        #22c55e;
    --slate-900:    #0f172a;
    --slate-50:     #f8fafc;
    --slate-100:    #f1f5f9;
    --slate-200:    #e2e8f0;

    --radius-sm:    0.5rem;
    --radius-md:    1rem;
    --radius-lg:    1.5rem;
    --radius-xl:    2rem;
    --radius-2xl:   2.5rem;

    --shadow-sm:    0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md:    0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-lg:    0 12px 32px rgba(15, 23, 42, 0.12);
}

/* ---------- Reset / Base ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    user-select: none;
}
button { font-family: inherit; cursor: pointer; border: 0; outline: none; }
input, select { font-family: inherit; outline: none; }

/* ---------- Layout ------------------------------------------------------- */
.app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    position: relative;
}

.app__header {
    background: var(--bg-card);
    padding: 2rem 1rem 1rem;
    text-align: center;
    border-bottom: 1px solid var(--slate-100);
    box-shadow: var(--shadow-sm);
}
.app__title {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -0.04em;
    font-style: italic;
    text-transform: uppercase;
    color: var(--slate-900);
    margin: 0;
}
.app__title-accent { color: var(--blue); }

/* Wettkampf-Picker (sticky oben) */
.context {
    background: var(--bg-card);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--slate-100);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: sticky;
    top: 0;
    z-index: 15;
    box-shadow: var(--shadow-sm);
}
.context__row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.context__label { color: var(--text-soft); min-width: 5.5rem; }
.context__select {
    flex: 1;
    background: var(--slate-50);
    border: 0;
    border-radius: var(--radius-md);
    padding: 0.6rem 0.75rem;
    font-weight: 900;
    color: var(--slate-900);
    font-size: 0.8rem;
}

/* Tab-Bar */
.tabs {
    display: flex;
    background: var(--bg-card);
    position: sticky;
    top: 6rem;
    z-index: 10;
    box-shadow: var(--shadow-sm);
}
.tab-btn {
    flex: 1;
    padding: 1rem 0.5rem;
    background: transparent;
    color: var(--text-soft);
    font-weight: 900;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-bottom: 4px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}
.tab-btn.is-active {
    color: var(--slate-900);
    border-bottom-color: var(--blue);
}

main {
    flex: 1;
    padding: 0.75rem;
    padding-bottom: 4rem;
}

.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* ---------- Komponenten -------------------------------------------------- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--slate-100);
    box-shadow: var(--shadow-sm);
    padding: 1rem;
}
.card--lg { padding: 1.25rem; border-radius: var(--radius-xl); }
.card__title {
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-soft);
    font-style: italic;
    margin: 0 0 0.75rem;
}

.stack { display: flex; flex-direction: column; gap: 0.75rem; }
.stack--tight { gap: 0.5rem; }
.stack--loose { gap: 1rem; }
.row { display: flex; gap: 0.5rem; align-items: center; }
.row--between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.9rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 900;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: transform 0.08s;
}
.btn:active { transform: scale(0.97); }
.btn--primary {
    background: var(--blue);
    color: white;
    box-shadow: 0 8px 24px var(--blue-shadow);
}
.btn--danger {
    background: var(--red);
    color: white;
    box-shadow: 0 8px 24px var(--red-shadow);
}
.btn--dark {
    background: var(--slate-900);
    color: white;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
}
.btn--ghost {
    background: var(--slate-100);
    color: var(--text);
}
.btn--ghost-soft {
    background: transparent;
    color: var(--text-soft);
    padding: 0.5rem;
}
.btn--block { width: 100%; }
.btn--xl { padding: 1.3rem; font-size: 1rem; border-radius: var(--radius-xl); }

/* Inputs */
.input, .select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    background: var(--slate-50);
    border: 0;
    border-radius: var(--radius-md);
    padding: 0.95rem 1rem;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
    -webkit-appearance: none;
    appearance: none;
}
.input::placeholder { color: var(--text-soft); font-weight: 700; }

/* iOS-Date-Input zwingt sich gerne über die Containerbreite hinaus
   – wir holen es zurück in die Form */
input[type="date"].input {
    display: block;
    -webkit-appearance: none;
    appearance: none;
    min-height: 3rem;
    padding: 0.8rem 0.9rem;
}

/* Spieler-Karte (Match-Eintrag) */
.player-card {
    background: var(--bg-card);
    padding: 1.1rem;
    border-radius: var(--radius-2xl);
    border: 1px solid var(--slate-100);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: transform 0.1s;
}
.player-card:active { transform: scale(0.97); }
.player-card__avatar {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 900;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-md);
}
.player-card__avatar--blue { background: var(--blue); box-shadow: 0 8px 24px var(--blue-shadow); }
.player-card__avatar--red  { background: var(--red);  box-shadow: 0 8px 24px var(--red-shadow); }
.player-card__name {
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: 0.6rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* Punkte-Eingabe: 2 Aufnahmen × 2 Spieler-Slots */
.ends {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.end-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.5rem;
    background: var(--slate-50);
    border-radius: var(--radius-md);
    padding: 0.75rem;
}
.end-row__label {
    font-size: 0.65rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-soft);
    text-align: center;
}
.end-value {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0;
    text-align: center;
    font-weight: 900;
    font-size: 1.4rem;
}
.end-value--blue { color: var(--blue); }
.end-value--red  { color: var(--red); }
.end-controls {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.35rem;
}
.end-btn {
    flex: 1;
    background: var(--bg-card);
    color: var(--text-soft);
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    font-weight: 900;
    font-size: 0.85rem;
}

/* Listen / Tabellen */
.list {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--slate-100);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.list__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--slate-50);
    font-weight: 800;
    font-size: 0.85rem;
}
.list__item:last-child { border-bottom: 0; }
.list__item-actions { display: flex; gap: 0.6rem; }
.icon-btn {
    background: transparent;
    padding: 0.25rem;
    color: var(--text-soft);
    font-size: 1rem;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}
.stats-table thead {
    background: var(--slate-50);
    font-weight: 900;
    text-transform: uppercase;
    color: var(--text-soft);
    letter-spacing: 0.05em;
}
.stats-table th, .stats-table td { padding: 0.6rem; }
.stats-table th:first-child, .stats-table td:first-child { text-align: left; padding-left: 1rem; }
.stats-table th:last-child, .stats-table td:last-child { text-align: right; padding-right: 1rem; }
.stats-table th { font-size: 0.7rem; }
.stats-table td { font-weight: 800; text-align: center; }
.stats-table tr { border-bottom: 1px solid var(--slate-50); }
.stats-table tr:last-child { border-bottom: 0; }
.stats-table tr.clickable { cursor: pointer; }
.stats-table tr.clickable:active { background: var(--slate-50); }
.text-blue  { color: var(--blue); }
.text-red   { color: var(--red); }
.text-green { color: var(--green); }
.text-mute  { color: var(--text-soft); }

/* Historie */
.history-item {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--slate-100);
    padding: 0.8rem 1rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 900;
    text-transform: uppercase;
}
.history-item__teams {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}
.history-item__teams > span:first-child {
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.history-item__teams > span:last-child {
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.history-item__score {
    background: var(--slate-50);
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    font-weight: 800;
    color: var(--text-mute);
    text-align: center;
    min-width: 3rem;
    justify-self: center;
}

/* Empty States */
.empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-soft);
    font-weight: 700;
}
.empty__title {
    font-size: 1rem;
    font-weight: 900;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

/* ---------- Modal -------------------------------------------------------- */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    z-index: 60;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.modal.modal--center { align-items: center; padding: 1rem; }
.modal__panel {
    background: var(--bg-card);
    width: 100%;
    max-width: 460px;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
}
.modal--center .modal__panel { border-radius: var(--radius-2xl); }
.modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal__title {
    font-size: 1.1rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    font-style: italic;
    margin: 0;
}
.modal__close {
    background: var(--slate-100);
    color: var(--text);
    border-radius: 999px;
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1rem;
}
.picker-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    overflow-y: auto;
}
.picker-btn {
    background: var(--slate-50);
    border-radius: var(--radius-md);
    padding: 1.1rem 0.5rem;
    font-weight: 900;
    font-size: 0.85rem;
    color: var(--slate-900);
    text-transform: none;
}
.picker-btn:active { background: var(--blue); color: white; }

/* Profile */
.profile-head {
    background: var(--slate-900);
    color: white;
    padding: 1.5rem 1rem;
    border-radius: var(--radius-xl);
    text-align: center;
}
.profile-head__avatar {
    width: 4rem;
    height: 4rem;
    border-radius: 999px;
    background: var(--blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.25rem;
    margin: 0 auto 0.6rem;
    text-transform: uppercase;
}
.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}
.profile-stat {
    background: var(--slate-50);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    text-align: center;
}
.profile-stat__value { font-size: 1.25rem; font-weight: 900; }
.profile-stat__label {
    font-size: 0.6rem;
    text-transform: uppercase;
    color: var(--text-soft);
    letter-spacing: 0.05em;
    font-weight: 700;
}

/* Toast (Feedback) */
.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--slate-900);
    color: white;
    padding: 0.8rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 800;
    font-size: 0.85rem;
    z-index: 80;
    box-shadow: var(--shadow-lg);
    max-width: 90%;
    text-align: center;
}
.toast--error { background: var(--red); }
.toast--success { background: var(--green); }

/* Utilities */
.hidden { display: none !important; }
.text-center { text-align: center; }
.flex-1 { flex: 1; }
.muted { color: var(--text-mute); }
.small { font-size: 0.75rem; }
.tiny  { font-size: 0.65rem; }
