/* ── CUSTOM PROPERTIES ── */
:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #e0e7ff;
  --surface: #ffffff;
  --background: #f0f2f5;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1),0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07),0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1),0 4px 6px rgba(0,0,0,0.05);
  --radius: 8px;
  --radius-lg: 12px;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--background); color: var(--text); line-height: 1.6; -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; }
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── LAYOUT ── */
.page-wrapper { display: flex; flex-direction: column; min-height: 100vh; }
.page-main { flex: 1; padding: 2rem 0; }
.container { width: 100%; max-width: 1024px; margin: 0 auto; padding: 0 1.5rem; }
.container--narrow { max-width: 680px; }
.container--wide { max-width: 1280px; }
.page-section { margin-bottom: 2rem; }
.page-title { font-size: 1.875rem; font-weight: 700; color: var(--text); margin-bottom: 0.5rem; }
.page-subtitle { font-size: 1rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.section-title { font-size: 1.25rem; font-weight: 600; color: var(--text); margin-bottom: 1rem; }

/* ── HEADER ── */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm); position: sticky; top: 0; z-index: 100; }
.site-header-inner { display: flex; align-items: center; justify-content: space-between; padding: 0.875rem 1.5rem; max-width: 1024px; margin: 0 auto; gap: 1rem; }
.site-logo { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; flex-shrink: 0; }
.site-logo:hover { text-decoration: none; }
.site-logo-img { width: 40px; height: 40px; }
.site-title { font-size: 1.25rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.site-tagline { font-size: 0.75rem; color: var(--text-muted); line-height: 1.2; }

/* ── NAVIGATION ── */
.site-nav { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
.nav-link { padding: 0.375rem 0.75rem; border-radius: var(--radius); font-size: 0.875rem; font-weight: 500; color: var(--text-muted); transition: background 0.15s, color 0.15s; white-space: nowrap; }
.nav-link:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.nav-link--active { color: var(--primary); background: var(--primary-light); font-weight: 600; }

/* ── MOBILE NAV ── */
.mobile-menu-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: var(--radius); padding: 0.375rem; cursor: pointer; color: var(--text-muted); }
.mobile-nav { display: none; flex-direction: column; border-top: 1px solid var(--border); background: var(--surface); }
.mobile-nav--open { display: flex; }
.mobile-nav-link { padding: 0.75rem 1.5rem; font-size: 0.9375rem; font-weight: 500; color: var(--text); border-bottom: 1px solid var(--border); }
.mobile-nav-link:hover { background: var(--background); text-decoration: none; }
.mobile-nav-link--active { color: var(--primary); font-weight: 600; }

/* ── USER MENU ── */
.user-menu { position: relative; }
.user-menu-btn { display: flex; align-items: center; gap: 0.5rem; padding: 0.375rem 0.75rem 0.375rem 0.375rem; background: none; border: 1px solid var(--border); border-radius: 2rem; cursor: pointer; font-size: 0.875rem; font-weight: 500; color: var(--text); transition: border-color 0.15s, background 0.15s; white-space: nowrap; }
.user-menu-btn:hover { border-color: var(--primary); background: var(--primary-light); }
.user-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); flex-shrink: 0; }
.user-menu-btn-text { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.user-dropdown { display: none; position: absolute; right: 0; top: calc(100% + 0.5rem); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); min-width: 240px; z-index: 200; overflow: hidden; }
.user-dropdown--open { display: block; }
.user-info { display: flex; align-items: center; gap: 0.75rem; padding: 1rem; border-bottom: 1px solid var(--border); }
.user-info .user-avatar { width: 40px; height: 40px; }
.user-name { font-size: 0.875rem; font-weight: 600; color: var(--text); }
.user-email { font-size: 0.75rem; color: var(--text-muted); }
.role-badge { display: inline-block; background: var(--primary-light); color: var(--primary); font-size: 0.7rem; font-weight: 600; padding: 0.125rem 0.5rem; border-radius: 1rem; margin: 0.125rem; }
.user-logout-link { display: block; padding: 0.75rem 1rem; font-size: 0.875rem; color: var(--danger); border-top: 1px solid var(--border); font-weight: 500; }
.user-logout-link:hover { background: var(--danger-bg); text-decoration: none; }
.auth-btn { padding: 0.5rem 1.25rem; background: var(--primary); color: #fff; border-radius: var(--radius); font-size: 0.875rem; font-weight: 600; white-space: nowrap; transition: background 0.15s; }
.auth-btn:hover { background: var(--primary-hover); color: #fff; text-decoration: none; }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem; padding: 0.5rem 1rem; border-radius: var(--radius); font-size: 0.875rem; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: all 0.15s; text-decoration: none; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn--primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn--secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn--secondary:hover { background: var(--background); border-color: var(--text-muted); }
.btn--danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn--danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn--ghost { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn--ghost:hover { background: var(--primary-light); }
.btn--small { padding: 0.25rem 0.625rem; font-size: 0.75rem; }
.btn--large { padding: 0.75rem 1.5rem; font-size: 1rem; }

/* ── CARDS ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.card-body { padding: 1.25rem; }
.card-footer { padding: 0.75rem 1.25rem; border-top: 1px solid var(--border); background: var(--background); display: flex; gap: 0.5rem; justify-content: flex-end; }

/* ── FORMS ── */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.875rem; font-weight: 500; color: var(--text); margin-bottom: 0.375rem; }
.form-input, .form-select, .form-textarea { width: 100%; padding: 0.5rem 0.75rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.9375rem; font-family: inherit; color: var(--text); transition: border-color 0.15s, box-shadow 0.15s; }
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
.form-textarea { min-height: 100px; resize: vertical; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; padding-right: 2rem; cursor: pointer; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-check { display: flex; align-items: center; gap: 0.5rem; }
.form-check input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.form-check-label { font-size: 0.875rem; color: var(--text); cursor: pointer; }

/* ── FLASH MESSAGES ── */
.flash { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1.5rem; font-size: 0.875rem; border: 1px solid transparent; }
.flash--success { background: var(--success-bg); color: #166534; border-color: #bbf7d0; }
.flash--error { background: var(--danger-bg); color: #991b1b; border-color: #fecaca; }
.flash--warning { background: var(--warning-bg); color: #92400e; border-color: #fde68a; }

/* ── CLUB GRID ── */
.club-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }
.club-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; transition: box-shadow 0.2s, transform 0.2s; text-decoration: none; color: inherit; display: flex; flex-direction: column; }
.club-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }
.club-card-img { width: 100%; height: 180px; object-fit: cover; background: var(--background); }
.club-card-body { padding: 1rem; flex: 1; position: relative; }
.club-card-name { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 0.375rem; transition: color 0.15s; }
.club-card:hover .club-card-name { color: var(--primary); }
.club-card-location { font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 0.25rem; display: flex; align-items: center; gap: 0.25rem; }
.club-card-schedule { font-size: 0.8125rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.25rem; }
.club-card-badge { position: absolute; top: 0.75rem; right: 0.75rem; }

/* ── STATUS BADGES ── */
.status-badge { display: inline-block; font-size: 0.7rem; font-weight: 600; padding: 0.2rem 0.6rem; border-radius: 1rem; text-transform: uppercase; letter-spacing: 0.05em; }
.status-badge--seeking { background: #dcfce7; color: #166534; }
.status-badge--full { background: #fed7aa; color: #9a3412; }
.status-badge--inactive { background: #fee2e2; color: #991b1b; }
.status-badge--active { background: var(--primary-light); color: var(--primary); }

/* ── FILTER PANEL ── */
.filter-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); margin-bottom: 1.5rem; overflow: hidden; }
.filter-toggle { display: flex; align-items: center; justify-content: space-between; padding: 0.875rem 1.25rem; cursor: pointer; user-select: none; }
.filter-toggle-label { font-size: 0.9375rem; font-weight: 600; color: var(--text); }
.filter-toggle-icon { color: var(--text-muted); transition: transform 0.2s; }
.filter-panel.expanded .filter-toggle-icon { transform: rotate(180deg); }
.filter-content { display: none; padding: 0.75rem 1.25rem 1.25rem; border-top: 1px solid var(--border); }
.filter-panel.expanded .filter-content { display: block; }
.filter-group { margin-bottom: 1rem; }
.filter-group:last-child { margin-bottom: 0; }
.filter-group-label { font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.filter-buttons { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.filter-btn { padding: 0.25rem 0.75rem; border-radius: 1rem; border: 1px solid var(--border); background: var(--background); font-size: 0.8125rem; font-weight: 500; cursor: pointer; transition: all 0.15s; color: var(--text-muted); }
.filter-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.filter-btn--active { background: var(--primary); border-color: var(--primary); color: #fff; }
.filter-reset { width: 100%; margin-top: 1rem; }

/* ── CLUB DETAIL ── */
.club-detail-header { margin-bottom: 1.5rem; }
.club-detail-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }
.club-carousel { border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 1.5rem; background: var(--background); }
.club-carousel-img { width: 100%; height: 280px; object-fit: cover; }
.club-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.club-info-item { background: var(--background); border-radius: var(--radius); padding: 0.75rem 1rem; }
.club-info-label { font-size: 0.7rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.25rem; }
.club-info-value { font-size: 0.9375rem; font-weight: 500; color: var(--text); }
.club-map-embed { border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 1.5rem; border: 1px solid var(--border); }
.club-map-embed iframe { display: block; width: 100%; height: 280px; border: none; }
.club-about { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1.5rem; }
.club-contact-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1.5rem; }

/* ── REVIEWS ── */
.review-section { margin-top: 2rem; }
.review-list { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }
.review-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1rem 1.25rem; }
.review-score { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.review-stars { font-size: 1rem; letter-spacing: 0.1em; }
.review-comment { font-size: 0.9375rem; color: var(--text); margin-bottom: 0.5rem; }
.review-meta { font-size: 0.75rem; color: var(--text-muted); display: flex; gap: 1rem; }
.review-form { background: var(--background); border-radius: var(--radius-lg); padding: 1.25rem; }

/* ── CHALLENGES ── */
.challenge-list { display: flex; flex-direction: column; gap: 1rem; }
.challenge-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; }
.challenge-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.challenge-teams { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; margin-bottom: 0.75rem; }
.challenge-team { text-align: center; }
.challenge-vs { text-align: center; font-weight: 700; color: var(--text-muted); font-size: 1.125rem; }
.challenge-status { font-size: 0.75rem; font-weight: 600; padding: 0.2rem 0.6rem; border-radius: 1rem; background: var(--primary-light); color: var(--primary); }
.challenge-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 0.75rem; }

/* ── ADMIN ── */
.admin-page { max-width: 800px; }
.admin-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1.5rem; }
.admin-user-search { display: flex; gap: 0.5rem; align-items: flex-end; margin-bottom: 1rem; }
.admin-results { display: flex; flex-direction: column; gap: 0.75rem; }
.admin-user-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; background: var(--background); border-radius: var(--radius); }
.admin-role-list { display: flex; flex-wrap: wrap; gap: 0.25rem; flex: 1; }
.admin-role-form { display: flex; gap: 0.5rem; align-items: center; }

/* ── ADMIN SUB-NAV ── */
.admin-subnav { background: var(--surface); border-bottom: 1px solid var(--border); }
.admin-subnav-inner { display: flex; gap: 0; max-width: 1024px; margin: 0 auto; padding: 0 1.5rem; overflow-x: auto; }
.admin-subnav-link { padding: 0.625rem 1rem; font-size: 0.875rem; font-weight: 500; color: var(--text-muted); white-space: nowrap; border-bottom: 2px solid transparent; transition: color 0.15s, border-color 0.15s; text-decoration: none; }
.admin-subnav-link:hover { color: var(--primary); text-decoration: none; }
.admin-subnav-link--active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ── ADMIN RESULTS TABLE ── */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.admin-table th { text-align: left; padding: 0.5rem 0.75rem; background: var(--background); color: var(--text-muted); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); }
.admin-table td { padding: 0.625rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: middle; word-break: break-word; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--background); }

