/* Club CRM — shared ptmates design language (tokens inherited from padelMate).
   Custom CSS, no framework, CSP-friendly. */
:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --border: #d7deeb;
  --text: #1d2433;
  --muted: #65708a;
  --primary: #4338ca;
  --primary-dark: #3730a3;
  --primary-soft: rgba(99, 102, 241, 0.10);
  --primary-grad: linear-gradient(135deg, #6366f1, #4338ca);
  --danger: #8f2222;
  --danger-bg: #fdecec;
  --success: #1c6432;
  --success-bg: #e8f8ed;
  --warn: #9a3412;
  --warn-bg: #fef3e2;
  --radius: 12px;
  --radius-ctl: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  --shadow-pop: 0 8px 20px rgba(29, 36, 51, 0.12);
  --glow: 0 4px 12px rgba(99, 102, 241, 0.3);
  font-size: 16px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; margin: 0 0 .5rem; letter-spacing: -0.01em; }
h2 { font-size: 1.08rem; margin: 0 0 .75rem; }

/* Top bar — frosted glass, padelMate style */
.topbar {
  background: rgba(255, 255, 255, 0.55);
  border-bottom: 1px solid rgba(215, 222, 235, 0.8);
  backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: .55rem 1rem;
  display: flex; align-items: center; gap: 1rem;
}
.brand { font-weight: 700; font-size: 1.12rem; color: var(--text); letter-spacing: -0.01em; }
.brand span { color: var(--primary); }
.brand:hover { text-decoration: none; }
.topnav {
  margin-left: auto; display: flex; align-items: center; gap: .15rem; flex-wrap: wrap;
  padding: 5px; border: 1px solid rgba(191, 208, 239, 0.9); border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}
.topnav > a, .topnav .linklike {
  display: inline-flex; align-items: center; padding: .4rem .8rem;
  border-radius: 8px; font-weight: 600; font-size: .9rem; color: var(--text);
  line-height: 1; min-height: 32px; border: 1px solid transparent;
}
.topnav > a:hover, .topnav .linklike:hover {
  text-decoration: none; background: rgba(248, 251, 255, 0.95);
  border-color: #bfd0ef; color: var(--primary);
}
.nav-club-name { color: var(--primary-dark); }
.inline-form { display: inline; }
.linklike {
  background: none; border: none; padding: 0; color: var(--primary);
  cursor: pointer; font: inherit;
}
.linklike:hover { text-decoration: underline; }
.topnav .btn-sm { margin-left: .2rem; }

/* Layout */
.page { max-width: 1200px; margin: 1.25rem auto 3rem; padding: 0 1rem; }
.narrow { max-width: 640px; margin: 0 auto; }
.center { text-align: center; }
.page-head { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem 1.15rem; margin-bottom: 1rem;
}

