/* ═══════════════════════════════════════════════════════════════════════════
   Kalendarz Parafialny — style.css
   Mobile-first Premium UI | Liturgical Color Engine
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ─────────────────────────────────────────────────────────────────────────────
   CSS Custom Properties — Design Tokens
───────────────────────────────────────────────────────────────────────────── */
:root {
  /* Liturgical palette */
  --lit-green:  #2e7d32;
  --lit-purple: #6a1b9a;
  --lit-white:  #efebe9;
  --lit-red:    #b71c1c;
  --lit-rose:   #e91e63;
  --lit-black:  #212121;

  /* Base UI */
  --accent:       #2e7d32;      /* Default: Ordinary Time (green) */
  --accent-light: #4caf50;
  /* Surface colours */
  --bg:           #0f1117;
  --bg-card:      rgba(255,255,255,.06);
  --bg-card-hover:rgba(255,255,255,.10);
  --bg-drawer:    #1a1d27;
  --bg-input:     rgba(255,255,255,.08);
  --border:       rgba(255,255,255,.10);
  --border-focus: var(--accent);
  --bg-nav:       rgba(26,29,39,.95);
  --bg-toast:     rgba(26,29,39,.95);

  /* Text */
  --text-primary:   #f0f0f5;
  --text-secondary: #9ea3b0;
  --text-muted:     #5a5f72;
  --text-inverse:   #0f1117;

  /* Spacing */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  40px;

  /* Radius */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-full: 9999px;

  /* Shadow */
  --shadow-sm: 0 2px 8px rgba(0,0,0,.4);
  --shadow-md: 0 8px 32px rgba(0,0,0,.5);
  --shadow-glow: 0 0 24px var(--accent-glow);

  /* Transitions */
  --ease: cubic-bezier(.4,0,.2,1);
  --dur:  200ms;
  --dur-slow: 400ms;

  /* Nav */
  --nav-h: 68px;
}

/* ── Liturgical colour themes ── */
[data-lit="purple"] { --accent: var(--lit-purple); --accent-light: #9c27b0; --accent-dark: #4a148c; --accent-glow: rgba(106,27,154,.25); }
[data-lit="white"]  { --accent: #78909c;  --accent-light: #b0bec5; --accent-dark: #546e7a; --accent-glow: rgba(120,144,156,.25); }
[data-lit="red"]    { --accent: var(--lit-red); --accent-light: #ef5350; --accent-dark: #7f0000; --accent-glow: rgba(183,28,28,.25); }
[data-lit="rose"]   { --accent: var(--lit-rose); --accent-light: #f06292; --accent-dark: #880e4f; --accent-glow: rgba(233,30,99,.25); }
[data-lit="black"]  { --accent: #616161;  --accent-light: #9e9e9e; --accent-dark: #212121; --accent-glow: rgba(97,97,97,.25); }

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

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
  background-color: var(--bg);
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--bg);
  color: var(--text-primary);
  min-height: 100dvh;
  line-height: 1.5;
  overflow-x: hidden;
  transition: --accent var(--dur-slow) var(--ease);
}

a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; touch-action: manipulation; }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--r-full); }

