/* ====================================================
   Community Kalender – Stylesheet
   ==================================================== */

:root {
  --bg:           #f4f6fb;
  --surface:      #ffffff;
  --surface-2:    #eef1f8;
  --border:       #e0e5f0;
  --text:         #0f172a;
  --text-muted:   #64748b;
  --accent:       #2563eb;
  --accent-light: #dbeafe;
  --accent-dark:  #1d4ed8;
  --danger:       #dc2626;
  --success:      #16a34a;
  --font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --radius:       8px;
  --radius-lg:    14px;
  --shadow-sm:    0 1px 3px rgba(15,23,42,.07), 0 1px 2px rgba(15,23,42,.04);
  --shadow:       0 4px 12px rgba(15,23,42,.10);
  --shadow-lg:    0 12px 30px rgba(15,23,42,.16);
  --header-h:     58px;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
}
.header-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 0 1.5rem; height: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.header-logo {
  display: flex; align-items: center; gap: .5rem;
  font-weight: 800; font-size: 1.1rem; letter-spacing: -.3px;
}
.logo-mark { color: var(--accent); font-size: 1.1rem; }

.header-nav { display: flex; align-items: center; gap: .75rem; }

/* View switcher */
.view-switcher {
  display: flex;
  background: var(--surface-2);
  border-radius: 7px; padding: 3px;
}
.view-btn {
  background: transparent; border: none;
  padding: .3rem .85rem; border-radius: 5px;
  font-size: .83rem; font-weight: 500; color: var(--text-muted);
  cursor: pointer; transition: all .15s;
}
.view-btn.active {
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-sm);
}

.header-actions { display: flex; align-items: center; gap: .5rem; }

/* ── Buttons ─────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .48rem 1rem; border: none; border-radius: var(--radius);
  font-size: .875rem; font-weight: 500; cursor: pointer;
  transition: all .15s; white-space: nowrap; font-family: var(--font);
}
.btn-primary   { background: var(--accent);    color: white; }
.btn-primary:hover   { background: var(--accent-dark); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger    { background: var(--danger);    color: white; }
.btn-danger:hover    { background: #b91c1c; }
.btn-sm        { padding: .3rem .7rem; font-size: .8rem; }

.icon-btn {
  font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  color: var(--text-muted); text-decoration: none;
  padding: .3rem .55rem; border-radius: 5px;
  border: 1px solid var(--border); transition: all .15s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Main ────────────────────────────────────────── */
.main { max-width: 1280px; margin: 0 auto; padding: 1.5rem; }

/* ── Club filter pills ───────────────────────────── */
.filters { margin-bottom: 1.25rem; }
.club-filters { display: flex; flex-wrap: wrap; gap: .5rem; }
.club-filter-btn {
  padding: .3rem .85rem; border-radius: 999px;
  border: 2px solid transparent; font-size: .78rem; font-weight: 600;
  cursor: pointer; transition: all .15s; opacity: .65;
}
.club-filter-btn.active { opacity: 1; border-color: rgba(0,0,0,.2); }

/* ── Views ───────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

/* ── Calendar ────────────────────────────────────── */
.calendar-nav {
  display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem;
}
.month-title { font-size: 1.2rem; font-weight: 800; min-width: 210px; text-align: center; }

.nav-arrow {
  background: var(--surface); border: 1px solid var(--border);
  width: 36px; height: 36px; border-radius: var(--radius);
  font-size: 1.3rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text); transition: all .15s;
}
.nav-arrow:hover { border-color: var(--accent); color: var(--accent); }

.calendar-grid {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm);
}
.calendar-week-headers {
  display: grid; grid-template-columns: repeat(7,1fr);
  background: var(--surface-2); border-bottom: 2px solid var(--border);
}
.calendar-day-header {
  padding: .6rem .5rem; font-size: .72rem; font-weight: 700;
  text-align: center; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .07em;
}
.calendar-days { display: grid; grid-template-columns: repeat(7,1fr); }

