/* ============================================================================
   KLAWKA WORKSPACE — Design System
   Paleta wyprowadzona z loga: niebieski (#1aa6ee) → zielony (#7cc41e).
   Dwa motywy (jasny / ciemny), spójne tokeny, dużo dopracowanych animacji.
   ========================================================================== */

:root {
  /* Marka */
  --blue-400: #42c0fb;
  --blue-500: #1aa6ee;
  --blue-600: #0a87cf;
  --green-400: #92db33;
  --green-500: #7cc41e;
  --green-600: #5fa015;

  --brand: var(--blue-500);
  --brand-strong: var(--blue-600);
  --grad-brand: linear-gradient(135deg, #1aa6ee 0%, #4fc3e8 45%, #7cc41e 100%);
  --grad-brand-soft: linear-gradient(135deg, rgba(26,166,238,.12) 0%, rgba(124,196,30,.12) 100%);

  /* Powierzchnie — motyw jasny */
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: rgba(148, 163, 184, 0.22);
  --border-strong: rgba(148, 163, 184, 0.38);
  --text: #0f172a;
  --text-muted: #64748b;
  --ring: rgba(26, 166, 238, 0.35);
  --shadow-soft: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-lift: 0 14px 34px -10px rgba(15,23,42,.18), 0 5px 12px -6px rgba(15,23,42,.10);

  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
}

.dark {
  --bg: #0b1220;
  --surface: #111a2e;
  --surface-2: #0f1830;
  --border: rgba(71, 85, 105, 0.40);
  --border-strong: rgba(100, 116, 139, 0.55);
  --text: #e8eef7;
  --text-muted: #94a3b8;
  --ring: rgba(66, 192, 251, 0.45);
  --shadow-soft: 0 1px 3px rgba(0,0,0,.4);
  --shadow-lift: 0 18px 40px -12px rgba(0,0,0,.6), 0 6px 14px -8px rgba(0,0,0,.5);
}

* { -webkit-font-smoothing: antialiased; }
html { scroll-behavior: smooth; }
body { min-height: 100vh; overflow-x: hidden; }
#app-root { width: 100%; }

/* Subtelny markowy gradient w tle aplikacji */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(60rem 60rem at 110% -10%, rgba(124,196,30,.07), transparent 60%),
    radial-gradient(55rem 55rem at -10% 0%, rgba(26,166,238,.08), transparent 55%);
}
.dark body::before {
  background:
    radial-gradient(60rem 60rem at 110% -10%, rgba(124,196,30,.10), transparent 60%),
    radial-gradient(55rem 55rem at -10% 0%, rgba(26,166,238,.12), transparent 55%);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.4); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--blue-500); background-clip: padding-box; }
.dark ::-webkit-scrollbar-thumb { background: rgba(71, 85, 105, 0.6); background-clip: padding-box; }
.dark ::-webkit-scrollbar-thumb:hover { background: var(--blue-500); background-clip: padding-box; }

::selection { background: rgba(26,166,238,.25); }

