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

:root {
  --bg:          #0f0f13;
  --surface:     #1a1a24;
  --surface2:    #22222f;
  --border:      #2e2e40;
  --primary:     #5865f2;
  --primary-hov: #4752c4;
  --primary-lt:  #a5adff;
  --success:     #57f287;
  --danger:      #ed4245;
  --warning:     #fee75c;
  --text:        #e3e3ef;
  --text-muted:  #8888aa;
  --radius:      10px;
  --radius-sm:   6px;
}

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  min-height: 100vh;
}

/* ------------------------------------------------------------------ */
/* Utilities                                                            */
/* ------------------------------------------------------------------ */
.hidden { display: none !important; }

/* ------------------------------------------------------------------ */
/* Modal                                                                */
/* ------------------------------------------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: min(420px, 90vw);
  text-align: center;
}

.modal h2 { font-size: 1.4rem; margin-bottom: .5rem; }
.modal-sub   { color: var(--text-muted); font-size: .85rem; margin-bottom: 1.5rem; }
.modal-error { color: var(--danger);     font-size: .85rem; margin-bottom: 1.5rem; }

.pin-form { display: flex; flex-direction: column; gap: .75rem; }

.pin-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 1.4rem;
  letter-spacing: .4em;
  padding: .6rem .75rem;
  text-align: center;
  width: 100%;
}
.pin-input:focus { border-color: var(--primary); outline: none; }

.pin-actions { display: flex; gap: .5rem; justify-content: center; }

.player-buttons {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.player-select-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  padding: .85rem 1rem;
  transition: background .15s, border-color .15s;
}
.player-select-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
}

/* ------------------------------------------------------------------ */
/* Header                                                               */
/* ------------------------------------------------------------------ */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .9rem 1.25rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.logo {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: .5px;
  flex-shrink: 0;
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.bestimmer-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .3rem .85rem;
  font-size: .85rem;
}
.bestimmer-badge.me {
  background: rgba(88, 101, 242, .2);
  border-color: var(--primary);
  color: var(--primary-lt);
  font-weight: 600;
}

.btn-skip {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-size: .85rem;
  padding: .25rem .6rem;
  transition: border-color .15s, color .15s;
}
.btn-skip:hover { border-color: var(--text-muted); color: var(--text); }
.btn-skip.armed { border-color: var(--warning); color: var(--warning); }

.my-badge {
  font-size: .85rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .25rem .7rem;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* Main layout                                                          */
/* ------------------------------------------------------------------ */
.main-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* ------------------------------------------------------------------ */
/* Cards                                                                */
/* ------------------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

/* ------------------------------------------------------------------ */
/* Accepted session                                                     */
/* ------------------------------------------------------------------ */
.accepted-card {
  background: rgba(87, 242, 135, .06);
  border: 1px solid rgba(87, 242, 135, .3);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  position: relative;
}

.btn-ics {
  position: absolute;
  top: .85rem;
  right: .85rem;
  font-size: 1rem;
  opacity: .35;
  text-decoration: none;
  line-height: 1;
  transition: opacity .15s;
}
.btn-ics:hover { opacity: .8; }

.btn-cancel-session {
  position: absolute;
  bottom: .85rem;
  right: .85rem;
  background: none;
  border: none;
  color: var(--danger);
  font-size: 1rem;
  opacity: .35;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: opacity .15s;
}
.btn-cancel-session:hover { opacity: .9; }
.btn-cancel-session.armed {
  opacity: 1;
  transform: scale(1.2);
  transition: transform .1s;
}

.accepted-card h2 {
  font-size: 1.1rem;
  color: var(--success);
}

.session-date {
  font-size: 1.1rem;
  font-weight: 600;
}

.session-game {
  font-size: 1rem;
  font-weight: 600;
  color: var(--success);
}

.session-bestimmer {
  font-size: .85rem;
  color: var(--text-muted);
}

.session-bestimmer-name {
  color: var(--primary);
  font-weight: 600;
}

/* ------------------------------------------------------------------ */
/* Propose form                                                         */
/* ------------------------------------------------------------------ */
.propose-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 280px;
  margin: 0 auto;
}

.propose-field-row {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.propose-field-row label {
  font-size: .85rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  width: 3.5rem;
  text-align: right;
}

.propose-field-row input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  padding: .5rem .75rem;
  flex: 1;
  min-width: 0;
}

.propose-field-row input:focus {
  border-color: var(--primary);
  outline: none;
}

/* ------------------------------------------------------------------ */
/* Inline calendar                                                      */
/* ------------------------------------------------------------------ */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .4rem;
}

.cal-title {
  font-size: .85rem;
  font-weight: 600;
}

