/* ============================================================
   Gilden-Eventkalender – gemeinsames Stylesheet
   ============================================================ */

:root {
  --ink: #10141c;
  --panel: #1a2029;
  --panel-2: #212836;
  --line: #2b3242;
  --text: #e9e4d8;
  --muted: #93a0b5;
  --gold: #c9a45c;
  --gold-soft: #8a744a;

  --c-chaos: #e0703f;
  --c-drache: #c0392b;
  --c-duell: #4a7fb5;
  --c-expedition: #3f9c7a;
  --c-kvk: #7d5ba6;
  --c-lordscup: #d4af37;
  --c-event: #5b6ee1;

  --radius: 10px;
  --shadow: 0 8px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: "Cinzel", "Georgia", serif;
  letter-spacing: .02em;
  font-weight: 600;
  margin: 0;
}

a { color: inherit; }

button {
  font-family: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ---------- Login page (bewusst neutral gehalten) ---------- */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow);
}

.login-card h1 {
  font-size: 1.3rem;
  text-align: center;
  margin-bottom: 6px;
  color: var(--text);
}

.login-sub {
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
  margin-bottom: 24px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: .78rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 10px 12px;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: .95rem;
}

.field input:focus {
  border-color: var(--gold-soft);
}

.login-btn {
  width: 100%;
  padding: 11px;
  background: var(--gold);
  border: none;
  border-radius: 6px;
  color: #1a1509;
  font-weight: 600;
  font-size: .95rem;
  margin-top: 4px;
}

.login-btn:hover { background: #d6b06c; }

.discord-btn {
  display: block;
  box-sizing: border-box;
  text-align: center;
  text-decoration: none;
  background: #5865f2;
  color: #fff;
  margin-top: 14px;
}

.discord-btn:hover { background: #4752c4; }

.login-error {
  min-height: 18px;
  color: #e07a7a;
  font-size: .82rem;
  text-align: center;
  margin-top: 12px;
}

.login-hint {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  font-size: .74rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ---------- Calendar app ---------- */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}

.app-title {
  font-size: 1.25rem;
  color: var(--text);
}

.app-title small {
  display: block;
  font-family: "Inter", sans-serif;
  font-size: .72rem;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: .04em;
  margin-top: 2px;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .85rem;
  color: var(--muted);
}

.logout-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 6px;
  font-size: .8rem;
}

.logout-btn:hover { border-color: var(--gold-soft); }

.discord-link-btn {
  background: transparent;
  border: 1px solid #5865f2;
  color: #5865f2;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: .8rem;
}

.discord-link-btn:hover { background: #5865f2; color: #fff; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 24px 60px;
}

.notice {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.notice strong { color: var(--text); }

.monster-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  color: var(--text);
  background: linear-gradient(135deg, rgba(164, 94, 229, .16), rgba(164, 94, 229, .05));
  border: 1px solid rgba(164, 94, 229, .35);
  border-radius: 8px;
  padding: 9px 12px;
  margin-bottom: 14px;
}

.monster-banner strong {
  color: #c48cf0;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-bottom: 22px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .78rem;
  color: var(--muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 8px 0 18px;
}

.month-nav button {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1rem;
}

.month-nav button:hover { border-color: var(--gold-soft); }

.month-label {
  font-family: "Cinzel", serif;
  font-size: 1.15rem;
  min-width: 200px;
  text-align: center;
}

.status-toggle {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}

.status-toggle span {
  font-size: .74rem;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 20px;
}

.status-toggle .dash {
  border-style: dashed;
}

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

.weekday-head {
  text-align: center;
  font-size: .72rem;
  color: var(--muted);
  padding-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.day-cell {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 92px;
  padding: 6px 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}

.monster-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a45ee5;
  box-shadow: 0 0 0 1px rgba(164, 94, 229, .35);
}

.day-num-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.monster-label {
  display: none;
}

@media (min-width: 721px) {
  .monster-label {
    display: inline-block;
    font-size: .62rem;
    color: #c48cf0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  .monster-dot {
    display: none;
  }
}

.day-cell.other-month {
  opacity: .3;
}

.day-cell.free {
  background: #171d27;
}

.day-cell.free::after {
  content: "frei";
  font-size: .62rem;
  color: #52664f;
  margin-top: auto;
  align-self: flex-start;
}

.day-cell.today {
  border-color: var(--gold);
}

.day-events {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.chip-more {
  display: none;
}

.day-num {
  font-size: .78rem;
  color: var(--muted);
  font-weight: 600;
}

.day-cell.today .day-num {
  color: var(--gold);
}

.chip {
  font-size: .62rem;
  line-height: 1.25;
  padding: 2px 6px;
  border-radius: 4px;
  color: #10141c;
  font-weight: 600;
  white-space: normal;
  cursor: default;
}

.chip.estimated {
  color: var(--text);
  background: transparent !important;
  border: 1px dashed currentColor;
  font-weight: 500;
  opacity: .85;
}

.chip.reg {
  opacity: .75;
  font-style: italic;
}

/* event colors */
.bg-chaos { background: var(--c-chaos); }
.bg-drache { background: var(--c-drache); }
.bg-duell { background: var(--c-duell); }
.bg-expedition { background: var(--c-expedition); }
.bg-kvk { background: var(--c-kvk); }
.bg-lordscup { background: var(--c-lordscup); }
.bg-event { background: var(--c-event); }

.col-chaos { color: var(--c-chaos); }
.col-drache { color: var(--c-drache); }
.col-duell { color: var(--c-duell); }
.col-expedition { color: var(--c-expedition); }
.col-kvk { color: var(--c-kvk); }
.col-lordscup { color: var(--c-lordscup); }
.col-event { color: var(--c-event); }

/* Popover / detail panel */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(6,8,12,.6);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 20;
}

.overlay.open { display: flex; }

.detail-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-width: 380px;
  width: 100%;
  padding: 22px;
  box-shadow: var(--shadow);
}

.detail-card h3 {
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.detail-card .detail-date {
  color: var(--muted);
  font-size: .82rem;
  margin-bottom: 14px;
}

.detail-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.detail-monster-row {
  font-size: .82rem;
  color: var(--text);
  background: rgba(164, 94, 229, .12);
  border: 1px solid rgba(164, 94, 229, .3);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 10px;
}

.detail-monster-row strong {
  color: #c48cf0;
}

.detail-empty {
  font-size: .8rem;
  color: var(--muted);
  padding: 4px 2px 2px;
}

.detail-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: .85rem;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--panel-2);
}