/* ─────────────────────────────────────────────────────────────────────────────
   Layout
───────────────────────────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.page-content {
  flex: 1;
  padding: var(--space-md);
  padding-bottom: calc(var(--nav-h) + var(--space-md) + env(safe-area-inset-bottom));
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Top Header
───────────────────────────────────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: var(--space-sm) var(--space-md);
  padding-top: calc(env(safe-area-inset-top, 0px) + var(--space-sm));
  background: linear-gradient(180deg, var(--bg) 0%, transparent 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

.app-header .logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-primary);
}
.app-header .logo-icon {
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  box-shadow: var(--shadow-glow);
}
.app-header .header-actions { display: flex; align-items: center; gap: var(--space-sm); }

/* ─────────────────────────────────────────────────────────────────────────────
   Bottom Navigation
───────────────────────────────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg-nav);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 200;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: .68rem;
  font-weight: 500;
  color: var(--text-muted);
  border: none;
  background: none;
  padding: var(--space-sm) var(--space-xs);
  transition: color var(--dur) var(--ease);
  text-decoration: none;
  position: relative;
}
.nav-item .nav-icon { font-size: 1.4rem; line-height: 1; transition: transform var(--dur) var(--ease);}
.nav-item:active { background: rgba(255,255,255,.05); }
@media (hover: hover) {
  .nav-item:hover { color: var(--accent-light); }
}
.nav-item.active { color: var(--accent-light); }
.nav-item.active .nav-icon { transform: translateY(-2px); }
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 var(--r-full) var(--r-full);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Cards
───────────────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--space-md);
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.card.interactive { cursor: pointer; touch-action: manipulation; }
.card.interactive:active { transform: scale(.98); background: var(--bg-card-hover); }
@media (hover: hover) {
  .card:hover { background: var(--bg-card-hover); box-shadow: var(--shadow-sm); }
}

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-sm);
}
.card-title { font-size: .95rem; font-weight: 600; }
.card-subtitle { font-size: .78rem; color: var(--text-secondary); margin-top: 2px; }

/* Event Card */
.event-card {
  display: grid;
  grid-template-columns: 4px 1fr;
  gap: 0 var(--space-md);
  padding: var(--space-md);
  border-radius: var(--r-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  margin-bottom: var(--space-sm);
  transition: all var(--dur) var(--ease);
  cursor: pointer;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
.event-card:active { background: var(--bg-card-hover); transform: scale(.98); }
@media (hover: hover) {
  .event-card:hover { background: var(--bg-card-hover); transform: translateX(2px); box-shadow: var(--shadow-sm);}
}
.event-card::before {
  content: '';
  grid-row: 1 / -1;
  width: 4px;
  border-radius: var(--r-full);
  background: var(--event-color, var(--accent));
  margin-left: -16px;
}
.event-card-body { display: flex; flex-direction: column; gap: 4px; }
.event-time { font-size: .75rem; font-weight: 600; color: var(--accent-light); letter-spacing: .04em; }
.event-title { font-size: .9rem; font-weight: 600; }
.event-slots-summary { 
  font-size: .85rem;
  color: var(--text-secondary);
  margin-top: 6px;
}
.event-slots-table {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 4px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: var(--space-xs);
  margin-top: var(--space-xs);
}
.event-slot-row {
  display: contents;
}
.event-slot-func {
  font-weight: 700;
  color: var(--accent-light);
  letter-spacing: .02em;
}
.event-slot-divider {
  color: var(--text-secondary);
  opacity: 0.4;
  font-weight: 400;
}
.event-slot-name {
  color: #f0f0f5;
  font-weight: 500;
}
.event-slots-empty {
  font-size: .78rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 4px;
}
.slot-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: var(--r-full); font-size: 1rem; font-weight: 500;
  background: rgba(255,255,255,.07); border: 1px solid var(--border);
}
.slot-badge.filled { background: rgba(46,125,50,.15); border-color: rgba(46,125,50,.3); color: #e8e8e8; }
.slot-badge.empty  { background: rgba(255,152,0,.12);  border-color: rgba(255,152,0,.3);  color: #ffa726; }

/* ─────────────────────────────────────────────────────────────────────────────
   Calendar
───────────────────────────────────────────────────────────────────────────── */
.calendar-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-md);
}
.calendar-nav h2 { font-size: 1.15rem; font-weight: 700; }

.view-switcher {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 3px;
  gap: 2px;
}
.view-btn {
  padding: 5px 14px; border-radius: var(--r-full); font-size: .78rem; font-weight: 500;
  border: none; background: none; color: var(--text-secondary);
  transition: all var(--dur) var(--ease);
  cursor: pointer;
  touch-action: manipulation;
}
.view-btn:active { transform: scale(.95); }
.view-btn.active { background: var(--accent); color: #fff; box-shadow: var(--shadow-glow); }

/* Month grid */
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-bottom: var(--space-md);
}
.month-grid-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-bottom: var(--space-xs);
}
.month-grid-header span {
  text-align: center; font-size: .65rem; font-weight: 600; color: var(--text-muted);
  padding: var(--space-xs);
  letter-spacing: .05em; text-transform: uppercase;
}
.day-cell {
  aspect-ratio: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  font-size: .82rem; font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: all var(--dur) var(--ease);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-primary);
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
.day-cell:active { background: var(--bg-card); transform: scale(.9); }
@media (hover: hover) {
  .day-cell:hover { background: var(--bg-card); border-color: var(--border); }
}
.day-cell.other-month { color: var(--text-muted); }
.day-cell.today {
  background: var(--accent); color: #fff; font-weight: 700;
  box-shadow: var(--shadow-glow);
}
.day-cell.selected    { border-color: var(--accent-light); background: var(--bg-card); }
.day-cell.sunday      { color: var(--accent-light); }
.day-cell.has-events::after {
  content: '';
  position: absolute; bottom: 4px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent-light);
}
.day-cell.today.has-events::after { background: rgba(255,255,255,.8); }