.cal-nav {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: .1rem .45rem;
  transition: background .15s, border-color .15s;
}
.cal-nav:hover { background: var(--primary); border-color: var(--primary); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.cal-dow {
  font-size: .75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-align: center;
  padding: .15rem 0 .35rem;
}

.cal-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: .8rem;
  cursor: pointer;
  transition: background .1s;
  user-select: none;
  border: 1px solid transparent;
  padding: .2rem;
}
.cal-cell:not(.past):not(.cal-empty):hover {
  background: var(--surface2);
  border-color: var(--border);
}
.cal-cell.past {
  color: var(--text-muted);
  opacity: .35;
  cursor: not-allowed;
}
.cal-cell.today {
  color: var(--primary);
  font-weight: 700;
}
.cal-cell.selected {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  border-color: var(--primary);
}
.cal-cell.selected:hover { background: var(--primary-hov); }
.cal-cell.cal-empty { cursor: default; }

.cal-selected-label {
  font-size: .85rem;
  color: var(--text-muted);
  margin-top: .3rem;
}
.cal-none  { opacity: .6; }
.cal-error { color: var(--danger) !important; opacity: 1 !important; }

/* ------------------------------------------------------------------ */
/* Candidate cards                                                      */
/* ------------------------------------------------------------------ */
.candidates-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.candidate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .9rem;
}

.candidate-header {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  flex-wrap: wrap;
}

.candidate-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.slot-badge {
  font-size: .75rem;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .2rem .6rem;
}

/* Availability grid */
.availability-grid {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.avail-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .85rem;
}

.avail-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}
.avail-dot.yes  { background: var(--success); box-shadow: 0 0 6px rgba(87,242,135,.5); }
.avail-dot.no   { background: var(--danger);  box-shadow: 0 0 6px rgba(237,66,69,.4); }
.avail-dot.open {
  background: transparent;
  border: 2px solid var(--text-muted);
}

.avail-name  { color: var(--text); }
.avail-label { color: var(--text-muted); font-size: .75rem; }

/* Card actions */
.card-actions {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  align-items: center;
}

/* ------------------------------------------------------------------ */
/* Buttons                                                              */
/* ------------------------------------------------------------------ */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  padding: .5rem 1rem;
  transition: opacity .15s, background .15s;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hov); }

.btn-accept   { background: rgba(87,242,135,.15); color: var(--success); border: 1px solid rgba(87,242,135,.4); }
.btn-accept:hover:not(:disabled) { background: rgba(87,242,135,.25); }

.btn-delete              { background: rgba(237,66,69,.12); color: var(--danger); border: 1px solid rgba(237,66,69,.3); }
.btn-delete:hover:not(:disabled) { background: rgba(237,66,69,.22); }
.btn-delete.armed-delete { background: rgba(237,66,69,.35); border-color: var(--danger); font-weight: 600; }

/* Availability toggle (Nicht-Bestimmer) */
.avail-toggle { display: flex; gap: .5rem; }

.btn-avail {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: .4rem .85rem;
  font-size: .85rem;
  border-radius: var(--radius-sm);
}
.btn-avail:hover { border-color: var(--primary); color: var(--text); }
.btn-avail.active-yes  { background: rgba(87,242,135,.15); border-color: var(--success); color: var(--success); }
.btn-avail.active-no   { background: rgba(237,66,69,.12); border-color: var(--danger); color: var(--danger); }
.btn-avail.active-open { border-color: var(--text-muted); color: var(--text); }

/* ------------------------------------------------------------------ */
/* Budget section                                                       */
/* ------------------------------------------------------------------ */
.budget-progress-lg {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin: .4rem 0 .6rem;
}

.budget-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width .3s ease;
}

.budget-players {
  display: flex;
  flex-direction: column;
  gap: .85rem;
}

.budget-player-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .85rem 1rem;
}

.budget-player-card.is-me {
  background: rgba(88, 101, 242, .04);
}

.budget-player-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.budget-player-header.clickable {
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: .1rem .1rem;
  margin: -.1rem -.1rem;
  transition: background .15s;
}
.budget-player-header.clickable:hover { background: rgba(255,255,255,.04); }

.budget-chevron { font-size: .75rem; color: var(--text-muted); margin-left: .35rem; }

.budget-player-name  { font-weight: 600; font-size: 1rem; }
.budget-player-total { font-size: .85rem; color: var(--text-muted); }

.budget-entries { display: flex; flex-direction: column; }

.budget-entry {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  padding: .25rem 0;
  border-bottom: 1px solid var(--border);
}
.budget-entry:last-of-type { border-bottom: none; }

.budget-entry-game   { flex: 1; }
.budget-entry-amount { color: var(--text-muted); white-space: nowrap; }

.btn-budget-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: .75rem;
  opacity: .35;
  padding: 0 .2rem;
  transition: opacity .15s, color .15s;
}
.btn-budget-delete:hover { opacity: .9; color: var(--danger); }
.btn-budget-delete.armed { opacity: 1; color: var(--danger); }

.budget-empty {
  font-size: .85rem;
  color: var(--text-muted);
  padding: .35rem 0;
}

.budget-add-form {
  display: flex;
  gap: .5rem;
  margin-top: .85rem;
  flex-wrap: wrap;
}

.budget-add-form input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  padding: .4rem .65rem;
}
.budget-add-form input:focus { border-color: var(--primary); outline: none; }

.budget-game-input   { flex: 1; min-width: 130px; }
.budget-amount-input { width: 90px; }