.detail-row-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.detail-row .dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  margin-top: 4px;
  flex-shrink: 0;
}

.detail-row .rtitle { font-weight: 600; }
.detail-row .rtime { color: var(--muted); font-size: .78rem; }
.detail-row .rtag {
  font-size: .68rem;
  color: var(--muted);
  border: 1px dashed var(--line);
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: auto;
  white-space: nowrap;
}

.detail-row .rtag-manual {
  color: var(--gold);
  border-style: solid;
  border-color: var(--gold-soft);
}

.confirm-btn,
.undo-btn {
  font-family: inherit;
  font-size: .68rem;
  padding: 4px 9px;
  border-radius: 12px;
  white-space: nowrap;
}

.confirm-btn {
  background: var(--gold);
  border: none;
  color: #1a1509;
  font-weight: 600;
}

.confirm-btn:hover { background: #d6b06c; }
.confirm-btn:disabled { opacity: .6; cursor: default; }

.undo-btn {
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--muted);
}

.undo-btn:hover { border-color: var(--gold-soft); color: var(--text); }
.undo-btn:disabled { opacity: .6; cursor: default; }

.close-btn {
  width: 100%;
  padding: 9px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
}

.close-btn:hover { border-color: var(--gold-soft); }

/* ---- Account-Verwaltung ---- */
.admin-btn {
  background: transparent;
}

.admin-card {
  max-width: 440px;
}

.admin-user-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0 16px;
  max-height: 40vh;
  overflow-y: auto;
}

.admin-loading {
  font-size: .82rem;
  color: var(--muted);
  padding: 8px 0;
}

.admin-user-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-2);
  border-radius: 6px;
  padding: 7px 9px;
}

.admin-user-name {
  flex: 1;
  font-size: .85rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-role-select {
  font-family: inherit;
  font-size: .74rem;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 6px;
}

.admin-pw-btn,
.admin-del-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 7px;
  font-size: .8rem;
  line-height: 1;
}

.admin-del-btn:hover { border-color: #d9635f; }
.admin-pw-btn:hover { border-color: var(--gold-soft); }

.admin-add-form {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-add-title {
  font-size: .78rem;
  color: var(--muted);
  font-weight: 600;
}

.admin-input {
  font-family: inherit;
  font-size: .85rem;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  width: 100%;
}

.admin-add-btn {
  width: 100%;
  border: none;
}

.admin-error {
  font-size: .78rem;
  color: #d9635f;
  min-height: 1em;
}

@media (max-width: 720px) {
  .app-header {
    padding: 12px 14px;
    gap: 8px;
  }
  .app-title { font-size: 1.05rem; }
  .app-title small { font-size: .62rem; }
  .user-box { font-size: .74rem; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
  .logout-btn { padding: 6px 10px; font-size: .74rem; }

  .container { padding: 12px 10px 40px; }

  .notice { font-size: .74rem; padding: 10px 12px; margin-bottom: 14px; }

  .monster-banner { font-size: .72rem; padding: 7px 10px; margin-bottom: 10px; }
  .monster-dot { width: 5px; height: 5px; top: 4px; right: 4px; }

  .legend {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 14px;
    padding-bottom: 6px;
    margin-bottom: 14px;
    -webkit-overflow-scrolling: touch;
  }
  .legend-item { font-size: .7rem; flex-shrink: 0; }

  .month-nav { margin: 4px 0 12px; gap: 14px; }
  .month-label { font-size: .98rem; min-width: 150px; }
  .month-nav button { width: 30px; height: 30px; }

  .status-toggle { gap: 8px; margin-bottom: 12px; }
  .status-toggle span { font-size: .66rem; padding: 4px 9px; }

  .calendar-grid { gap: 3px; }
  .weekday-head { font-size: .6rem; padding-bottom: 4px; }

  .day-cell {
    min-height: 46px;
    padding: 3px 2px;
    border-radius: 6px;
    gap: 3px;
  }
  .day-num { font-size: .68rem; }

  /* Volle Text-Chips würden auf schmalen Zellen umbrechen und die
     Zelle unregelmäßig hoch machen -> auf dem Handy nur Punkte zeigen,
     Details gibt's per Tap im Overlay. */
  .day-events {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px;
  }

  .chip {
    font-size: 0;
    line-height: 0;
    width: 7px;
    height: 7px;
    min-width: 0;
    padding: 0;
    border-radius: 50%;
    white-space: normal;
  }
  .chip.estimated {
    border-width: 1.5px;
  }

  .chip-more {
    display: block;
    font-size: .55rem;
    line-height: 1;
    color: var(--muted);
    font-weight: 600;
    align-self: center;
  }

  .day-cell.free::after { display: none; }

  .overlay { padding: 14px; align-items: flex-end; }
  .detail-card { max-width: none; border-radius: 14px 14px 0 0; padding: 18px; }
}