/* ---- Board backgrounds (markowe + zachowane warianty) ---- */
.bg-gradient-1 { background: linear-gradient(135deg, #1aa6ee 0%, #7cc41e 100%); }
.bg-gradient-2 { background: linear-gradient(135deg, #0a87cf 0%, #42c0fb 100%); }
.bg-gradient-3 { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.bg-gradient-4 { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.bg-gradient-5 { background: linear-gradient(135deg, #7cc41e 0%, #d9f99d 100%); }
.bg-gradient-6 { background: linear-gradient(135deg, #1aa6ee 0%, #134e8a 100%); }
.bg-gradient-7 { background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%); }
.bg-gradient-8 { background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%); }

/* ============================================================================
   KARTA (kanban / ogólna)
   ========================================================================== */
.kanban-card {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  transition: transform .25s var(--ease-out), box-shadow .25s var(--ease-out), border-color .2s, background .2s;
  border: 1px solid var(--border);
  position: relative;
}
.kanban-card:hover {
  box-shadow: 0 14px 30px -12px rgba(26,166,238,.30), 0 4px 10px -4px rgba(15,23,42,.10);
  transform: translateY(-3px);
  border-color: rgba(26,166,238,.45);
}
.dark .kanban-card { background: var(--surface); border-color: var(--border); }
.dark .kanban-card:hover { background: #16223c; border-color: rgba(66,192,251,.45); }

/* Drag states */
.sortable-ghost {
  opacity: .35;
  background: var(--grad-brand-soft) !important;
  border: 2px dashed rgba(26, 166, 238, 0.55) !important;
}
.sortable-chosen { cursor: grabbing !important; }
.sortable-drag {
  transform: rotate(2.5deg) scale(1.02);
  box-shadow: 0 28px 55px -12px rgba(15,23,42,.40);
}

/* ============================================================================
   LISTA (kolumna)
   ========================================================================== */
.kanban-list {
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
  transition: box-shadow .25s var(--ease-out);
}
.kanban-list:hover { box-shadow: var(--shadow-soft); }
.dark .kanban-list {
  background: rgba(17, 26, 46, 0.62);
  border: 1px solid var(--border);
}
.kanban-column-empty .lists-stack {
  min-height: 80px;
  border: 2px dashed rgba(255,255,255,0.18);
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  transition: background .2s, border-color .2s;
}
.kanban-column-empty .lists-stack.sortable-hover-target,
.lists-stack.sortable-hover-target {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.45);
}

/* Priority dots */
.prio-low    { background: #94a3b8; }
.prio-medium { background: #1aa6ee; }
.prio-high   { background: #f59e0b; }
.prio-urgent { background: #ef4444; }

/* ============================================================================
   ANIMACJE
   ========================================================================== */
.animate-fade-in  { animation: fadeIn .35s ease-out both; }
.animate-slide-up { animation: slideUp .4s var(--ease-out) both; }
.animate-pop      { animation: pop .25s var(--ease-spring) both; }
.animate-scale-in { animation: scaleIn .3s var(--ease-spring) both; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: scale(1); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes floatY { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes sheen { 0% { transform: translateX(-130%) skewX(-18deg); } 60%,100% { transform: translateX(230%) skewX(-18deg); } }

.animate-float { animation: floatY 6s ease-in-out infinite; }

/* Staggered entrance — dodaj klasę .stagger do kontenera listy */
.stagger > * { animation: slideUp .45s var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: .03s; }
.stagger > *:nth-child(2) { animation-delay: .07s; }
.stagger > *:nth-child(3) { animation-delay: .11s; }
.stagger > *:nth-child(4) { animation-delay: .15s; }
.stagger > *:nth-child(5) { animation-delay: .19s; }
.stagger > *:nth-child(6) { animation-delay: .23s; }
.stagger > *:nth-child(7) { animation-delay: .27s; }
.stagger > *:nth-child(8) { animation-delay: .31s; }
.stagger > *:nth-child(9) { animation-delay: .35s; }
.stagger > *:nth-child(n+10) { animation-delay: .39s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 12px;
}
.dark .skeleton {
  background: linear-gradient(90deg, #16223c 25%, #233351 50%, #16223c 75%);
  background-size: 200% 100%;
}

/* ============================================================================
   PRZYCISKI
   ========================================================================== */
.btn-primary {
  background: var(--grad-brand);
  background-size: 160% 160%;
  background-position: 0% 50%;
  color: white;
  padding: .58rem 1.15rem;
  border-radius: 11px;
  font-weight: 600;
  transition: transform .18s var(--ease-out), box-shadow .25s var(--ease-out), background-position .5s var(--ease-out);
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 14px -4px rgba(26,166,238,.45);
}
/* Połysk przesuwający się przy hover (jak glossy logo) */
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 45%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  transform: translateX(-130%) skewX(-18deg);
  pointer-events: none;
}
.btn-primary:hover {
  transform: translateY(-2px);
  background-position: 100% 50%;
  box-shadow: 0 12px 26px -6px rgba(26,166,238,.55);
}
.btn-primary:hover::after { animation: sheen .8s var(--ease-out); }
.btn-primary:active { transform: translateY(0) scale(.98); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-ghost {
  padding: .55rem 1.05rem;
  border-radius: 11px;
  color: var(--text-muted);
  transition: background .18s, color .18s, transform .18s var(--ease-out);
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}
.btn-ghost:hover { background: var(--grad-brand-soft); color: var(--brand); }
.btn-ghost:active { transform: scale(.96); }
.dark .btn-ghost { color: #cbd5e1; }
.dark .btn-ghost:hover { color: #7ed6ff; }

/* ============================================================================
   POLA FORMULARZA
   ========================================================================== */
.input {
  width: 100%;
  padding: .68rem .95rem;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: var(--surface);
  transition: border-color .18s, box-shadow .25s var(--ease-out), background .2s;
  color: var(--text);
}
.input::placeholder { color: var(--text-muted); opacity: .7; }
.input:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 4px var(--ring);
}
.input:hover:not(:focus) { border-color: rgba(26,166,238,.4); }
.dark .input { background: #0f1830; border-color: var(--border); color: #e8eef7; }

/* Accent dla checkboxów / radio / pól */
input[type="checkbox"], input[type="radio"] { accent-color: var(--blue-500); }

/* ============================================================================
   MODAL
   ========================================================================== */
.modal-backdrop {
  background: rgba(8, 14, 26, .55);
  backdrop-filter: blur(10px);
}

/* ============================================================================
   SIDEBAR
   ========================================================================== */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .58rem .9rem;
  border-radius: 10px;
  color: var(--text-muted);
  transition: background .18s, color .18s, transform .18s var(--ease-out);
  cursor: pointer;
  font-size: .9rem;
  position: relative;
}
.sidebar-item i { transition: transform .2s var(--ease-spring); }
.sidebar-item:hover { background: var(--grad-brand-soft); color: var(--brand); }
.sidebar-item:hover i { transform: translateX(2px) scale(1.08); }
.sidebar-item.active {
  background: var(--grad-brand-soft);
  color: var(--brand);
  font-weight: 600;
}
/* Wskaźnik aktywnej pozycji */
.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60%;
  border-radius: 0 4px 4px 0;
  background: var(--grad-brand);
  box-shadow: 0 0 10px rgba(26,166,238,.6);
}
.dark .sidebar-item { color: #cbd5e1; }
.dark .sidebar-item:hover,
.dark .sidebar-item.active { color: #7ed6ff; }

/* ============================================================================
   AVATAR
   ========================================================================== */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: .8rem;
  flex-shrink: 0;
  border: 2px solid var(--surface);
  box-shadow: 0 2px 6px rgba(15,23,42,.12);
}
.dark .avatar { border-color: var(--surface); }

/* ============================================================================
   KALENDARZ
   ========================================================================== */
.calendar-day {
  min-height: 110px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  transition: background .18s, border-color .18s, transform .18s var(--ease-out);
}
.dark .calendar-day { background: var(--surface); border-color: var(--border); }
.calendar-day:hover { background: var(--surface-2); transform: translateY(-1px); border-color: rgba(26,166,238,.35); }
.calendar-day.today { border-color: var(--blue-500); background: rgba(26, 166, 238, .06); box-shadow: inset 0 0 0 1px rgba(26,166,238,.4); }
.calendar-day.other-month { opacity: .4; }

/* ============================================================================
   TIMELINE
   ========================================================================== */
.timeline-bar {
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  color: white;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .18s var(--ease-out), box-shadow .2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.timeline-bar:hover { transform: scaleY(1.12); box-shadow: 0 6px 14px rgba(26,166,238,.30); }

/* ============================================================================
   TOAST
   ========================================================================== */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  padding: 13px 16px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-lift);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 400px;
  pointer-events: auto;
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue-500);
  animation: toastIn .4s var(--ease-spring) both;
}
.toast.success { border-left-color: #10b981; }
.toast.error   { border-left-color: #ef4444; }
.toast.warning { border-left-color: #f59e0b; }
.dark .toast { background: var(--surface); color: #e8eef7; }
@keyframes toastIn { from { transform: translateX(120%) scale(.9); opacity: 0; } to { transform: translateX(0) scale(1); opacity: 1; } }

/* ============================================================================
   RESPONSYWNOŚĆ
   ========================================================================== */
@media (max-width: 768px) {
  .kanban-column { width: 85vw; max-width: 320px; }
}

/* Płynne przejście motywu */
body, .kanban-card, .kanban-list, .calendar-day, .input, .sidebar-item, .toast, aside, header {
  transition: background-color .3s var(--ease-out), color .3s var(--ease-out), border-color .3s var(--ease-out), box-shadow .3s var(--ease-out);
}

/* ============================================================================
   DOKUMENTY (edytor w stylu Notion)
   ========================================================================== */
.doc-editor { font-size: 16px; line-height: 1.7; color: var(--text); padding: 4px 0; }
.doc-editor:focus { outline: none; }
.doc-editor h1 { font-size: 2em; font-weight: 700; margin: 0.8em 0 0.3em; }
.doc-editor h2 { font-size: 1.5em; font-weight: 700; margin: 0.7em 0 0.3em; }
.doc-editor h3 { font-size: 1.25em; font-weight: 600; margin: 0.6em 0 0.2em; }
.doc-editor p { margin: 0.3em 0; }
.doc-editor ul { list-style: disc; padding-left: 1.4em; margin: 0.4em 0; }
.doc-editor ol { list-style: decimal; padding-left: 1.4em; margin: 0.4em 0; }
.doc-editor blockquote {
  border-left: 3px solid var(--blue-500);
  padding: 0.4em 0.8em;
  margin: 0.6em 0;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: 0 8px 8px 0;
}
.dark .doc-editor blockquote { background: rgba(26,166,238,.07); }
.doc-editor pre {
  background: #0b1220;
  color: #e2e8f0;
  padding: 0.9em 1em;
  border-radius: 12px;
  overflow-x: auto;
  font-family: ui-monospace, monospace;
  font-size: 13px;
  margin: 0.6em 0;
}
.doc-editor code {
  background: var(--surface-2);
  padding: 0.15em 0.4em;
  border-radius: 5px;
  font-size: 0.9em;
  font-family: ui-monospace, monospace;
}
.dark .doc-editor code { background: rgba(26,166,238,.16); }
.doc-editor a { color: var(--blue-600); text-decoration: underline; }
.dark .doc-editor a { color: #7ed6ff; }
.doc-editor img { max-width: 100%; border-radius: 10px; }

.fmt-btn {
  padding: 6px 8px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--text-muted);
  transition: background-color .15s, color .15s, transform .15s var(--ease-out);
}
.fmt-btn:hover { background: var(--grad-brand-soft); color: var(--brand); transform: translateY(-1px); }

/* Priority dot — reużywane w widokach */
.prio-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #64748b; }
.prio-dot.prio-low     { background: #94a3b8; }
.prio-dot.prio-medium  { background: #1aa6ee; }
.prio-dot.prio-high    { background: #f59e0b; }
.prio-dot.prio-urgent  { background: #ef4444; }

.doc-tree-item a:hover { transition: background .15s; }

/* ============================================================================
   EMPTY STATE — spójny, „przyjemny" stan pustki
   ========================================================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.5rem 1.5rem;
  animation: fadeIn .4s ease-out both;
}
.empty-state .es-icon {
  width: 64px; height: 64px;
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  color: var(--blue-600);
  background: var(--grad-brand-soft);
  margin-bottom: 1rem;
  animation: floatY 5s ease-in-out infinite;
}
.dark .empty-state .es-icon { color: #7ed6ff; }
.empty-state .es-title { font-weight: 600; color: var(--text); margin-bottom: .25rem; }
.empty-state .es-sub { font-size: .875rem; color: var(--text-muted); max-width: 32ch; }
.empty-state .es-cta { margin-top: 1.1rem; }

/* Markowy tekst w gradiencie loga */
.brand-text {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 800;
}

/* Line clamp */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
