/* =====================================================
   TC Endingen – Platzbuchungssystem
   Primärfarbe: #1a4d2e (Dunkelgrün aus Logo)
   ===================================================== */

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

:root {
  --green:      #1a4d2e;
  --green-dark: #133a22;
  --green-light:#e8f0eb;
  --green-mid:  #2d6b45;
  --white:      #ffffff;
  --gray-50:    #f8f9fa;
  --gray-100:   #f0f0f0;
  --gray-200:   #e0e0e0;
  --gray-400:   #9e9e9e;
  --gray-700:   #444;
  --red:        #c0392b;
  --red-light:  #fdecea;
  --radius:     10px;
  --shadow:     0 2px 12px rgba(0,0,0,.08);
  --font:       'Inter', sans-serif;
}

body {
  font-family: var(--font);
  background: var(--gray-50);
  color: var(--gray-700);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- HEADER ---- */
.header {
  background: var(--green);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 1rem;
  padding: .75rem 1.5rem;
}
.logo-link { flex-shrink: 0; }
.logo { height: 56px; width: auto; filter: brightness(0) invert(1); }
.header-title { flex: 1; }
.header-title h1 { font-size: 1.3rem; font-weight: 700; letter-spacing: -.3px; }
.header-title p  { font-size: .8rem; opacity: .75; margin-top: 1px; }
.btn-back {
  background: rgba(255,255,255,.15);
  color: var(--white);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: var(--radius);
  padding: .45rem 1rem;
  font-size: .85rem; font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background .2s;
}
.btn-back:hover { background: rgba(255,255,255,.25); }

/* ---- MAIN ---- */
.main { flex: 1; max-width: 1200px; margin: 0 auto; width: 100%; padding: 1.5rem 1rem 2rem; }
.form-main { max-width: 680px; }

/* ---- COURT TABS ---- */
.court-tabs { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: .75rem 1rem; margin-bottom: 1rem; }
.tabs-inner { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.tabs-label { font-weight: 600; font-size: .9rem; color: var(--green); margin-right: .25rem; }
.tab {
  padding: .4rem 1rem; border-radius: 6px;
  border: 2px solid var(--green-light);
  color: var(--green); font-weight: 500; font-size: .9rem;
  text-decoration: none; transition: all .2s;
}
.tab:hover  { background: var(--green-light); }
.tab.active { background: var(--green); color: var(--white); border-color: var(--green); }

/* ---- WEEK NAV ---- */
.week-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: .75rem 1rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.week-label { text-align: center; font-size: .95rem; }
.badge-today {
  display: inline-block; background: var(--green); color: var(--white);
  font-size: .72rem; font-weight: 600; border-radius: 20px;
  padding: .15rem .6rem; margin-left: .4rem; vertical-align: middle;
}
.btn-week {
  background: var(--green); color: var(--white);
  border-radius: 6px; padding: .4rem .9rem;
  font-size: .85rem; font-weight: 500; text-decoration: none;
  transition: background .2s;
}
.btn-week:hover { background: var(--green-dark); }

/* ---- CALENDAR ---- */
.calendar-wrapper { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 1rem; }
.calendar-scroll  { overflow-x: auto; }

.calendar { width: 100%; border-collapse: collapse; min-width: 650px; }
.calendar th, .calendar td { border: 1px solid var(--gray-200); }
.calendar thead th {
  background: var(--green); color: var(--white);
  text-align: center; font-size: .8rem; font-weight: 600;
  padding: .55rem .3rem;
}
.calendar thead th.today { background: var(--green-mid); }
.day-name { display: block; }
.day-date { display: block; font-weight: 400; opacity: .85; }

.time-col { width: 58px; }
.time-col,
.time-label {
  position: sticky;
  left: 0;
  z-index: 5;
}
.time-col { z-index: 7; }
.time-label {
  text-align: center; font-size: .78rem; color: var(--gray-400);
  padding: 0 .3rem; background: var(--gray-50); white-space: nowrap;
  box-shadow: 2px 0 4px rgba(0,0,0,.06);
}

.slot { height: 30px; cursor: default; transition: filter .15s; }
.slot.free   { background: #d4edda; cursor: pointer; }
.slot.free:hover { filter: brightness(.93); }
.slot.booked { background: #fde8e8; }
.slot.blocked{ background: var(--gray-100); }
.slot.past   { background: var(--gray-50); }
.slot-inner  { display: block; font-size: .72rem; text-align: center; line-height: 30px; padding: 0 .25rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #555; }

/* ---- LEGEND ---- */
.legend { display: flex; gap: 1.25rem; flex-wrap: wrap; font-size: .82rem; color: #555; margin-bottom: 1.5rem; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: .3rem; vertical-align: middle; }
.dot.free    { background: #d4edda; border: 1px solid #aad4b8; }
.dot.booked  { background: #fde8e8; border: 1px solid #f5c6c6; }
.dot.blocked { background: var(--gray-100); border: 1px solid var(--gray-200); }
.dot.past    { background: var(--gray-50);  border: 1px solid var(--gray-200); }

/* ---- CARD ---- */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; }

/* ---- BOOKING FORM ---- */
.booking-info { display: flex; flex-direction: column; gap: .6rem; background: var(--green-light); border-radius: 8px; padding: 1rem; margin-bottom: 1.25rem; }
.info-row { display: flex; align-items: center; gap: .75rem; font-size: .93rem; }
.info-icon { font-size: 1.1rem; }

.booking-form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-group label { font-size: .85rem; font-weight: 600; color: var(--green-dark); }
.form-group input, .form-group select, .form-group textarea {
  border: 1.5px solid var(--gray-200); border-radius: 7px;
  padding: .55rem .8rem; font-family: var(--font); font-size: .92rem;
  transition: border-color .2s; background: var(--white);
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--green); }
.hint { font-size: .8rem; color: var(--gray-400); margin-top: .25rem; }
.hint a { color: var(--green); }
.checkbox-label { display: flex; align-items: center; gap: .5rem; cursor: pointer; font-size: .9rem; }
.checkbox-label input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--green); }
.form-hint { font-size: .78rem; color: var(--gray-400); text-align: center; }

/* ---- BUTTONS ---- */
.btn-primary {
  background: var(--green); color: var(--white);
  border: none; border-radius: 8px; padding: .7rem 1.5rem;
  font-family: var(--font); font-size: .95rem; font-weight: 600;
  cursor: pointer; text-decoration: none; display: inline-block;
  transition: background .2s;
}
.btn-primary:hover { background: var(--green-dark); }
.btn-primary:disabled { background: var(--gray-200); color: var(--gray-400); cursor: not-allowed; }
.btn-full { width: 100%; text-align: center; }
.btn-danger {
  background: var(--red); color: var(--white);
  border: none; border-radius: 8px; padding: .7rem 1.5rem;
  font-family: var(--font); font-size: .95rem; font-weight: 600;
  cursor: pointer; text-decoration: none; display: inline-block;
  transition: background .2s;
}
.btn-danger:hover { background: #a93226; }
.btn-sm {
  padding: .45rem .75rem;
  font-size: .82rem;
  border-radius: 6px;
  min-width: 90px;
  text-align: center;
  line-height: 1.2;
}


/* ---- ALERTS ---- */
.alert-error   { background: var(--red-light); color: var(--red); border-radius: 7px; padding: .75rem 1rem; font-size: .9rem; margin-bottom: .75rem; }
.alert-success { background: var(--green-light); color: var(--green); border-radius: 7px; padding: .75rem 1rem; font-size: .9rem; margin-bottom: .75rem; }

/* ---- SUCCESS CARD ---- */
.success-card { text-align: center; padding: 2.5rem 1.5rem; }
.success-icon  { width: 64px; height: 64px; border-radius: 50%; background: var(--green); color: var(--white); font-size: 1.8rem; line-height: 64px; margin: 0 auto 1.25rem; font-weight: 700; }
.success-card h2 { margin-bottom: .75rem; color: var(--green); }
.success-card p  { color: #666; margin-bottom: 1.5rem; line-height: 1.6; }

/* ---- ADMIN ---- */
.admin-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card   { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; text-align: center; }
.stat-num    { font-size: 2rem; font-weight: 700; color: var(--green); }
.stat-label  { font-size: .82rem; color: var(--gray-400); margin-top: .25rem; }

.filter-form { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.filter-form .form-group { min-width: 140px; }

.admin-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.admin-table th { background: var(--green-light); color: var(--green-dark); text-align: left; padding: .6rem .75rem; font-weight: 600; border-bottom: 2px solid var(--green-light); }
.admin-table td { padding: .55rem .75rem; border-bottom: 1px solid var(--gray-100); }
.admin-table tr:hover td { background: var(--gray-50); }
.admin-table a { color: var(--green); }

/* ---- FOOTER ---- */
.footer { background: var(--green-dark); color: rgba(255,255,255,.7); text-align: center; padding: 1rem; font-size: .82rem; margin-top: auto; }
.footer a { color: rgba(255,255,255,.85); }

/* ---- RESPONSIVE ---- */
@media (max-width: 640px) {
  .header-inner { flex-wrap: wrap; }
  .form-row { grid-template-columns: 1fr; }
  .admin-stats { grid-template-columns: 1fr; }
  .week-nav { flex-direction: column; text-align: center; }
  .filter-form { flex-direction: column; }
}