/* Week strips */
.week-day-strip {
  display: flex; gap: var(--space-sm);
  overflow-x: auto; padding-bottom: var(--space-xs);
  margin-bottom: var(--space-md);
  scrollbar-width: none;
}
.week-day-strip::-webkit-scrollbar { display: none; }
.week-day-chip {
  position: relative;
  flex: 0 0 auto; min-width: 52px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: var(--space-sm) var(--space-sm);
  border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--bg-card); cursor: pointer;
  transition: all var(--dur) var(--ease);
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
.week-day-chip:active { transform: scale(.95); background: var(--bg-card-hover); }
.week-day-chip .dow { font-size: .65rem; font-weight: 600; text-transform: uppercase; color: var(--text-muted); }
.week-day-chip .dom { font-size: 1.05rem; font-weight: 700; }
.week-day-chip.today { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: var(--shadow-glow); }
.week-day-chip.today .dow { color: rgba(255,255,255,.7); }
.week-day-chip.selected { border-color: var(--accent-light); background: rgba(var(--accent),.1); }

/* Section label */
.section-label {
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); margin-bottom: var(--space-sm);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Slot List
───────────────────────────────────────────────────────────────────────────── */
.slot-list { display: flex; flex-direction: column; gap: 6px; }
.slot-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--r-sm);
  background: var(--bg-card); border: 1px solid var(--border);
  gap: var(--space-sm);
  transition: background var(--dur) var(--ease);
}
@media (hover: hover) {
  .slot-row:hover { background: var(--bg-card-hover); }
}
.slot-row-info { display: flex; flex-direction: column; gap: 2px; }
.slot-name { font-size: .82rem; font-weight: 600; }
.slot-person { font-size: .75rem; color: var(--text-secondary); }
.slot-person.me { color: var(--accent-light); font-weight: 500; }
.slot-action { flex-shrink: 0; }

