/* SoccerShare — pitch-green palette. */
:root {
    --bg: #f3f5f0;
    --surface: #ffffff;
    --surface-alt: #e9efe6;
    --fg: #20302a;
    --muted: #6a7a72;
    --accent: #2f8f4e;       /* grass green */
    --accent-dark: #226e3c;
    --border: #d3ddd1;
    --error: #b42318;
    --shadow: 0 1px 3px rgba(20, 40, 30, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--fg);
    background: var(--bg);
    line-height: 1.5;
}

a { color: var(--accent-dark); text-decoration: none; }
a:hover { color: var(--accent); }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }

/* --- top bar --- */
.topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.topbar--bare { justify-content: center; }
.topbar .brand a, .topbar .brand { font-weight: 700; color: var(--fg); font-size: 1.1rem; }
.topbar-nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.92rem;
}
.topbar-nav a { color: var(--muted); }
.topbar-nav a:hover, .topbar-nav a.active { color: var(--accent-dark); font-weight: 600; }

/* --- layout --- */
main { max-width: 1040px; margin: 0 auto; padding: 1.5rem; }
.page h1 { margin-top: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.block-heading { margin-top: 2rem; font-size: 1.05rem; }
.date-heading {
    margin: 1.6rem 0 0.6rem;
    font-size: 1rem;
    color: var(--accent-dark);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.3rem;
}

/* --- buttons / forms --- */
button, .button-link {
    font: inherit;
    cursor: pointer;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 0.55rem 1.1rem;
    display: inline-block;
}
button:hover, .button-link:hover { background: var(--accent-dark); color: #fff; }
button.secondary, .button-link.secondary {
    background: var(--surface-alt);
    color: var(--fg);
    border: 1px solid var(--border);
}
button.secondary:hover { background: #dde6da; color: var(--fg); }
.inline-form { display: inline; margin: 0; }
.link-button {
    background: none; border: none; color: var(--accent-dark);
    padding: 0; font: inherit; cursor: pointer;
}
.link-button:hover { color: var(--accent); background: none; }
.link-button.danger, .danger { color: var(--error); }
.danger-button { background: var(--error); }
.danger-button:hover { background: #8f1c14; }

label { display: block; margin-bottom: 0.9rem; font-size: 0.92rem; }
input[type=text], input[type=email], input[type=password], input[type=date], textarea {
    width: 100%;
    margin-top: 0.3rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    font: inherit;
    background: var(--surface);
}
.stacked-form { max-width: 520px; }
.form-actions { display: flex; gap: 0.6rem; align-items: center; }

.error {
    background: #fdeceb;
    border: 1px solid #f3c4c0;
    color: var(--error);
    padding: 0.6rem 0.8rem;
    border-radius: 7px;
    margin-bottom: 1rem;
}
.notice {
    background: #e8f5ec;
    border: 1px solid #b9e0c4;
    padding: 0.8rem 1rem;
    border-radius: 7px;
    margin-bottom: 1.2rem;
}
.result-list { margin: 0.5rem 0 0; padding-left: 1.2rem; }

/* --- auth cards (gate + login) --- */
.auth-card {
    max-width: 380px;
    margin: 3rem auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
}
.auth-card h1 { margin-top: 0; text-align: center; }
.auth-card button { width: 100%; margin-top: 0.4rem; }
.auth-foot { text-align: center; margin-top: 1.2rem; margin-bottom: 0; }

/* --- album grid (viewer) --- */
.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.album-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    color: var(--fg);
    transition: transform 0.08s ease;
}
.album-card:hover { transform: translateY(-2px); color: var(--fg); }
.album-cover { aspect-ratio: 1 / 1; background: var(--surface-alt); }
.album-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-cover--empty {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    color: var(--muted); font-size: 0.85rem;
}
.album-meta { padding: 0.6rem 0.7rem; display: flex; flex-direction: column; gap: 0.15rem; }
.album-title { font-weight: 600; }

/* --- photo grid + lightbox --- */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
}
.photo-thumb {
    padding: 0; border: none; background: var(--surface-alt);
    border-radius: 8px; overflow: hidden; cursor: pointer; aspect-ratio: 1 / 1;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.lightbox {
    position: fixed; inset: 0;
    background: rgba(10, 18, 14, 0.92);
    display: flex; align-items: center; justify-content: center;
    z-index: 50;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 92vw; max-height: 86vh; border-radius: 4px; }
.lb-close, .lb-prev, .lb-next {
    position: absolute; background: rgba(255,255,255,0.12); color: #fff;
    border: none; cursor: pointer; border-radius: 50%;
    width: 46px; height: 46px; font-size: 1.6rem; line-height: 1;
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover { background: rgba(255,255,255,0.25); }
.lb-close { top: 1rem; right: 1rem; }
.lb-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: 1rem; top: 50%; transform: translateY(-50%); }
.lb-caption {
    position: absolute; bottom: 1rem; left: 50%; transform: translateX(-50%);
    color: #fff; font-size: 0.9rem; max-width: 80vw; text-align: center;
}
.lb-download {
    position: absolute; bottom: 1rem; right: 1rem;
    background: rgba(255,255,255,0.14); color: #fff; text-decoration: none;
    padding: 0.5rem 0.9rem; border-radius: 6px; font-size: 0.9rem;
}
.lb-download:hover { background: rgba(255,255,255,0.28); }

/* On phones, make Download a big, obvious, easy-to-tap bar that doesn't fight
   the caption or the next-arrow. The image gives up a little height for it. */
@media (max-width: 600px) {
    .lightbox img { max-height: 72vh; }
    .lb-download {
        left: 1rem; right: 1rem; bottom: 1rem;
        text-align: center; padding: 0.85rem 1rem; font-size: 1rem; font-weight: 600;
        background: var(--accent); color: #fff;
    }
    .lb-caption { bottom: 4.4rem; font-size: 0.8rem; }
    .lb-close { width: 52px; height: 52px; }
    .lb-prev { left: 0.25rem; }
    .lb-next { right: 0.25rem; }
}

/* --- admin dashboard --- */
.card-row { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1rem 0; }
.card {
    flex: 1 1 200px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    box-shadow: var(--shadow);
    color: var(--fg);
}
.card:hover { border-color: var(--accent); color: var(--fg); }
.card h3 { margin: 0 0 0.3rem; }

.stat-grid { display: flex; flex-wrap: wrap; gap: 1rem; }
.stat-card {
    flex: 1 1 160px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.2rem;
}
.stat-label { color: var(--muted); font-size: 0.85rem; }
.stat-value { font-size: 1.9rem; font-weight: 700; }
.stat-sub { color: var(--muted); font-size: 0.8rem; }

.bar-chart {
    display: flex; align-items: flex-end; gap: 2px;
    height: 120px; padding: 0.5rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
.bar-col { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.bar { width: 100%; min-height: 2px; background: var(--accent); border-radius: 2px 2px 0 0; }

/* --- tables --- */
.data-table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
.data-table th, .data-table td {
    text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border);
}
.data-table th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }

/* --- upload / file drop --- */
.upload-form { margin: 0.8rem 0 1.5rem; }
.file-drop {
    display: block;
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 1.4rem;
    text-align: center;
    background: var(--surface);
    cursor: pointer;
}
.file-drop span { display: block; font-weight: 600; margin-bottom: 0.6rem; }

.import-progress { margin: 1rem 0 1.5rem; }
.progress-track {
    height: 12px; background: var(--surface-alt);
    border-radius: 6px; overflow: hidden;
}
.progress-bar {
    height: 100%; width: 0;
    background: var(--accent); border-radius: 6px;
    transition: width 0.2s ease;
}

/* --- admin photo grid --- */
.admin-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.7rem;
    margin-top: 0.8rem;
}
.admin-photo {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.photo-select {
    position: absolute; top: 6px; left: 6px; z-index: 2;
    width: 20px; height: 20px; cursor: pointer; accent-color: var(--accent);
}
.bulk-bar { display: flex; align-items: center; gap: 1rem; margin: 0.8rem 0; flex-wrap: wrap; }
.bulk-bar form { margin: 0; }
.bulk-all { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; cursor: pointer; }
.danger-button:disabled { opacity: 0.45; cursor: not-allowed; }
.admin-photo.is-cover { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.admin-thumb-btn {
    display: block; width: 100%; padding: 0; border: none;
    background: none; cursor: pointer;
}
.admin-photo img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; }
.admin-photo-actions {
    display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
    padding: 0.4rem 0.5rem; font-size: 0.82rem;
}
