/* =========================================
   PADELPIPE DESIGN SYSTEM
   Light, glassmorphism, sporty, minimalistic
   ========================================= */

:root {
    --bg: #f0f4f0;
    --bg-page: linear-gradient(135deg, #e8f5e9 0%, #f0f4f0 40%, #e3f0ea 100%);
    --glass: rgba(255, 255, 255, 0.55);
    --glass-strong: rgba(255, 255, 255, 0.75);
    --glass-hover: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-border-strong: rgba(255, 255, 255, 0.8);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 4px 24px rgba(40, 200, 60, 0.15);
    --green: #28c83c;
    --green-light: #d4f5d8;
    --green-bg: rgba(40, 200, 60, 0.08);
    --green-bg-strong: rgba(40, 200, 60, 0.15);
    --green-border: rgba(40, 200, 60, 0.2);
    --text: #1a2e1a;
    --text-secondary: #4a6a4a;
    --text-muted: #8aaa8a;
    --danger: #e53935;
    --danger-bg: rgba(229, 57, 53, 0.08);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-lg: 20px;
    --radius-full: 999px;
    --blur: 24px;
    --blur-strong: 40px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    background-image: var(--bg-page);
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Ambient green blobs */
body::before, body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    pointer-events: none;
    z-index: 0;
}

body::before {
    width: 600px;
    height: 600px;
    background: rgba(40, 200, 60, 0.08);
    top: -100px;
    right: -100px;
}

body::after {
    width: 500px;
    height: 500px;
    background: rgba(40, 200, 60, 0.06);
    bottom: -100px;
    left: -200px;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* =========================================
   LAYOUT
   ========================================= */
.container {
    max-width: 820px;
    margin: 0 auto;
    padding: 0 1.25rem;
    position: relative;
    z-index: 1;
}

/* =========================================
   NAVIGATION
   ========================================= */
.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.75rem 0.625rem 1.25rem;
    background: var(--glass-strong);
    backdrop-filter: blur(var(--blur-strong));
    -webkit-backdrop-filter: blur(var(--blur-strong));
    border: 1px solid var(--glass-border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
}

.site-nav .brand {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
    text-decoration: none;
}

.site-nav .brand:hover { text-decoration: none; }
.site-nav .brand .accent { color: var(--green); }

.nav-links {
    display: flex;
    gap: 0.25rem;
    background: rgba(0, 0, 0, 0.04);
    border-radius: var(--radius-full);
    padding: 0.25rem;
}

.nav-links a {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-links a:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.6);
    text-decoration: none;
}

.nav-links a.active {
    color: white;
    background: var(--green);
    box-shadow: 0 2px 8px rgba(40, 200, 60, 0.3);
}

/* =========================================
   GLASS CARDS
   ========================================= */
.glass {
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.glass-strong {
    background: var(--glass-strong);
    backdrop-filter: blur(var(--blur-strong));
    -webkit-backdrop-filter: blur(var(--blur-strong));
    border: 1px solid var(--glass-border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.card { padding: 1.25rem; }

/* =========================================
   TYPOGRAPHY
   ========================================= */
h1, h2, h3 {
    color: var(--text);
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.375rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
}

h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.875rem;
    color: var(--text-secondary);
}

/* =========================================
   BUTTONS
   ========================================= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.375rem;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1.6;
}

.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--green);
    color: white;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    background: #22b534;
    box-shadow: 0 6px 28px rgba(40, 200, 60, 0.25);
    transform: translateY(-1px);
}

.btn-glass {
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    color: var(--text);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
}

.btn-glass:hover {
    background: var(--glass-hover);
    box-shadow: var(--shadow-md);
}

.btn-sm {
    padding: 0.4375rem 0.875rem;
    font-size: 0.8rem;
}

.btn-full { width: 100%; justify-content: center; }

.btn-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.25rem;
    border-radius: 50%;
    line-height: 1;
    transition: all 0.15s;
}

.btn-delete:hover {
    color: var(--danger);
    background: var(--danger-bg);
}

.btn-edit {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 1rem;
    padding: 0.25rem;
    border-radius: 50%;
    transition: all 0.15s;
}

.btn-edit:hover {
    color: var(--green);
    background: var(--green-bg);
    text-decoration: none;
}

/* =========================================
   FORMS
   ========================================= */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-bottom: 1rem;
}

.form-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row > * { flex: 1; }

input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
input[type="email"],
select,
textarea {
    padding: 0.625rem 0.875rem;
    background: var(--glass-strong);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.9375rem;
    outline: none;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
    width: 100%;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(40, 200, 60, 0.12), var(--shadow-sm);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

select {
    appearance: none;
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234a6a4a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.875rem center;
    cursor: pointer;
}

textarea {
    min-height: 80px;
    resize: vertical;
}

/* =========================================
   TABLE
   ========================================= */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th {
    text-align: left;
    padding: 0.875rem 1rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    color: var(--text-secondary);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(40, 200, 60, 0.03); }

.winner {
    color: var(--green);
    font-weight: 600;
}

.score {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

.score-grid {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
}

.score-row {
    display: grid;
    grid-template-columns: 1.5rem auto 1.5rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 0.85rem;
    line-height: 1.6;
}

.score-sep {
    color: var(--text-muted);
    font-weight: 400;
}

.score-win {
    color: var(--green);
    font-weight: 800;
}

/* =========================================
   MATCH CARD (mobile view)
   ========================================= */
.match-card {
    padding: 1.125rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.match-card + .match-card { margin-top: 0.625rem; }

.match-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.match-date {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

.match-venue {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.match-teams {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.match-team {
    flex: 1;
    font-weight: 500;
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.match-team.winner { color: var(--green); font-weight: 700; }
.match-team.right { text-align: right; }

.match-vs {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.match-score {
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* =========================================
   SET SCORE INPUT
   ========================================= */
.set-scores {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.set-score-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.set-score-group span {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.set-score-group span:first-child {
    width: 3rem;
}

.set-score-group input {
    width: 3.75rem;
    text-align: center;
    padding: 0.5rem;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--green);
}

/* =========================================
   STAT CARDS
   ========================================= */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.card-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.375rem;
}

.card-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--green);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

/* =========================================
   FILTER PILLS
   ========================================= */
.pills {
    display: flex;
    gap: 0.25rem;
    background: rgba(0, 0, 0, 0.04);
    border-radius: var(--radius-full);
    padding: 0.25rem;
    width: fit-content;
    margin-bottom: 1.5rem;
}

.pill {
    padding: 0.4375rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    text-decoration: none;
    transition: all 0.2s;
}

.pill:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.5);
    text-decoration: none;
}

.pill.active {
    color: white;
    background: var(--green);
    box-shadow: 0 2px 8px rgba(40, 200, 60, 0.25);
}

/* =========================================
   LEADERBOARD
   ========================================= */
.leaderboard-row {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1.125rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.leaderboard-row:last-child { border-bottom: none; }
.leaderboard-row:hover { background: rgba(40, 200, 60, 0.03); border-radius: var(--radius-sm); }

.lb-rank {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text-muted);
    width: 1.5rem;
    text-align: center;
}

.lb-rank.top { color: var(--green); }

.lb-name { flex: 1; font-weight: 600; font-size: 0.9375rem; }

.lb-value {
    font-size: 1.25rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

.lb-value.highlight { color: var(--green); }

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

/* =========================================
   PLAYER CHIP
   ========================================= */
.player-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.2rem 0.625rem 0.2rem 0.2rem;
    border-radius: var(--radius-full);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    font-size: 0.8rem;
    font-weight: 500;
}

.player-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--green);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
}

/* =========================================
   AVAILABILITY TABLE
   ========================================= */
.avail-table {
    width: 100%;
    border-collapse: collapse;
}

.avail-table th {
    padding: 0.625rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    text-align: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.avail-table th.avail-th-date {
    text-align: left;
    padding-left: 1rem;
}

.avail-table td {
    padding: 0.375rem 0.5rem;
    text-align: center;
    vertical-align: middle;
}

.avail-table td form {
    display: flex;
    justify-content: center;
    margin: 0 auto;
}


.avail-table tr:last-child td {
    border-bottom: none;
}

.avail-td-date {
    text-align: left !important;
    padding-left: 1rem !important;
    font-weight: 500;
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.avail-row-full {
    background: var(--green-bg-strong);
}

.avail-row-full .avail-td-date {
    color: var(--green);
    font-weight: 700;
}

.avail-dot {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s;
}

.avail-dot.available {
    background: var(--green);
    color: white;
    box-shadow: 0 2px 6px rgba(40, 200, 60, 0.25);
}

.avail-dot.available:hover {
    box-shadow: 0 2px 12px rgba(40, 200, 60, 0.35);
    transform: scale(1.1);
}

.avail-dot.unavailable {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-muted);
}

.avail-dot.unavailable:hover {
    background: rgba(40, 200, 60, 0.1);
    color: var(--green);
}

.avail-static {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0 auto;
}

.avail-static.available {
    background: var(--green-bg-strong);
    color: var(--green);
}

.avail-static.unavailable {
    color: var(--text-muted);
}

.all-available {
    background: var(--green-bg-strong) !important;
    color: var(--green) !important;
    font-weight: 700 !important;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.all-available-cell {
    background: var(--green-bg-strong);
}

.avail-count {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-full);
    background: rgba(0, 0, 0, 0.04);
    white-space: nowrap;
}

.avail-count.full {
    background: var(--green);
    color: white;
    box-shadow: 0 2px 6px rgba(40, 200, 60, 0.25);
}

/* =========================================
   TOASTS / MESSAGES
   ========================================= */
.toast {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.toast-success,
.toast.success {
    background: var(--green-bg-strong);
    color: #1a7a24;
    border: 1px solid var(--green-border);
}

.toast-error,
.toast.error {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(229, 57, 53, 0.15);
}

/* =========================================
   SECTION SPACING
   ========================================= */
.section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--green);
    margin-bottom: 1rem;
    margin-top: 2rem;
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 640px) {
    .container { padding: 0 0.75rem; }

    .site-nav {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.625rem;
        align-items: center;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 2px;
        padding: 0.2rem;
    }

    .nav-links a {
        padding: 0.4rem 0.625rem;
        font-size: 0.7rem;
        flex: 1;
        text-align: center;
        min-width: 0;
    }

    .form-row { flex-direction: column; gap: 0; }

    /* Compact availability table for mobile */
    .avail-table { font-size: 0.75rem; }
    .avail-table th { padding: 0.375rem 0.25rem; font-size: 0.6rem; }
    .avail-table td { padding: 0.25rem 0.15rem; }
    .avail-td-date { padding-left: 0.5rem !important; font-size: 0.7rem !important; }
    .avail-dot, .avail-static { width: 26px; height: 26px; font-size: 0.7rem; }
    .avail-count { font-size: 0.6rem; padding: 0.15rem 0.35rem; }

    table { font-size: 0.8rem; }
    th, td { padding: 0.625rem 0.5rem; }
}
