:root {
  --bg: #0b0f0d;
  --card-bg: #141915;
  --text: #e8f5ec;
  --muted: #8a9990;
  --primary: #22c55e;
  --primary-dark: #16a34a;
  --border: #26302a;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  --glow: 0 0 40px rgba(34, 197, 94, 0.08);
  --radius: 16px;
  --font-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

button, input, select, textarea { font-family: inherit; }

input, select, textarea {
  background: #0f1411;
  color: var(--text);
}
input::placeholder, textarea::placeholder { color: var(--muted); }

/* ---------- LOGIN ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0b0f0d 0%, #14291d 100%);
}

.login-card {
  background: var(--card-bg);
  padding: 48px 40px;
  border-radius: var(--radius);
  box-shadow: var(--shadow), var(--glow);
  text-align: center;
  width: 320px;
  position: relative;
  overflow: hidden;
}

/* subtelny motyw kota w tle - ledwo widoczny, nawiązanie do ikonki appki */
.login-card::after {
  content: "";
  position: absolute;
  right: -36px;
  bottom: -36px;
  width: 200px;
  height: 200px;
  background: url('/static/icons/kot-512.png') center/cover no-repeat;
  opacity: 0.05;
  filter: grayscale(1) contrast(1.15);
  pointer-events: none;
}

.login-card h1 { margin: 0 0 8px; font-size: 24px; font-family: var(--font-display); letter-spacing: -0.01em; position: relative; }
.login-card p { color: var(--muted); margin-bottom: 24px; font-size: 14px; position: relative; }

.login-card form { display: flex; flex-direction: column; gap: 12px; position: relative; }

.login-card input {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  font-size: 15px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.login-card input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(34,197,94,0.20);
}

.login-card button {
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}
.login-card button:hover { background: var(--primary-dark); transform: translateY(-1px); }
.login-card button:active { transform: translateY(0); }

.error { color: #e74c3c; font-size: 13px; }

/* ---------- TOPBAR ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  background: rgba(20, 25, 22, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(34, 197, 94, 0.14);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { font-weight: 600; font-size: 18px; margin-right: auto; font-family: var(--font-display); letter-spacing: -0.01em; }

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.05);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
}
.user-badge .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--user-color, var(--primary));
}

.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  padding: 9px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: white;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
.btn:active { transform: translateY(0) scale(0.97); }

.btn-primary { background: var(--primary); border-color: var(--primary); color: white; box-shadow: 0 4px 14px rgba(34,197,94,0.22); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 6px 20px rgba(34,197,94,0.32); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: rgba(255,255,255,0.06); }

/* ---------- LEGENDA ---------- */
.legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 24px;
}
.legend-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border-left: 4px solid var(--cat-color, var(--primary));
}

/* ---------- KALENDARZ ---------- */
#calendar {
  max-width: 1100px;
  margin: 0 auto 40px;
  padding: 0 24px;
}

.fc-toolbar-title { font-family: var(--font-display) !important; letter-spacing: -0.01em; }
input[type="time"], input[type="date"] { font-family: var(--font-mono); }