/* Forms */
.stacked { display: flex; flex-direction: column; gap: .8rem; max-width: 420px; }
.stacked label { display: flex; flex-direction: column; gap: .25rem; font-weight: 600; font-size: .88rem; }
input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=number], input[type=date], input[type=time], input[type=file],
select, textarea {
  padding: .5rem .65rem; border: 1px solid var(--border); border-radius: var(--radius-ctl);
  font: inherit; background: #fff; width: 100%; color: var(--text);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.inline-row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.inline-row input[type=text] { max-width: 320px; }
.btn-row { display: flex; gap: .6rem; margin-top: .75rem; flex-wrap: wrap; }

/* Checkboxes — one brand style everywhere (native controls vary wildly) */
input[type=checkbox] {
  appearance: none;
  -webkit-appearance: none;
  width: 1.1rem; height: 1.1rem; min-width: 1.1rem;
  padding: 0; margin: 0;
  border: 1.5px solid #b6c2d9; border-radius: 5px;
  background: #fff; cursor: pointer;
  display: inline-block; vertical-align: -3px;
  position: relative;
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}
input[type=checkbox]:hover { border-color: var(--primary); }
input[type=checkbox]:focus-visible {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
input[type=checkbox]:checked {
  background: var(--primary-grad);
  border-color: transparent;
}
input[type=checkbox]:checked::after {
  content: "";
  position: absolute; left: 4px; top: 1px;
  width: 5px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
input[type=checkbox]:disabled {
  background: #eef1f7; border-color: var(--border); cursor: not-allowed;
}

/* Buttons — indigo gradient primary (padelMate) */
.btn {
  display: inline-block; padding: .5rem .95rem; border-radius: var(--radius-ctl);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; font-weight: 600; font-size: .92rem;
  cursor: pointer; box-shadow: var(--shadow);
  transition: box-shadow 120ms ease, border-color 120ms ease, transform 120ms ease;
}
.btn:hover {
  text-decoration: none; border-color: #bfd0ef; color: var(--primary);
  box-shadow: 0 3px 8px rgba(99, 102, 241, 0.18);
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--primary-grad); border-color: transparent; color: #fff;
}
.btn-primary:hover { color: #fff; box-shadow: var(--glow); }
.btn-outline { background: transparent; border-color: var(--primary); color: var(--primary); box-shadow: none; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { color: #fff; border-color: var(--danger); box-shadow: 0 3px 8px rgba(154, 52, 18, 0.25); }
.btn-sm { padding: .3rem .7rem; font-size: .84rem; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid #e6ebf4; }
.table th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8fafd; }

/* Badges & chips — pastel semantic pairs (padelMate) */
.badge {
  display: inline-block; padding: .12rem .55rem; border-radius: 999px;
  font-size: .74rem; font-weight: 600; background: #eef1f7; color: var(--muted);
  text-transform: lowercase;
}
.badge-published { background: var(--success-bg); color: var(--success); }
.badge-draft { background: var(--warn-bg); color: var(--warn); }
.badge-archived, .badge-muted { background: #eef1f7; color: var(--muted); }
.badge-owner { background: var(--primary-soft); color: var(--primary-dark); }
.badge-admin { background: var(--success-bg); color: var(--success); }
.chip-row { list-style: none; display: flex; gap: .5rem; padding: 0; margin: 0; flex-wrap: wrap; }
.chip {
  padding: .25rem .75rem; border-radius: 999px; background: var(--primary-soft);
  color: var(--primary-dark); font-weight: 600; font-size: .86rem;
}

/* Lists */
.club-list { list-style: none; padding: 0; margin: 0; }
.club-list li { padding: .45rem 0; border-bottom: 1px solid #e6ebf4; display: flex; gap: .6rem; align-items: center; }
.club-list li:last-child { border-bottom: none; }

.dl { display: grid; grid-template-columns: 140px 1fr; gap: .3rem .8rem; margin: 0; }
.dl dt { color: var(--muted); font-size: .88rem; }
.dl dd { margin: 0; }

.muted { color: var(--muted); }

/* Flash messages */
.flash-stack { max-width: 1200px; margin: .75rem auto 0; padding: 0 1rem; }
.flash { padding: .6rem .9rem; border-radius: var(--radius-ctl); margin-bottom: .5rem; font-weight: 500; box-shadow: var(--shadow); }
.flash-success { background: var(--success-bg); color: var(--success); }
.flash-error { background: var(--danger-bg); color: var(--danger); }
.flash-message, .flash-info { background: var(--primary-soft); color: var(--primary-dark); }

/* Auth */
.auth-card { max-width: 420px; margin: 2.5rem auto; }
.divider { display: flex; align-items: center; gap: .8rem; color: var(--muted); margin: 1rem 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* Hero */
.hero { text-align: center; padding: 2.5rem 0 1.5rem; }
.hero h1 { font-size: 2rem; letter-spacing: -0.02em; }
.hero .subtitle { color: var(--muted); font-weight: 600; letter-spacing: .04em; }

/* Portal booking */
.book-filter { align-items: flex-end; }
.book-filter label { display: flex; flex-direction: column; gap: .25rem; font-weight: 600; font-size: .88rem; }
.slot-grid { display: flex; flex-direction: column; gap: .4rem; }
.slot-time { display: flex; gap: 1rem; align-items: baseline; border-bottom: 1px solid #e6ebf4; padding: .35rem 0; }
.slot-time:last-child { border-bottom: none; }
.slot-label { font-weight: 700; min-width: 56px; font-variant-numeric: tabular-nums; }
.slot-courts { display: flex; gap: .5rem; flex-wrap: wrap; }
.slot-btn { display: inline-flex; gap: .5rem; align-items: baseline; }
.slot-btn:hover { border-color: var(--primary); }
.slot-price { color: var(--primary-dark); font-weight: 700; font-size: .8rem; }

/* Wizard — pill cluster mirrors the padelMate nav signature */
.wizard-steps {
  list-style: none; display: flex; gap: .3rem; padding: 5px; margin: 0 0 1.25rem;
  flex-wrap: wrap; border: 1px solid rgba(191, 208, 239, 0.9); border-radius: 12px;
  background: rgba(255, 255, 255, 0.72); width: fit-content;
}
.wizard-steps li {
  padding: .3rem .7rem; border-radius: 8px; background: transparent;
  font-size: .84rem; font-weight: 600; color: var(--muted);
}
.wizard-steps li a { color: inherit; }
.wizard-steps li a:hover { text-decoration: none; color: var(--primary); }
.wizard-steps li.done { color: var(--success); }
.wizard-steps li.current { background: var(--primary-grad); color: #fff; }
.wizard-steps li.current a { color: #fff; }

.stacked.wide { max-width: 720px; }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius-ctl); padding: .75rem 1rem; }
.fieldset legend { font-weight: 600; padding: 0 .4rem; font-size: .9rem; }
/* `.stacked label` sets column flex and outranks a bare `.checkbox-label`,
   which stood every checkbox on top of its own text. Match its
   specificity so a checkbox reads as one line, everywhere. */
.checkbox-label,
.stacked label.checkbox-label,
.fieldset label.checkbox-label {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: .45rem;
  font-weight: 500;
  margin-right: 1rem;
  cursor: pointer;
}
.checkbox-label input { flex: 0 0 auto; }
.input-sm { max-width: 140px; }
.table-compact th, .table-compact td { padding: .3rem .5rem; }
.table-compact input[type=time] { max-width: 120px; }
.chip-sm { font-size: .74rem; padding: .12rem .55rem; }
.danger { color: var(--danger); }
.logo-preview { height: 48px; vertical-align: middle; border-radius: 8px; }
.problem-list { color: var(--danger); margin: 0; padding-left: 1.2rem; }
.problem-list li { margin-bottom: .3rem; }

/* Club photos */
.photo-grid { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.photo-tile { margin: 0; position: relative; }
.photo-tile img {
  width: 180px; height: 120px; object-fit: cover;
  border-radius: var(--radius-ctl); border: 1px solid var(--border);
  display: block;
}
.photo-tile.is-main img { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.photo-actions { display: flex; gap: .6rem; align-items: center; padding-top: .25rem; font-size: .84rem; }
.photo-upload { margin-top: .5rem; }
.photo-upload input[type=file] { max-width: 320px; }

.photo-gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  grid-auto-rows: 130px; gap: .6rem; margin-bottom: 1rem;
}
.photo-gallery img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: var(--radius-ctl); border: 1px solid var(--border);
}
.photo-gallery .gallery-lead { grid-column: span 2; grid-row: span 2; }
@media (max-width: 520px) {
  .photo-gallery .gallery-lead { grid-column: span 1; grid-row: span 1; }
}

.court-card .hours-details { margin-top: .75rem; }
.court-card .hours-details summary { cursor: pointer; font-weight: 600; color: var(--primary); }
.hours-table { max-width: 460px; margin-top: .5rem; }
.court-delete { margin-top: .75rem; display: block; }

/* Admin nav — the padelMate pill-cluster signature */
.admin-nav {
  display: flex; gap: .15rem; margin-bottom: 1rem; flex-wrap: wrap;
  padding: 5px; border: 1px solid rgba(191, 208, 239, 0.9); border-radius: 12px;
  background: rgba(255, 255, 255, 0.72); width: fit-content;
}
.admin-nav a {
  padding: .38rem .8rem; border-radius: 8px; font-weight: 600; font-size: .9rem;
  color: var(--text); border: 1px solid transparent; line-height: 1.2;
}
.admin-nav a:hover {
  text-decoration: none; background: rgba(248, 251, 255, 0.95);
  border-color: #bfd0ef; color: var(--primary);
}
.admin-nav a.on { background: var(--primary-grad); color: #fff; }

/* Dashboard stats */
.stat-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stat { display: flex; flex-direction: column; min-width: 160px; text-decoration: none; color: inherit; }
a.stat:hover { text-decoration: none; border-color: #bfd0ef; box-shadow: 0 3px 8px rgba(99, 102, 241, 0.18); }
.stat-num { font-size: 2rem; font-weight: 700; color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: .88rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Status badges — pastel pairs */
.badge-status-confirmed { background: var(--success-bg); color: var(--success); }
.badge-status-pending { background: var(--warn-bg); color: var(--warn); }
.badge-status-paid { background: var(--primary-soft); color: var(--primary-dark); }
.badge-status-cancelled { background: var(--danger-bg); color: var(--danger); }
.badge-status-completed, .badge-status-no_show { background: #eef1f7; color: var(--muted); }
.cancel-row { margin-top: .8rem; }
.badge-blocked { background: var(--danger-bg); color: var(--danger); }
.row-blocked td { opacity: .6; }
.block-toggle { margin-top: .8rem; display: block; }

/* Notifications */
.notif-badge {
  background: var(--primary-grad); color: #fff; border-radius: 999px;
  padding: 0 .4rem; font-size: .74rem; font-weight: 700;
}
.notif-list { list-style: none; padding: 0; margin: 0; }
.notif-list li { padding: .6rem 0; border-bottom: 1px solid #e6ebf4; }
.notif-list li:last-child { border-bottom: none; }
.notif-list li.unread { background: var(--primary-soft); margin: 0 -1.15rem; padding: .6rem 1.15rem; }
.notif-title { font-weight: 600; }
.notif-meta { font-size: .82rem; }

@media (max-width: 760px) {
  .two-col { grid-template-columns: 1fr; }
  .admin-nav { width: 100%; }
}

@media (max-width: 640px) {
  .dl { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.45rem; }
  /* The stacked topbar is a column flex container, so the nav sizes to
     its content and never wraps — it ran off the side of the screen.
     Stretching it to the bar lets flex-wrap do its job. */
  .topnav { margin-left: 0; width: 100%; }
  .topbar-inner { flex-direction: column; align-items: stretch; gap: .5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .btn, input, select, textarea { transition: none; }
}
