/* === Racquet & Ball — Mobile-first CSS === */

:root {
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-success: #16a34a;
    --color-warning: #d97706;
    --color-danger: #dc2626;
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-border: #e2e8f0;
    --radius: 0.5rem;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* --- Header --- */
header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
}
header nav { display: flex; align-items: center; }
.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
}

/* --- Main --- */
main {
    flex: 1;
    padding: 1rem;
    max-width: 40rem;
    margin: 0 auto;
    width: 100%;
}

/* --- Footer --- */
footer {
    text-align: center;
    padding: 1rem;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--color-border);
}

/* --- Cards --- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

/* --- Forms --- */
label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}
select, input[type="text"], input[type="number"] {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
    margin-bottom: 0.75rem;
    background: var(--color-surface);
}
select:focus, input:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: -1px;
}
.form-group { margin-bottom: 0.75rem; }

.toggle-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.toggle-group input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    margin: 0;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-success { background: var(--color-success); color: #fff; }
.btn-warning { background: var(--color-warning); color: #fff; }
.btn-danger  { background: var(--color-danger); color: #fff; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
}
.btn-outline:hover { background: var(--color-bg); }
.btn-block { width: 100%; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.85rem; }

/* --- Badges --- */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.badge-scheduled { background: #e0e7ff; color: #3730a3; }
.badge-in-progress { background: #fef3c7; color: #92400e; }
.badge-completed { background: #d1fae5; color: #065f46; }

/* --- Match card --- */
.match-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
}
.match-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.match-sides {
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    margin: 0.5rem 0;
}
.match-vs { color: var(--color-text-muted); font-weight: 400; }
.match-meta {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}
.match-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* --- Player list --- */
.player-list { list-style: none; }
.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}
.player-item:last-child { border-bottom: none; }

/* --- Round header --- */
.round-header {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-muted);
    margin: 1.25rem 0 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 2px solid var(--color-primary);
}

/* --- HTMX indicator --- */
.htmx-indicator {
    display: none;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline-block;
}

/* --- Alert --- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.alert-error { background: #fef2f2; color: var(--color-danger); border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--color-success); border: 1px solid #bbf7d0; }

/* --- Utilities --- */
.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: 0.5rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
