/* ============================================================
   Sport Events – Komoot-Style CSS
   Clean, lots of whitespace, rounded cards, green accents
   ============================================================ */

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

:root {
    --green-500: #6dab3c;
    --green-600: #5a9432;
    --green-700: #4a7d29;
    --green-50:  #f0f8e8;
    --green-100: #dcefc8;

    --gray-50:   #fafafa;
    --gray-100:  #f5f5f5;
    --gray-200:  #eeeeee;
    --gray-300:  #e0e0e0;
    --gray-400:  #bdbdbd;
    --gray-500:  #9e9e9e;
    --gray-600:  #757575;
    --gray-700:  #616161;
    --gray-800:  #424242;
    --gray-900:  #212121;

    --white:     #ffffff;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius:    12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --font:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --max-w:     1200px;
    --transition: 0.2s ease;

    /* Category colors */
    --cat-road:          #e67e22;
    --cat-gravel:        #8e6b3e;
    --cat-marathon:      #e74c3c;
    --cat-half-marathon: #3498db;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--green-600); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--green-700); }

img { max-width: 100%; height: auto; }

/* ── Layout ────────────────────────────────────────────────── */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; width: 100%; }
main { flex: 1; }

/* ── Header ────────────────────────────────────────────────── */
.header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
}

.logo svg { width: 32px; height: 32px; }
.logo span { color: var(--green-600); }

.header-nav {
    display: flex;
    align-items: center;
    gap: 24px;
}

.header-nav a {
    color: var(--gray-600);
    font-weight: 500;
    font-size: 0.9rem;
}
.header-nav a:hover { color: var(--green-600); }

/* ── Hero Section ──────────────────────────────────────────── */
.hero {
    background: linear-gradient(135deg, var(--green-600) 0%, var(--green-700) 100%);
    color: var(--white);
    padding: 48px 0 40px;
    text-align: center;
}

.hero h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.hero p {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* ── Filter Bar ────────────────────────────────────────────── */
.filter-bar {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 20px 24px;
    margin: -24px auto 32px;
    position: relative;
    z-index: 10;
    max-width: var(--max-w);
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 160px;
}

.filter-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: 6px;
}

.filter-group select,
.filter-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: var(--font);
    color: var(--gray-800);
    background: var(--white);
    transition: border-color var(--transition);
    appearance: none;
}

.filter-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23757575' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px var(--green-50);
}

.filter-search {
    flex: 2;
    min-width: 200px;
}

.filter-search input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239e9e9e' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 14px center;
    padding-left: 40px;
}

.btn-filter {
    padding: 10px 24px;
    background: var(--green-600);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: background var(--transition);
    white-space: nowrap;
}
.btn-filter:hover { background: var(--green-700); }

.btn-reset {
    padding: 10px 16px;
    background: transparent;
    color: var(--gray-500);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
}
.btn-reset:hover { border-color: var(--gray-400); color: var(--gray-700); }

/* ── Sort & Results Bar ────────────────────────────────────── */
.results-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.results-count {
    font-size: 0.9rem;
    color: var(--gray-600);
}

.sort-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.sort-controls label {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-weight: 500;
}

.sort-btn {
    padding: 6px 14px;
    font-size: 0.8rem;
    border: 1px solid var(--gray-300);
    border-radius: 20px;
    background: var(--white);
    color: var(--gray-600);
    cursor: pointer;
    font-family: var(--font);
    transition: all var(--transition);
}
.sort-btn:hover { border-color: var(--green-500); color: var(--green-600); }
.sort-btn.active {
    background: var(--green-50);
    border-color: var(--green-500);
    color: var(--green-600);
    font-weight: 600;
}