/* ── COOKIE BANNER ── */
.cookie-banner { position: fixed; bottom: 0; left: 0; right: 0; background: #1f2937; color: #f9fafb; padding: 1rem 1.5rem; display: flex; align-items: center; gap: 1.5rem; z-index: 500; flex-wrap: wrap; }
.cookie-banner-text { flex: 1; font-size: 0.875rem; min-width: 200px; }
.cookie-banner-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

/* ── FOOTER ── */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 1.5rem 0; margin-top: auto; }
.site-footer-text { font-size: 0.8125rem; color: var(--text-muted); text-align: center; }

/* ── UTILS ── */
.text-muted { color: var(--text-muted); }
.text-small { font-size: 0.8125rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.icon-text { display: inline-flex; align-items: center; gap: 0.375rem; }
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--text-muted); }
.empty-state-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.empty-state-text { font-size: 1rem; }
.list-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 0.75rem; }

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  .site-nav { display: none; }
  .mobile-menu-toggle { display: flex; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .site-header-inner { padding: 0.75rem 1rem; }
  .page-main { padding: 1.25rem 0; }
  .club-grid { grid-template-columns: 1fr; }
  .club-carousel-img { height: 200px; }
  .club-info-grid { grid-template-columns: 1fr 1fr; }
  .challenge-teams { grid-template-columns: 1fr; }
  .challenge-vs { display: none; }
  .admin-user-search { flex-direction: column; }
  .admin-user-row { flex-wrap: wrap; }
  .cookie-banner { flex-direction: column; align-items: flex-start; }
}