.calendar-cell {
  min-height: 110px; padding: .4rem;
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  cursor: default; transition: background .1s;
}
.calendar-cell:nth-child(7n) { border-right: none; }
.calendar-cell:not(.other-month):hover { background: #f8faff; }
.calendar-cell.other-month { background: #fafafa; }
.calendar-cell.other-month .cell-day { color: #c8cdd8; }

.calendar-cell.today .cell-day {
  background: var(--accent); color: white;
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.cell-day {
  font-size: .8rem; font-weight: 700; margin-bottom: .3rem;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center; border-radius: 50%;
}
.cell-events { display: flex; flex-direction: column; gap: 2px; }
.cell-event {
  font-size: .68rem; padding: 2px 5px; border-radius: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; transition: opacity .15s; line-height: 1.4;
  font-weight: 500;
}
.cell-event:hover { opacity: .75; }
.cell-more { font-size: .65rem; color: var(--text-muted); padding: 1px 5px; cursor: pointer; }

/* ── List View ───────────────────────────────────── */
.list-group   { margin-bottom: 2.5rem; }
.list-month-header {
  font-size: .72rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .1em; color: var(--text-muted);
  margin-bottom: .75rem; padding-bottom: .5rem;
  border-bottom: 2px solid var(--border);
}
.list-event {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.1rem;
  margin-bottom: .5rem; display: flex; gap: 1.1rem;
  cursor: pointer; transition: all .15s;
}
.list-event:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-1px); }

.list-event-date   { text-align: center; min-width: 50px; padding-top: .1rem; }
.list-event-day    { font-size: 1.65rem; font-weight: 900; line-height: 1; color: var(--accent); }
.list-event-month  { font-size: .68rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }

.list-event-body   { flex: 1; min-width: 0; }
.list-event-title  { font-weight: 700; margin-bottom: .3rem; font-size: .95rem; }
.list-event-meta   { font-size: .8rem; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: .6rem; }
.list-event-club   { margin-top: .4rem; }

.club-badge {
  font-size: .7rem; font-weight: 700; padding: 2px 9px;
  border-radius: 999px; color: white; display: inline-block;
}

/* ── FAB ─────────────────────────────────────────── */
.fab {
  position: fixed; bottom: 2rem; right: 2rem;
  width: 54px; height: 54px;
  background: var(--accent); color: white;
  border: none; border-radius: 50%;
  font-size: 1.6rem; line-height: 1; cursor: pointer;
  box-shadow: 0 4px 16px rgba(37,99,235,.45);
  transition: all .15s; z-index: 50;
  display: flex; align-items: center; justify-content: center;
}
.fab:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(37,99,235,.55); }
.fab.hidden { display: none; }

/* ── Modal ───────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--surface); border-radius: var(--radius-lg);
  width: 100%; max-width: 540px; max-height: 92vh;
  overflow-y: auto; box-shadow: var(--shadow-lg);
  animation: modalIn .18s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
.modal-header {
  padding: 1.2rem 1.5rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-title  { font-weight: 800; font-size: 1.05rem; }
.modal-close  { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-body   { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem; border-top: 1px solid var(--border);
  display: flex; gap: .5rem; justify-content: flex-end;
}

/* ── Forms ───────────────────────────────────────── */
.form-group   { margin-bottom: 1rem; }
.form-label   { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .3rem; }
.form-control {
  width: 100%; padding: .5rem .75rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: .875rem; font-family: var(--font);
  background: var(--surface); color: var(--text); transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-row     { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.form-check   { display: flex; align-items: center; gap: .5rem; font-size: .875rem; }
.form-hint    { font-size: .73rem; color: var(--text-muted); margin-top: .25rem; }
.form-error   { background: #fef2f2; border: 1px solid #fecaca; color: var(--danger); padding: .75rem; border-radius: var(--radius); font-size: .85rem; margin-bottom: 1rem; }

/* ── Event detail ────────────────────────────────── */
.event-detail-title  { font-size: 1.2rem; font-weight: 800; margin-bottom: .6rem; }
.event-detail-info   { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.event-detail-row    { display: flex; gap: .5rem; font-size: .875rem; }
.event-detail-row strong { color: var(--text); min-width: 100px; font-weight: 600; }
.event-detail-row span   { color: var(--text-muted); }
.event-detail-desc   { font-size: .875rem; line-height: 1.7; white-space: pre-wrap; border-top: 1px solid var(--border); padding-top: 1rem; color: var(--text-muted); }

/* ── User menu ───────────────────────────────────── */
.user-menu { position: relative; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-light); border: none;
  font-size: .78rem; font-weight: 800; color: var(--accent);
  cursor: pointer; transition: all .15s;
}
.user-avatar:hover { background: var(--accent); color: white; }
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  min-width: 185px; z-index: 300;
  animation: modalIn .12s ease;
}
.user-dropdown.hidden { display: none; }
.user-dropdown-item {
  display: block; padding: .6rem 1rem; font-size: .85rem;
  color: var(--text); text-decoration: none; cursor: pointer;
  border: none; background: none; width: 100%; text-align: left;
  transition: background .1s; font-family: var(--font);
}
.user-dropdown-item:hover { background: var(--surface-2); }
.user-dropdown-item.danger { color: var(--danger); }
.user-dropdown-divider { height: 1px; background: var(--border); }

/* ── Toast ───────────────────────────────────────── */
.toast {
  position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%);
  background: #1e293b; color: white;
  padding: .65rem 1.5rem; border-radius: var(--radius);
  font-size: .875rem; z-index: 500; box-shadow: var(--shadow-lg);
  animation: toastIn .2s, toastOut .3s 2.7s forwards;
  pointer-events: none;
}
@keyframes toastIn  { from { opacity: 0; transform: translateX(-50%) translateY(8px); } }
@keyframes toastOut { to   { opacity: 0; } }

/* ── Empty state ─────────────────────────────────── */
.empty-state { text-align: center; padding: 4rem 1rem; color: var(--text-muted); }
.empty-state-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.empty-state p    { font-size: .9rem; }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 680px) {
  .header-inner { padding: 0 1rem; }
  .main         { padding: 1rem; }
  .month-title  { min-width: 160px; font-size: 1rem; }
  .calendar-cell { min-height: 70px; }
  .cell-day     { font-size: .75rem; }
  .form-row     { grid-template-columns: 1fr; }
  .list-event   { flex-direction: column; gap: .5rem; }
}