.fc { font-size: 14px;
  --fc-page-bg-color: transparent;
  --fc-neutral-bg-color: #141915;
  --fc-border-color: var(--border);
  --fc-list-event-hover-bg-color: rgba(34,197,94,0.08);
  --fc-today-bg-color: transparent;
  --fc-button-bg-color: var(--card-bg);
  --fc-button-border-color: var(--border);
  --fc-button-hover-bg-color: #1c2620;
  --fc-button-active-bg-color: var(--primary);
  color: var(--text);
}
.fc-day-today {
  background: radial-gradient(circle at 25% 15%, rgba(34,197,94,0.14), rgba(34,197,94,0.03) 65%) !important;
}
.fc-col-header-cell, .fc-daygrid-day-number, .fc-list-day-text, .fc-list-day-side-text {
  color: var(--text) !important;
}
.fc-daygrid-day-number:hover { color: var(--primary) !important; }
.fc-event { border-radius: 6px; padding: 1px 4px; cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.fc-event:hover { transform: scale(1.02); box-shadow: 0 4px 14px rgba(34,197,94,0.25); }
.fc-daygrid-day { transition: background 0.15s ease; }
.fc-daygrid-day:hover { background: rgba(34,197,94,0.08); }
.fc-day-today { background: rgba(34,197,94,0.10) !important; }

/* ---------- MODALE ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal {
  background: rgba(20, 25, 22, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(34, 197, 94, 0.1);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.6), var(--glow);
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 { margin: 0 0 18px; font-size: 18px; font-family: var(--font-display); letter-spacing: -0.01em; }

.modal form { display: flex; flex-direction: column; gap: 4px; }
.modal label { font-size: 13px; color: var(--muted); margin-top: 10px; font-weight: 500; }
.modal input, .modal select, .modal textarea {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  font-size: 14px;
  transition: border-color 0.2s ease;
}
.modal input:focus, .modal select:focus, .modal textarea:focus {
  outline: none; border-color: var(--primary);
}
.modal textarea { resize: vertical; min-height: 60px; }

.modal-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 20px;
}

.weekday-picker { display: flex; gap: 6px; margin-top: 4px; }

/* ---------- PANEL DNIA ---------- */
.day-entries {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 340px;
  overflow-y: auto;
}

.day-entry {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(255,255,255,0.035), rgba(255,255,255,0.01));
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  border-left: 4px solid var(--user-color, var(--primary));
  animation: popIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.day-entry:hover {
  transform: translateX(3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.45);
}

.day-entry-info { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }

.user-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--user-color, var(--primary));
  display: inline-block;
}

.day-entry-user { font-weight: 600; font-size: 14px; }
.day-entry-time { font-size: 13px; color: var(--muted); font-family: var(--font-mono); }
.day-entry-cat {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border-left: 3px solid var(--cat-color, var(--primary));
}
.day-entry-note {
  flex-basis: 100%;
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.btn-delete {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  opacity: 0.7;
  transition: opacity 0.15s ease, transform 0.15s ease;
  flex-shrink: 0;
}
.btn-delete:hover { opacity: 1; transform: scale(1.1); }

.empty-day { color: var(--muted); font-size: 14px; text-align: center; padding: 20px 0; }
.wd-btn {
  flex: 1;
  padding: 8px 0;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: white;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
}
.wd-btn.active { background: var(--primary); border-color: var(--primary); color: white; }

/* ---------- TOAST ---------- */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 38, 32, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(34,197,94,0.18);
  z-index: 200;
}
.toast-success {
  border-color: rgba(34,197,94,0.4);
  box-shadow: var(--shadow), 0 0 26px rgba(34,197,94,0.22);
  animation: toastPulse 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes toastPulse {
  0% { transform: translateX(-50%) scale(0.92); }
  60% { transform: translateX(-50%) scale(1.03); }
  100% { transform: translateX(-50%) scale(1); }
}

/* ---------- ANIMACJE ---------- */
@keyframes popIn {
  from { opacity: 0; transform: scale(0.92) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.pop-in { animation: popIn 0.28s cubic-bezier(0.16, 1, 0.3, 1); }

.is-loading { opacity: 0.6; pointer-events: none; }

/* ---------- RESPONSYWNOŚĆ ---------- */
@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .brand { font-size: 16px; }
  #calendar { padding: 0 8px; }
  .fc-toolbar { flex-direction: column; gap: 8px; }
  .fc-toolbar-title { font-size: 16px !important; }

  /* widok tygodnia/dnia: zamiast ściskać kolumny do nieczytelności, przewijamy w bok */
  .fc-timeGridWeek-view .fc-scrollgrid,
  .fc-timeGridDay-view .fc-scrollgrid {
    min-width: 600px;
  }
  .fc-view-harness {
    overflow-x: auto;
  }
}
