/* ============================================================
   PRS – Platzreservierungssystem · Tennis Sand Theme
   ============================================================ */

:root {
  --prs-red:       #b91c1c;
  --prs-red-dark:  #7f1d1d;
  --prs-red-mid:   #dc2626;
  --prs-red-light: #fca5a5;
  --prs-sand:      #fdf0e0;
  --prs-sand-mid:  #f5e0c0;
  --prs-sand-dark: #e6c89a;
  --prs-text:      #1a1a1a;
  --prs-muted:     #6b6b6b;
  --prs-card-bg:   #ffffff;
  --prs-border:    #e5d5c5;
  --prs-shadow:    0 2px 12px rgba(185,28,28,.10);
  --prs-radius:    12px;
  --slot-h:        48px;  /* height per 60-min slot (reduced 20%) */
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }

html { height: 100%; }

body {
  font-family: 'Barlow', sans-serif;
  background: var(--prs-sand);
  color: var(--prs-text);
  min-height: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* ── Navbar ── */
.prs-navbar {
  background: linear-gradient(135deg, var(--prs-red-dark) 0%, var(--prs-red) 100%);
  box-shadow: 0 2px 16px rgba(127,29,29,.35);
  min-height: 58px;
}

/* Mobile: collapsed menu overlays content, doesn't push footer */
@media (max-width: 991px) {
  .prs-navbar .navbar-collapse {
    position: absolute;
    top: 58px;
    left: 0;
    right: 0;
    z-index: 1050;
    background: linear-gradient(180deg, var(--prs-red-dark) 0%, #6b1010 100%);
    box-shadow: 0 8px 24px rgba(0,0,0,.35);
    padding: .5rem 1rem 1rem;
    max-height: calc(100vh - 58px);
    overflow-y: auto;
    border-top: 1px solid rgba(255,255,255,.15);
  }
  .prs-navbar .navbar-collapse .nav-item { border-bottom: 1px solid rgba(255,255,255,.08); }
  .prs-navbar .navbar-collapse .nav-link { padding: .65rem .5rem; font-size: .95rem; }
  .prs-navbar .navbar-collapse .dropdown-menu {
    background: rgba(0,0,0,.25);
    border: none;
    padding-left: 1rem;
  }
  .prs-navbar .navbar-collapse .dropdown-item { color: rgba(255,255,255,.85); font-size: .9rem; }
  .prs-navbar .navbar-collapse .dropdown-item:hover { background: rgba(255,255,255,.1); color: #fff; }
}
.brand-icon { font-size: 1rem; color: var(--prs-red-light); line-height: 1; }
.brand-text  { font-family: 'Barlow Condensed', sans-serif; font-size: 1.6rem; font-weight: 800; letter-spacing: .04em; color: #fff; }
.brand-accent{ color: var(--prs-red-light); }
.brand-sub   { font-size: .8rem; font-weight: 400; color: rgba(255,255,255,.65); letter-spacing: .06em; }
.navbar-logo { height: 36px; width: auto; object-fit: contain; border-radius: 4px; }

.prs-navbar .nav-link {
  font-weight: 600;
  font-size: .88rem;
  letter-spacing: .04em;
  color: rgba(255,255,255,.85) !important;
  padding: .5rem .9rem;
  border-radius: 8px;
  transition: background .2s, color .2s;
}
.prs-navbar .nav-link:hover,
.prs-navbar .nav-link.active {
  background: rgba(255,255,255,.15);
  color: #fff !important;
}
.prs-navbar .dropdown-toggle::after { vertical-align: .15em; }

.prs-dropdown {
  border: none;
  border-radius: var(--prs-radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
  overflow: hidden;
}
.prs-dropdown .dropdown-item {
  font-weight: 500;
  font-size: .875rem;
  padding: .55rem 1.1rem;
  transition: background .15s;
}
.prs-dropdown .dropdown-item:hover { background: var(--prs-sand); color: var(--prs-red); }
.prs-dropdown .dropdown-divider { border-color: var(--prs-border); }

/* User pill */
.user-pill { display: flex; align-items: center; gap: .5rem; }
.user-avatar {
  width: 32px; height: 32px;
  background: rgba(255,255,255,.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
}
.user-name { font-weight: 600; font-size: .875rem; color: #fff; }
.role-badge {
  background: rgba(255,255,255,.2);
  color: #fff;
  font-size: .7rem;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: .06em;
}

/* ── Main ── */
.prs-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;   /* allow vertical scroll for all pages */
}

/* ── Footer ── */
.prs-footer {
  flex-shrink: 0;   /* never squished — always visible */
  background: var(--prs-red-dark);
  color: rgba(255,255,255,.7);
  font-size: .8rem;
  padding: .65rem 0;
}

/* ── Cards ── */
.prs-card {
  background: var(--prs-card-bg);
  border-radius: var(--prs-radius);
  box-shadow: var(--prs-shadow);
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--prs-border);
}

/* ── Buttons ── */
.btn-prs {
  background: var(--prs-red);
  color: #fff;
  border: none;
  font-weight: 700;
  letter-spacing: .04em;
  border-radius: 8px;
  transition: background .2s, transform .1s;
}
.btn-prs:hover  { background: var(--prs-red-dark); color: #fff; transform: translateY(-1px); }
.btn-prs:active { transform: translateY(0); }
.btn-ghost      { background: transparent; border: 1.5px solid var(--prs-border); color: var(--prs-muted); border-radius: 8px; }
.btn-ghost:hover{ background: var(--prs-sand); }

/* ── Page title ── */
.page-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--prs-red-dark);
}

/* ── Tables ── */
.prs-table { border-collapse: separate; border-spacing: 0; }
.prs-table thead th {
  background: var(--prs-red-dark);
  color: #fff;
  font-weight: 700;
  font-size: .8rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .65rem 1rem;
  border: none;
}
.prs-table thead th:first-child { border-radius: 8px 0 0 0; }
.prs-table thead th:last-child  { border-radius: 0 8px 0 0; }
.prs-table tbody td { padding: .65rem 1rem; vertical-align: middle; border-bottom: 1px solid var(--prs-border); }
.prs-table tbody tr:last-child td { border-bottom: none; }
.prs-table tbody tr:hover td { background: var(--prs-sand); }

/* ── Auth Layout ── */
.auth-body {
  background: linear-gradient(135deg, var(--prs-red-dark) 0%, #c2410c 60%, var(--prs-sand-dark) 100%);
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.auth-wrapper { width: 100%; max-width: 420px; }
.auth-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  padding: 2.5rem 2rem;
}
.auth-brand { text-align: center; margin-bottom: 2rem; }
.auth-logo {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--prs-red-dark), var(--prs-red));
  border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 2rem; color: #fff; margin-bottom: .75rem;
  box-shadow: 0 8px 24px rgba(185,28,28,.3);
}
.auth-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2.5rem; font-weight: 800;
  color: var(--prs-red-dark);
  line-height: 1;
}
.auth-title span { color: var(--prs-red); }
.auth-subtitle { font-size: .85rem; color: var(--prs-muted); letter-spacing: .08em; font-weight: 600; margin-top: .2rem; }
.auth-form .form-label { font-weight: 600; font-size: .875rem; color: var(--prs-text); margin-bottom: .35rem; }
.auth-form .input-group-text { background: var(--prs-sand); border-right: none; color: var(--prs-red); }
.auth-form .form-control { border-left: none; }
.auth-form .form-control:focus { box-shadow: none; border-color: #ced4da; }

/* ── Date Navigation ── */
.date-nav .btn-outline-danger { border-radius: 8px; font-weight: 600; }
.date-picker-input {
  max-width: 155px;
  font-weight: 600;
  border-radius: 8px;
  border-color: var(--prs-red-light);
  cursor: pointer;
}
.date-picker-input:focus { border-color: var(--prs-red); box-shadow: 0 0 0 3px rgba(185,28,28,.15); }
.date-display {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--prs-muted);
  letter-spacing: .04em;
}

/* ═══════════════════════════════════════════════════════════
   SCHEDULE GRID  –  fit-to-screen, sticky header, vert scroll
   ═══════════════════════════════════════════════════════════ */

/* schedule-wrapper: outer container for the schedule grid */
.schedule-wrapper {
  border-radius: var(--prs-radius);
  box-shadow: var(--prs-shadow);
  border: 1px solid var(--prs-border);
  background: var(--prs-card-bg);
  /* NO overflow:hidden - that clips sched-body scroll and hides the grid */
}

/* sched-outer: clips rounded corners, allows internal scroll */
.sched-outer {
  width: 100%;
  overflow: hidden;      /* clips border-radius corners */
  border-radius: var(--prs-radius);
}

/* ── Sticky header ── */
.sched-head {
  display: grid;
  position: sticky;
  top: 0;
  z-index: 20;
  width: 100%;
  /* gridTemplateColumns set by JS - must match sched-body-grid exactly */
}

.sched-corner {
  background: var(--prs-red-dark);
  display: block;
  text-align: left;
  padding: 0 0 3px 3px;
  font-size: .58rem;
  font-weight: 700;
  color: rgba(255,255,255,.5);
  letter-spacing: .04em;
  text-transform: uppercase;
  user-select: none;
  vertical-align: bottom;
  line-height: 1;
  /* Ensure the cell fills to bottom so text aligns with court-header bottom */
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  box-sizing: border-box;
  width: 100%;
}

/* Date-group header row (multi-day, row 1) */
.sched-date-head {
  background: var(--prs-red-dark);
  color: rgba(255,255,255,.92);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .05em;
  padding: .25rem .3rem;
  border-left: 1px solid rgba(255,255,255,.1);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.sched-date-head.is-today   { background: var(--prs-red); }
.sched-date-head.day-sep    { border-left: 2px solid rgba(255,255,255,.35); }

/* Court-name header row */
.sched-court-head {
  background: var(--prs-red);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: .95rem;
  letter-spacing: .05em;
  padding: .45rem .3rem;
  border-left: 1px solid rgba(255,255,255,.18);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.sched-court-head.is-today  { background: #b91c1c; }
.sched-court-head.day-sep   { border-left: 2px solid rgba(255,255,255,.35); }

/* ── Scrollable body ── */
.sched-body {
  overflow-y: auto;
  overflow-x: hidden;
  /* Enough height to show the calendar without overflowing the viewport */
  max-height: calc(100vh - 230px);
  min-height: 300px;     /* always visible even on short screens */
  background: var(--prs-card-bg);
}
.sched-body-grid {
  display: grid;
  width: 100%;
  /* gridTemplateColumns set by JS - same value as sched-head */
}

/* Time-label column */
.sched-time-col {
  position: relative;
  background: #f8f4f0;
  border-right: 1px solid var(--prs-border);
}
.sched-time-label {
  position: absolute;
  left: 0; right: 0;
  text-align: center;
  font-size: .72rem;     /* was .62rem — larger for readability */
  font-weight: 700;
  color: var(--prs-muted);
  transform: translateY(-50%);
  pointer-events: none;
  user-select: none;
}

/* Day columns */
.sched-day-col {
  position: relative;
  border-left: 1px solid var(--prs-border);
  background: #fff;
  min-width: 0;        /* allow shrinking below content */
  overflow: hidden;    /* clip res-blocks that overflow horizontally */
}
.sched-day-col.is-today  { background: #fffbf5; }
.sched-day-col.day-sep   { border-left: 3px solid var(--prs-sand-dark); }

/* Hour / half-hour lines */
.sched-hour-line {
  position: absolute;
  left: 0; right: 0;
  border-top: 1px solid #e8ddd0;
  pointer-events: none;
}
/* Current-time indicator line */
.sched-now-line {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: var(--prs-red);
  z-index: 5;
  pointer-events: none;
}
.sched-now-line::before {
  content: '';
  position: absolute;
  left: -4px; top: -4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--prs-red);
}
.sched-hour-line.half {
  border-top-style: dashed;
  opacity: .45;
}

/* Clickable slot areas */
.sched-slot-click {
  position: absolute;
  left: 0; right: 0;
  cursor: pointer;
  z-index: 1;
  transition: background .1s;
}
.sched-slot-click:hover { background: rgba(185,28,28,.06); }

/* ── Reservation blocks ── */
.res-block {
  position: absolute;
  left: 2px; right: 2px;
  border-radius: 6px;
  padding: 3px 5px;
  overflow: hidden;
  cursor: pointer;
  z-index: 2;
  transition: opacity .12s, filter .12s;
  box-shadow: 0 1px 5px rgba(0,0,0,.18);
  border: 1.5px solid rgba(255,255,255,.3);
  line-height: 1.25;
}
.res-block:hover { filter: brightness(1.08); z-index: 3; }

/* Line 1 – member name (bold) */
.res-member {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: .72rem;
}
/* Line 2 – type (normal) */
.res-type {
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: .67rem;
  opacity: .9;
}
/* Line 3 – time */
.res-time {
  font-size: .62rem;
  opacity: .78;
  white-space: nowrap;
}
/* Lines 3/4/5 – additional players / guests */
.res-extra {
  font-size: .62rem;
  opacity: .85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Line last – info */
.res-info {
  font-size: .6rem;
  opacity: .7;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Own-reservation ring */
.res-own   { outline: 2px solid rgba(255,255,255,.6); outline-offset: -2px; }

/* Sperre: hatch pattern overlay */
.res-sperre::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 5px;
  background: repeating-linear-gradient(
    -45deg, transparent, transparent 5px,
    rgba(255,255,255,.14) 5px, rgba(255,255,255,.14) 7px
  );
  pointer-events: none;
}

/* Player select — native dropdown with keyboard pre-selection on all platforms */
.player-select {
  font-size: .875rem;
  /* On iOS/Android the native picker opens; typing first letter jumps to match */
}
/* On touch devices, make the select taller so it's easier to tap */
@media (hover: none) and (pointer: coarse) {
  .player-select {
    min-height: 44px;
    font-size: 1rem;  /* prevents iOS auto-zoom on focus */
  }
}
.type-legend { }
.legend-item {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .78rem; font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1.5px solid transparent;
}
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ── Modal ── */
.prs-modal {
  border-radius: 16px;
  overflow: hidden;
  border: none;
}
.prs-modal .modal-header {
  background: linear-gradient(135deg, var(--prs-red-dark), var(--prs-red));
  color: #fff;
  border: none;
  padding: 1rem 1.5rem;
}
.prs-modal .modal-title { font-family: 'Barlow Condensed', sans-serif; font-size: 1.3rem; font-weight: 700; }
.prs-modal .modal-body  { padding: 1.5rem; background: var(--prs-sand); }
.prs-modal .modal-footer{ background: #fff; border-top: 1px solid var(--prs-border); padding: .85rem 1.5rem; }
.prs-modal .form-label  { font-size: .82rem; font-weight: 700; color: var(--prs-muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .3rem; }

/* ── Stat Cards ── */
.stat-card {
  background: var(--prs-card-bg);
  border-radius: var(--prs-radius);
  box-shadow: var(--prs-shadow);
  border: 1px solid var(--prs-border);
  padding: 1.5rem;
  text-align: center;
}
.stat-icon { font-size: 2rem; color: var(--prs-red); margin-bottom: .5rem; }
.stat-value { font-family: 'Barlow Condensed', sans-serif; font-size: 2.2rem; font-weight: 800; color: var(--prs-red-dark); }
.stat-label { font-size: .82rem; color: var(--prs-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }

/* ── Weekday bar chart (baseline at bottom) ── */
.weekday-chart {
  display: flex;
  align-items: flex-end;   /* baseline at bottom */
  gap: 6px;
  height: 180px;           /* total chart height */
  padding-bottom: 28px;    /* space for labels */
  position: relative;
  border-bottom: 2px solid var(--prs-border);
}
.weekday-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end; /* bars grow upward from baseline */
}
.weekday-bar-val {
  font-size: .68rem;
  font-weight: 700;
  color: var(--prs-muted);
  min-height: 16px;
  display: flex;
  align-items: flex-end;
}
.weekday-bar-area {
  width: 100%;
  display: flex;
  align-items: flex-end;   /* bar anchored to bottom */
  flex: 1;
  max-height: 130px;       /* bar area only (above labels) */
}
.weekday-bar {
  width: 100%;
  background: var(--prs-red);
  border-radius: 4px 4px 0 0;
  transition: height .4s ease;
  min-height: 0;
}
.weekday-bar-label {
  position: absolute;
  bottom: 2px;
  font-size: .72rem;
  font-weight: 600;
  color: var(--prs-muted);
  width: calc(100% / 7);
  text-align: center;
}
/* Position day labels evenly */
.weekday-bar-wrap { position: relative; }
.weekday-bar-wrap .weekday-bar-label {
  position: static;
  margin-top: 4px;
  width: 100%;
}

/* ── Member bar chart (horizontal stacked) ── */
.member-chart {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.member-bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 48px;
  align-items: center;
  gap: 8px;
  min-height: 22px;
}
.member-bar-name {
  font-size: .78rem;
  font-weight: 600;
  color: var(--prs-text);
}
.member-bar-track {
  display: flex;
  height: 18px;
  background: var(--prs-sand);
  border-radius: 4px;
  overflow: hidden;
}
.member-bar-seg {
  height: 100%;
  transition: width .4s ease;
}
.seg-book { background: var(--prs-red); }
.seg-play { background: #f97316; }
.seg-gast { background: #94a3b8; }
.member-bar-val {
  font-size: .72rem;
  font-weight: 700;
  color: var(--prs-muted);
  text-align: right;
  white-space: nowrap;
}
@media (max-width: 576px) {
  .member-bar-row { grid-template-columns: 100px 1fr 40px; }
  .member-bar-name { font-size: .7rem; }
}

/* ── Toast ── */
.prs-toast-container {
  position: fixed;
  bottom: 1.5rem; right: 1.5rem;
  z-index: 9999;
}
.prs-toast {
  background: var(--prs-red-dark);
  color: #fff;
  border-radius: 10px;
  padding: .75rem 1.25rem;
  font-weight: 600;
  font-size: .875rem;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
  animation: toastIn .25s ease;
}
.prs-toast.success { background: #15803d; }
.prs-toast.danger  { background: var(--prs-red); }
@keyframes toastIn { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:none; } }

/* ── Form controls ── */
.form-control:focus, .form-select:focus {
  border-color: var(--prs-red-light);
  box-shadow: 0 0 0 3px rgba(185,28,28,.12);
}
.form-check-input:checked { background-color: var(--prs-red); border-color: var(--prs-red); }

/* ── Utility ── */
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* ── Responsive ── */
@media (max-width: 576px) {
  .prs-card { padding: 1rem; }
  .sched-body { max-height: calc(100vh - 190px); }
  .res-member { font-size: .65rem; }
  .res-type   { font-size: .6rem; }
  .res-time, .res-info { display: none; }
}
@media (max-width: 768px) {
  .sched-body { max-height: calc(100vh - 200px); }
}