/* ─────────────────────────────────────────────────────────────────────────────
   Buttons
───────────────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-sm);
  padding: 10px 20px; border-radius: var(--r-full);
  font-size: .85rem; font-weight: 600; border: none;
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:active { transform: scale(.96); background: var(--accent-dark); }
@media (hover: hover) {
  .btn-primary:hover:not(:disabled) {
    background: var(--accent-light);
    box-shadow: 0 4px 20px var(--accent-glow);
    transform: translateY(-1px);
  }
}

@media (hover: hover) {
  .btn-secondary:hover:not(:disabled) { background: var(--bg-card-hover); }
}

.btn-secondary {
  background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-danger {
  background: rgba(183,28,28,.15); color: #ef5350;
  border: 1px solid rgba(183,28,28,.3);
}
@media (hover: hover) {
  .btn-danger:hover:not(:disabled) { background: rgba(183,28,28,.25); }
}

.btn-ghost { background: none; color: var(--text-secondary); }
@media (hover: hover) {
  .btn-ghost:hover { color: var(--text-primary); background: var(--bg-card); }
}

.btn-sm { padding: 6px 14px; font-size: .78rem; }
.btn-lg { padding: 14px 28px; font-size: .95rem; }
.btn-full { width: 100%; }

.btn-icon {
  width: 38px; height: 38px; padding: 0; border-radius: var(--r-md);
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-primary);
  font-size: 1rem;
}
@media (hover: hover) {
  .btn-icon:hover { background: var(--bg-card-hover); }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Forms
───────────────────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: var(--space-xs); margin-bottom: var(--space-md); }
.form-label { font-size: .82rem; font-weight: 600; color: var(--text-secondary); }

.form-input, .form-select, .form-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px var(--space-md);
  font-size: .9rem; font-family: inherit; color: var(--text-primary);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-input::placeholder { color: var(--text-muted); }

.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%239ea3b0'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; padding-right: 40px; }

.form-textarea { resize: vertical; min-height: 100px; }

.form-error { font-size: .78rem; color: #ef5350; margin-top: 4px; }
.form-hint  { font-size: .76rem; color: var(--text-muted); margin-top: 4px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }

/* ─────────────────────────────────────────────────────────────────────────────
   Slide-Up Drawer
───────────────────────────────────────────────────────────────────────────── */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.7);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-slow) var(--ease);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.drawer-backdrop.open { opacity: 1; pointer-events: all; }

.drawer {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 400;
  background: var(--bg-drawer);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  border-top: 1px solid var(--border);
  padding: var(--space-md) var(--space-md) calc(var(--nav-h) + var(--space-md) + env(safe-area-inset-bottom, 0px));
  max-height: 85dvh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform var(--dur-slow) var(--ease);
  box-shadow: 0 -8px 40px rgba(0,0,0,.6);
}
.drawer.open { transform: translateY(0); }

.drawer-handle {
  width: 36px; height: 4px; border-radius: var(--r-full);
  background: var(--border); margin: 0 auto var(--space-lg);
}
.drawer-title { font-size: 1.05rem; font-weight: 700; margin-bottom: var(--space-xs); }
.drawer-subtitle { font-size: .8rem; color: var(--text-secondary); margin-bottom: var(--space-lg); }

/* ─────────────────────────────────────────────────────────────────────────────
   Auth Pages
───────────────────────────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-lg) var(--space-md);
  background: radial-gradient(ellipse at 50% 0%, rgba(var(--accent),.2) 0%, transparent 60%), var(--bg);
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--space-xl) var(--space-lg);
  box-shadow: var(--shadow-md);
}
.auth-logo { text-align: center; margin-bottom: var(--space-xl); }
.auth-logo .icon { font-size: 2.5rem; display: block; margin-bottom: var(--space-sm); }
.auth-logo h1 { font-size: 1.4rem; font-weight: 700; }
.auth-logo p  { font-size: .82rem; color: var(--text-secondary); margin-top: 4px; }

.auth-divider { display: flex; align-items: center; gap: var(--space-sm); margin: var(--space-md) 0; }
.auth-divider span { font-size: .75rem; color: var(--text-muted); white-space: nowrap; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ─────────────────────────────────────────────────────────────────────────────
   Admin Panel
───────────────────────────────────────────────────────────────────────────── */
.admin-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100dvh;
}
@media (max-width: 768px) { .admin-layout { grid-template-columns: 1fr; } }