/* ── Event Cards Grid ──────────────────────────────────────── */
.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.event-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--transition), transform var(--transition);
    display: flex;
    flex-direction: column;
}
.event-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.event-card-body {
    padding: 20px 24px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.event-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.event-category {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 10px;
    border-radius: 20px;
}

.event-category.cat-road          { background: #fef3e6; color: var(--cat-road); }
.event-category.cat-gravel        { background: #f5f0e8; color: var(--cat-gravel); }
.event-category.cat-marathon      { background: #fde8e8; color: var(--cat-marathon); }
.event-category.cat-half-marathon { background: #e8f4fd; color: var(--cat-half-marathon); }

.event-days-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    background: var(--gray-100);
    padding: 4px 10px;
    border-radius: 20px;
}
.event-days-badge.soon { background: #fff3e0; color: #e65100; }
.event-days-badge.today { background: var(--green-50); color: var(--green-700); font-weight: 700; }

.event-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
    line-height: 1.3;
}

.event-card h3 a { color: inherit; }
.event-card h3 a:hover { color: var(--green-600); }

.event-description {
    font-size: 0.88rem;
    color: var(--gray-600);
    line-height: 1.5;
    margin-bottom: 16px;
    flex: 1;
}

.event-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.event-info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--gray-600);
}

.event-info-row svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    fill: var(--gray-400);
}

.event-info-row strong { color: var(--gray-800); font-weight: 600; }

.event-card-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-event {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    background: var(--green-600);
    color: var(--white);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    transition: background var(--transition);
}
.btn-event:hover { background: var(--green-700); color: var(--white); }

.btn-event svg { width: 14px; height: 14px; fill: currentColor; }

.event-deadline {
    font-size: 0.78rem;
    color: var(--gray-500);
}
.event-deadline.urgent { color: #e65100; font-weight: 600; }

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}
.empty-state svg { width: 64px; height: 64px; margin-bottom: 16px; fill: var(--gray-300); }
.empty-state h3 { font-size: 1.2rem; color: var(--gray-700); margin-bottom: 8px; }
.empty-state p { font-size: 0.95rem; }

/* ── Pagination ────────────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 32px 0;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid var(--gray-300);
    color: var(--gray-600);
    transition: all var(--transition);
}
.pagination a:hover { border-color: var(--green-500); color: var(--green-600); }
.pagination .active {
    background: var(--green-600);
    color: var(--white);
    border-color: var(--green-600);
}
.pagination .disabled { opacity: 0.4; pointer-events: none; }

/* ── Footer ────────────────────────────────────────────────── */
.footer {
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    padding: 24px 0;
    margin-top: auto;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.footer-disclaimer {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-style: italic;
}

.footer-links {
    display: flex;
    gap: 16px;
}

.footer-links a {
    font-size: 0.8rem;
    color: var(--gray-500);
}
.footer-links a:hover { color: var(--green-600); }

/* ── Event Detail Page ─────────────────────────────────────── */
.event-detail {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 40px;
    margin: 32px auto;
    max-width: 800px;
}

.event-detail .back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 24px;
}
.event-detail .back-link:hover { color: var(--green-600); }

.event-detail h1 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 16px;
    line-height: 1.25;
}

.event-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 24px 0;
    padding: 24px;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.detail-item label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    font-weight: 600;
    margin-bottom: 4px;
}

.detail-item span {
    font-size: 0.95rem;
    color: var(--gray-800);
    font-weight: 500;
}

.event-detail .btn-event {
    padding: 12px 32px;
    font-size: 1rem;
    border-radius: var(--radius);
}

/* ── Flashes ───────────────────────────────────────────────── */
.flash {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9rem;
    font-weight: 500;
}
.flash.success { background: var(--green-50); color: var(--green-700); border: 1px solid var(--green-100); }
.flash.error   { background: #fde8e8; color: #c0392b; border: 1px solid #f8d7d7; }
.flash.info    { background: #e8f4fd; color: #2980b9; border: 1px solid #d4ecf7; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
    .hero { padding: 32px 0 28px; }
    .hero h1 { font-size: 1.5rem; }
    .hero p { font-size: 0.95rem; }

    .filter-bar { padding: 16px; margin-top: -16px; }
    .filter-row { flex-direction: column; }
    .filter-group { min-width: 100%; }

    .events-grid { grid-template-columns: 1fr; gap: 16px; }

    .event-detail { padding: 24px 20px; margin: 16px auto; }
    .event-detail h1 { font-size: 1.4rem; }
    .event-detail-grid { grid-template-columns: 1fr; }

    .header-inner { height: 56px; }
    .header-nav { gap: 16px; }

    .footer-inner { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
    .results-bar { flex-direction: column; align-items: flex-start; }
    .sort-controls { flex-wrap: wrap; }
}