.admin-sidebar {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: var(--space-lg) var(--space-md);
}
.admin-main { padding: var(--space-lg); }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; margin-top: var(--space-lg); }
.sidebar-link {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: 10px var(--space-md); border-radius: var(--r-sm);
  font-size: .87rem; font-weight: 500; color: var(--text-secondary);
  text-decoration: none; transition: all var(--dur) var(--ease);
}
@media (hover: hover) {
  .sidebar-link:hover { background: var(--bg-card-hover); color: var(--text-primary); text-decoration: none; }
}
.sidebar-link.active { background: rgba(46,125,50,.15); color: var(--accent-light); }
.sidebar-link .icon { font-size: 1.1rem; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.data-table th {
  text-align: left; padding: var(--space-sm) var(--space-md);
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
}
.data-table td { padding: 10px var(--space-md); border-bottom: 1px solid rgba(255,255,255,.04); vertical-align: middle; }
@media (hover: hover) {
  .data-table tr:hover td { background: var(--bg-card-hover); }
}
.data-table tr:last-child td { border-bottom: none; }

.table-container { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }

/* Badges / Pills */
.pill {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: var(--r-full);
  font-size: .72rem; font-weight: 600;
}
.pill-green  { background: rgba(46,125,50,.2);   color: #81c784; }
.pill-purple { background: rgba(106,27,154,.2);  color: #ce93d8; }
.pill-red    { background: rgba(183,28,28,.2);   color: #ef9a9a; }
.pill-gray   { background: rgba(120,120,120,.2); color: #b0bec5; }
.pill-blue   { background: rgba(21,101,192,.2);  color: #90caf9; }

/* Stats cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-md); margin-bottom: var(--space-lg); }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--space-md); }
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--accent-light); line-height: 1; }
.stat-label { font-size: .76rem; color: var(--text-secondary); margin-top: 4px; }

/* ─────────────────────────────────────────────────────────────────────────────
   Alerts & Toasts
───────────────────────────────────────────────────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--r-sm); margin-bottom: var(--space-md);
  font-size: .85rem;
}
.alert-success { background: rgba(46,125,50,.15); border: 1px solid rgba(46,125,50,.3); color: #a5d6a7; }
.alert-error   { background: rgba(183,28,28,.15); border: 1px solid rgba(183,28,28,.3); color: #ef9a9a; }
.alert-info    { background: rgba(21,101,192,.15); border: 1px solid rgba(21,101,192,.3); color: #90caf9; }

/* Toast */
#toast-container { position: fixed; bottom: calc(var(--nav-h) + 16px); left: 50%; transform: translateX(-50%); z-index: 500; display: flex; flex-direction: column; align-items: center; gap: var(--space-sm); pointer-events: none; }
.toast {
  padding: 10px 20px; border-radius: var(--r-full);
  background: var(--bg-toast); border: 1px solid var(--border);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  color: var(--text-primary); font-size: .85rem; font-weight: 500;
  box-shadow: var(--shadow-md); white-space: nowrap;
  animation: toastIn var(--dur-slow) var(--ease) forwards;
}
.toast.out { animation: toastOut var(--dur) var(--ease) forwards; }
@keyframes toastIn  { from { opacity:0; transform: translateY(12px); } to { opacity:1; transform: translateY(0); } }
@keyframes toastOut { from { opacity:1; } to { opacity:0; transform: translateY(-8px); } }

/* ─────────────────────────────────────────────────────────────────────────────
   Profile page
───────────────────────────────────────────────────────────────────────────── */
.profile-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 700; color: #fff;
  margin: 0 auto var(--space-md);
  box-shadow: var(--shadow-glow);
}
.profile-name { text-align: center; font-size: 1.15rem; font-weight: 700; }
.profile-role { text-align: center; font-size: .8rem; color: var(--text-secondary); margin-top: 4px; }

/* Push toggle */
.push-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-md); border-radius: var(--r-md);
  background: var(--bg-card); border: 1px solid var(--border);
  margin-bottom: var(--space-md);
}
.push-toggle-info { display: flex; flex-direction: column; gap: 2px; }
.push-toggle-label { font-size: .9rem; font-weight: 600; }
.push-toggle-desc  { font-size: .76rem; color: var(--text-secondary); }

/* Toggle switch */
.toggle { position: relative; width: 50px; height: 28px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--r-full); transition: all var(--dur) var(--ease);
}
.toggle-slider::before {
  content: '';
  position: absolute; left: 4px; bottom: 4px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--text-muted); transition: all var(--dur) var(--ease);
}
.toggle input:checked + .toggle-slider { background: var(--accent); border-color: var(--accent); box-shadow: var(--shadow-glow); }
.toggle input:checked + .toggle-slider::before { transform: translateX(22px); background: #fff; }

/* ─────────────────────────────────────────────────────────────────────────────
   Utilities
───────────────────────────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.fw-bold { font-weight: 700; }
.fw-medium { font-weight: 500; }
.text-muted { color: var(--text-secondary); }
.text-accent { color: var(--accent-light); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.gap-sm { gap: var(--space-sm); }
.flex    { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }
.divider { height: 1px; background: var(--border); margin: var(--space-md) 0; }
.page-title { font-size: 1.3rem; font-weight: 700; margin-bottom: var(--space-lg); }
.empty-state {
  text-align: center; padding: var(--space-xl) var(--space-lg);
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: var(--space-sm); }
.empty-state p { font-size: .85rem; }

.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-xl); width: 100%;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Responsive
───────────────────────────────────────────────────────────────────────────── */
@media (min-width: 600px) {
  .page-content { padding: var(--space-lg); padding-bottom: calc(var(--nav-h) + var(--space-lg)); }
  .form-row { grid-template-columns: 1fr 1fr; }
  .auth-card { padding: var(--space-xl) 40px; }
}

@media (min-width: 900px) {
  .bottom-nav {
    display: flex;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    bottom: 24px;
    width: auto;
    min-width: 480px;
    max-width: 90%;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-md), 0 0 0 1px rgba(255, 255, 255, 0.05);
    height: 64px;
    padding-bottom: 0;
    background: rgba(26, 29, 39, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
  }
  .nav-item {
    border-radius: var(--r-md);
    padding: var(--space-sm) var(--space-md);
    margin: 4px;
    font-size: 0.72rem;
    flex-direction: row;
    gap: 8px;
  }
  .nav-item .nav-icon {
    font-size: 1.2rem;
  }
  .nav-item.active::before {
    top: auto;
    bottom: 0px;
    left: 20%;
    right: 20%;
    height: 3px;
    border-radius: var(--r-full);
  }
  .page-content { padding-bottom: 110px; }
  .app-header { padding: var(--space-sm) var(--space-lg); }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Color indicator dot
───────────────────────────────────────────────────────────────────────────── */
.lit-dot {
  display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  vertical-align: middle; margin-right: 4px;
}
.lit-green  { background: var(--lit-green); }
.lit-purple { background: var(--lit-purple); }
.lit-white  { background: #eceff1; border: 1px solid #90a4ae; }
.lit-red    { background: var(--lit-red); }

/* ─────────────────────────────────────────────────────────────────────────────
   Page transitions
───────────────────────────────────────────────────────────────────────────── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.fade-up { animation: fadeUp var(--dur-slow) var(--ease) both; }
.fade-up-1 { animation-delay: 50ms; }
.fade-up-2 { animation-delay: 100ms; }
.fade-up-3 { animation-delay: 150ms; }

/* ─────────────────────────────────────────────────────────────────────────────
   Slot — rozszerzone style (rola, kłódka, podgląd publiczny)
───────────────────────────────────────────────────────────────────────────── */
.slot-role-icon {
  font-size: 1rem;
  flex-shrink: 0;
  opacity: .75;
  margin-right: 4px;
}

/* slot-row-info — ikona roli inline z nazwą */
.slot-row-info {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.slot-name  { font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-person { font-size: .75rem; color: var(--text-secondary); margin-left: auto; white-space: nowrap; }
.slot-person.me { color: var(--accent-light); font-weight: 600; }

/* Kłódka — slot innej grupy */
.slot-locked {
  font-size: 1rem;
  opacity: .4;
  cursor: default;
  flex-shrink: 0;
}

/* Widok publiczny: slot z wpisaną osobą */
.slot-row--public {
  border-left: 3px solid var(--accent);
  background: rgba(46,125,50,.06);
}

/* Podpowiedź logowania dla gości */
.slot-login-hint {
  text-align: center;
  font-size: .78rem;
  color: var(--text-muted);
  padding: var(--space-md) 0 var(--space-sm);
  border-top: 1px solid var(--border);
  margin-top: var(--space-sm);
}
.slot-login-hint a { color: var(--accent-light); font-weight: 600; }

/* Informacja o braku wpisów */
.slot-empty-info {
  text-align: center;
  font-size: .85rem;
  color: var(--text-muted);
  padding: var(--space-xl) var(--space-md);
}

/* ─────────────────────────────────────────────────────────────────────────────
   SALKI SYSTEM STYLING
   ───────────────────────────────────────────────────────────────────────────── */
.room-tabs {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 4px 12px 4px;
  margin-bottom: var(--space-md);
  scrollbar-width: none;
}
.room-tabs::-webkit-scrollbar {
  display: none;
}
.room-tab {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 18px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--r-md);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-base);
  min-width: 140px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.room-tab:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.12);
}
.room-tab.active {
  border-color: var(--room-color);
  background: rgba(var(--room-color-rgb), 0.08);
  box-shadow: 0 4px 20px rgba(var(--room-color-rgb), 0.12);
}
.room-tab-name {
  font-weight: 700;
  font-size: .92rem;
  letter-spacing: .02em;
}
.room-tab-desc {
  font-size: .72rem;
  color: var(--text-secondary);
}

.reservation-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: var(--space-md);
}
.reservation-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-md);
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--r-md);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.reservation-card:active {
  transform: scale(0.99);
}
@media (hover: hover) {
  .reservation-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateX(2px);
  }
}
.reservation-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--room-color);
  border-radius: var(--r-full);
}
.reservation-time {
  font-family: monospace;
  font-weight: 700;
  font-size: .9rem;
  color: var(--accent-light);
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 10px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.reservation-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.reservation-title {
  font-weight: 600;
  font-size: .95rem;
  color: #fff;
}
.reservation-owner {
  font-size: .78rem;
  color: var(--text-secondary);
}
.reservation-owner span {
  color: var(--accent-light);
  font-weight: 500;
}
.btn-delete-res {
  opacity: 0.6;
  font-size: 1.1rem;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  transition: opacity var(--transition-base), transform var(--transition-base);
}
.btn-delete-res:hover {
  opacity: 1;
  transform: scale(1.1);
}

/* Badge dot on weekly view */
.badge-dot {
  position: absolute;
  bottom: 6px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

/* Booking Drawer form layout */
.res-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
}
.btn-block {
  width: 100%;
}

/* Aggregated Timeline Styles */
.timeline-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  position: relative;
  padding-left: 20px;
  border-left: 2px dashed var(--border);
  margin-left: 8px;
  margin-top: var(--space-md);
}

.timeline-item {
  position: relative;
  padding: var(--space-md);
  border-radius: var(--r-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-md);
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.timeline-item:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Timeline dot connecting to the dashed line */
.timeline-item::before {
  content: '';
  position: absolute;
  left: -27px;
  top: 22px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--timeline-color, var(--accent));
  box-shadow: 0 0 10px var(--timeline-color, var(--accent));
  border: 2px solid var(--bg);
  z-index: 10;
}

.timeline-content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
}

.timeline-time {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.timeline-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--timeline-color, var(--text-secondary));
}

.timeline-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.timeline-subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.timeline-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 4px;
  background: rgba(0, 0, 0, 0.15);
  padding: 6px 10px;
  border-radius: var(--r-sm);
  border-left: 3px solid var(--timeline-color, var(--accent));
}

.timeline-action {
  flex-shrink: 0;
  align-self: center;
}

.badge-dot-container {
  display: flex;
  gap: 3px;
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
}

.week-day-chip .badge-dot-mini {
  width: 4px;
  height: 4px;
  border-radius: 50%;
}


