/* ================================================================
   GRAFIK GILLETTE - CALENDAR.CSS
   Part of modular CSS split (v3.8.0)
   ================================================================ */

/* === CALENDAR === */
.calendar-wrap {
  overflow: visible;
}
.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 6px;
  animation: slideIn 0.3s ease-out;
}
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
.slide-right {
  animation: slideRight 0.3s ease-out;
}
.slide-left {
  animation: slideLeft 0.3s ease-out;
}
@keyframes slideRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes slideLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
/* Zapewnij, że kalendarz mieści się w kontenerze bez łamania popupów */
.calendar {
  width: 100%;
  box-sizing: border-box;
}

.day-header {
  text-align: center;
  font-weight: bold;
  padding: 6px;
  background: linear-gradient(180deg, #4b5563, #374151);
  color: #f3f4f6;
  border-radius: 6px;
  font-size: 13px;
}
body:not(.theme-dark) .day-header {
  background: linear-gradient(180deg, #e5e7eb, #d1d5db);
  color: #1f2937;
}
.day-header.weekend {
  background: linear-gradient(180deg, #4b5563, #374151);
  color: #fca5a5;
  box-shadow: inset 0 -2px 0 #ef4444;
  text-shadow: none;
}
body:not(.theme-dark) .day-header.weekend {
  background: linear-gradient(180deg, #e5e7eb, #d1d5db);
  color: #b91c1c;
  box-shadow: inset 0 -2px 0 #ef4444;
}

.day-cell {
  min-height: 74px;
  border: 1px solid var(--border-cell);
  border-radius: 8px;
  padding: 5px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--bg-cell);
  cursor: pointer;
  transition:
    transform 0.15s,
    box-shadow 0.15s,
    filter 0.15s;
  color: var(--text-main);
  position: relative;
}
/* Zapewnij, że komórki dni nie wymuszają rozszerzania kolumn siatki (naprawia miesiące z za dużymi komórkami) */
.day-cell {
  min-width: 0;
}
.day-cell:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-color);
  filter: brightness(1.06);
  z-index: 20;
}
.day-cell.empty {
  background: transparent;
  border: none;
  cursor: default;
}

/* === DZIŚ (widok Miesiąc) — obwódka w kolorze kontrastującym z KOLOREM KOMÓRKI ===
   Ramka to dwa pierścienie po 2px, oba w granicach komórki (nie wystają poza
   przerwę siatki, więc sąsiad ich nie zasłania i nie ruszamy z-index):
     --today-ring     → inset box-shadow, kontrast wobec tła KOMÓRKI,
     var(--text-main) → outline, kontrast wobec tła STRONY.
   --today-ring bierze się z tokenu tekstu komórki (--color-*-text), który
   js/personalization.js przelicza z realnego koloru komórki (_textOn() po
   każdej zmianie palety prefs.cellColors). Dlatego żółta komórka R dostaje
   ciemny pierścień, a ciemna komórka P/N/U jasny — znacznik "dziś" jest
   widoczny przy każdej palecie, motywie (light/dark) i skinie komórek. */
.day-cell.today {
  /* Usuń ozdobną kropkę; zamiast tego użyj kontrastującego obramowania */
  --today-ring: var(--text-main);
  box-shadow: inset 0 0 0 2px var(--today-ring);
  outline: 2px solid var(--text-main);
  outline-offset: 0;
}

/* Ukryj poprzedni znacznik kropki, jeśli jest obecny */
.day-cell.today::before {
  display: none;
}

/* Te same deklaracje dla komórek ze zmianą i urlopem. Selektor ma kwalifikator
   `body`, bo skiny UI nadają komórkom własny box-shadow z wyższą
   specyficznością (np. `body.ui-skin-neon .day-cell.cell-R`) — bez tego
   pierścień "dziś" znikałby w neonie. Kolejność w pliku nadal rozstrzyga
   o pierwszeństwie: skiny strip/quiet (niżej) i tryb edycji fabryki
   (body.edit-active, niżej) zachowują priorytet. */
body .day-cell.cell-R.today,
body .day-cell.cell-P.today,
body .day-cell.cell-N.today,
body .day-cell.cell-W.today,
body .day-cell.urlop.today,
body .day-cell.today:not([class*='cell-']) {
  box-shadow: inset 0 0 0 2px var(--today-ring);
  outline: 2px solid var(--text-main);
  outline-offset: 0;
}

/* Pierścień wewnętrzny = kolor tekstu komórki (auto-kontrast palety) */
.day-cell.cell-R.today {
  --today-ring: var(--color-R-text, #1a1a1a);
}
.day-cell.cell-P.today {
  --today-ring: var(--color-P-text, #ffffff);
}
.day-cell.cell-N.today {
  --today-ring: var(--color-N-text, #ffffff);
}
.day-cell.urlop.today {
  --today-ring: var(--color-U-text, #ffffff);
}

.day-cell.selected {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  z-index: 20;
  box-shadow:
    0 0 0 3px rgba(255, 87, 34, 0.25),
    0 4px 15px var(--shadow-color);
}

body.edit-active .day-cell:not(.empty) {
  cursor: crosshair;
  box-shadow: inset 0 0 0 1px rgba(230, 126, 34, 0.5);
}
body.edit-active .day-cell:not(.empty):hover {
  outline: 2px solid #e67e22;
  outline-offset: -2px;
  transform: scale(1.04);
}

/* Style E: full factory fill for shifts; empty/dashed free days */
.day-cell.cell-R {
  background: var(--color-R);
  color: var(--color-R-text, #fff);
  border-color: var(--color-R-border);
}
.day-cell.cell-P {
  background: var(--color-P);
  color: var(--color-P-text, #fff);
  border-color: var(--color-P-border, var(--color-P));
}
.day-cell.cell-N {
  background: var(--color-N);
  color: var(--color-N-text, #fff);
  border-color: var(--color-N-border, var(--color-N));
}
.day-cell.cell-R::after,
.day-cell.cell-P::after,
.day-cell.cell-N::after {
  display: none;
}
.day-cell.cell-R .day-num,
.day-cell.cell-P .day-num,
.day-cell.cell-N .day-num,
.day-cell.cell-R .day-shift,
.day-cell.cell-P .day-shift,
.day-cell.cell-N .day-shift {
  color: inherit;
  font-weight: 700;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
}

/* Free day — hollow / dashed, no fill */
.day-cell.cell-W {
  background: transparent;
  color: var(--text-muted, #8b9bb4);
  border: 1px dashed var(--border-cell);
  box-shadow: none;
}
.day-cell.cell-W::after {
  display: none;
}
.day-cell.cell-W .day-num,
.day-cell.cell-W .day-shift {
  color: var(--text-muted, #8b9bb4);
  font-weight: 600;
}

/* Weekend free — slightly stronger empty state */
.day-cell.day-weekend.cell-W {
  background: rgba(90, 30, 30, 0.18);
  border: 1px dashed rgba(185, 70, 70, 0.45);
  color: #c4a4a4;
}
.day-cell.day-weekend.cell-W .day-num,
.day-cell.day-weekend.cell-W .day-shift {
  color: #c4a4a4;
}

.day-cell.holiday.cell-W {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px dashed rgba(239, 68, 68, 0.45);
}
body:not(.theme-dark) .day-cell.holiday.cell-W {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px dashed #f5b7b1;
}

/* Vacation — full fill */
.day-cell.urlop {
  background: var(--color-U-grad) !important;
  color: var(--color-U-text, #fff) !important;
  border-color: var(--color-U-border, #0f766e) !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25) !important;
}
.day-cell.urlop::after {
  display: none !important;
}
.day-cell.urlop .day-num,
.day-cell.urlop .day-shift {
  color: var(--color-U-text, #fff) !important;
}
.day-cell .urlop-icon {
  display: none; /* legacy — urlop is bottom day-shift */
}
.day-shift.day-shift-urlop {
  color: #fff;
  font-size: 22px;
}
.day-shift.day-shift-urlop .shift-emoji {
  font-size: 20px;
  opacity: 1;
}

.day-cell.cycle-start {
  border-top: 3px solid #f1c40f;
  border-left: 3px solid #f1c40f;
}
.day-cell.cycle-middle {
  border-top: 3px solid #f1c40f;
  border-bottom: 3px solid #f1c40f;
}
.day-cell.cycle-end {
  border-top: 3px solid #f1c40f;
  border-right: 3px solid #f1c40f;
}


.day-cell.dirty-edit {
  outline: 3px dashed #f1c40f !important;
  outline-offset: -3px;
  animation: flashEdit 0.5s ease-out;
}
@keyframes flashEdit {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  30% {
    transform: scale(1.08);
    filter: brightness(1.3);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

.day-num {
  font-weight: bold;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 3px;
  position: relative;
  z-index: 2;
}
.day-emoji {
  font-size: 14px;
}
.day-shift {
  text-align: center;
  font-weight: bold;
  font-size: 26px;
  line-height: 1;
  margin-top: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  position: relative;
  z-index: 2;
}
.day-shift .shift-emoji {
  font-size: 15px;
  opacity: 0.85;
}

.day-cell.day-weekend {
  box-shadow: inset 0 0 0 1px rgba(192, 57, 43, 0.35);
}
.day-cell.day-weekend.cell-W {
  background: rgba(90, 30, 30, 0.12);
  border: 1px dashed rgba(185, 70, 70, 0.45);
}
body.theme-dark .day-cell.day-weekend.cell-W,
body.theme-neon .day-cell.day-weekend.cell-W,
body.theme-contrast .day-cell.day-weekend.cell-W {
  background: rgba(90, 30, 30, 0.22);
  border: 1px dashed rgba(185, 70, 70, 0.5);
}
.day-cell.day-weekend .day-num {
  font-style: italic;
}

.day-note {
  position: absolute;
  bottom: 2px;
  right: 3px;
  font-size: 10px;
  background: rgba(255, 255, 255, 0.3);
  padding: 1px 4px;
  border-radius: 3px;
  z-index: 3;
}

/* === INFO PANEL === */
.info-panel {
  margin-top: 15px;
  padding: 16px;
  background: var(--bg-info);
  border-radius: 12px;
  border: 1px solid var(--border-cell);
}
.info-panel h3 {
  margin: 0 0 8px;
  color: var(--text-header);
  font-size: 16px;
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.info-card {
  background: var(--bg-info-card);
  padding: 12px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}
.info-card .label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.info-card .value {
  font-size: 15px;
  font-weight: bold;
  color: var(--text-header);
  margin-top: 4px;
}
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: bold;
  color: #fff;
  font-size: 13px;
  margin: 2px;
}
.badge.A {
  background: var(--brig-A);
}
.badge.B {
  background: var(--brig-B);
}
.badge.C {
  background: var(--brig-C);
}
.badge.D {
  background: var(--brig-D);
}
.shift-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 5px;
  color: #fff;
  font-weight: bold;
  font-size: 16px;
}
.shift-chip.R {
  background: var(--color-R);
  color: var(--color-R-text, #fff);
}
.shift-chip.P {
  background: var(--color-P);
  color: var(--color-P-text, #fff);
}
.shift-chip.N {
  background: var(--color-N);
  color: var(--color-N-text, #fff);
}

.urlop-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--color-U-grad);
  color: #fff;
  border-radius: 10px;
  margin: 10px 0;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(7, 89, 133, 0.4);
  gap: 12px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.urlop-stats .us-count {
  font-size: 24px;
  font-weight: bold;
}
.urlop-stats .us-over {
  color: #ffe0e0;
}

/* === LEGEND === */
.legend {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 12px;
}
.legend span {
  padding: 3px 9px;
  border-radius: 5px;
  color: #fff;
  font-weight: bold;
}
.legend .lg-R {
  background: var(--color-R);
}
.legend .lg-P {
  background: var(--color-P);
}
.legend .lg-N {
  background: var(--color-N);
}
.legend .lg-W {
  background: var(--color-W);
  color: var(--color-W-text);
}
.legend .lg-U {
  background: var(--color-U-grad);
}

.note-input {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border-cell);
  border-radius: 8px;
  background: var(--bg-container);
  color: var(--text-main);
  font-size: 13px;
}

small {
  color: var(--text-muted);
  font-weight: normal;
}

/* === NOTIFICATION LEAD BUTTONS === */
.notif-lead-buttons {
  padding: 10px 12px;
  margin: 0 0 8px 0;
  background: var(--bg-cell);
  border: 1px solid var(--border-cell);
  border-radius: 8px;
  animation: fadeInUp 0.3s ease-out;
}

.notif-lead-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  font-weight: 700;
}

.notif-lead-btns {
  display: flex;
  gap: 6px;
}

.notif-lead-btn {
  flex: 1;
  padding: 8px 12px;
  border: 2px solid var(--border-cell);
  background: var(--bg-container);
  color: var(--text-main);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  transition: all 0.15s;
}

.notif-lead-btn:hover {
  border-color: var(--text-header);
  background: var(--bg-controls);
}

.notif-lead-btn.active {
  background: var(--text-header);
  color: #fff;
  border-color: var(--text-header);
  box-shadow: 0 2px 6px var(--shadow-color);
  transform: scale(1.05);
}

.notif-lead-btn.active:hover {
  filter: brightness(1.1);
}

/* Pozwól kalendarzowi miesięcznemu przewijać się na małych/mobilnych ekranach (naprawia miesiące potrzebujące 6 wierszy, np. sierpień) */

/* Poprawka dla niskich wysokości viewportu (telefony w poziomie, małe okna): pozwól kalendarzowi przewijać się
   w pionie, aby miesiące potrzebujące 6 wierszy (np. sierpień) nie ucinały ostatniego tygodnia. */

/* === INFO PANEL SECTIONS === */
.info-section {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-cell);
}
.info-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.info-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-header);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Stable cell layout: date top-left, marker bottom-center */
.day-cell:not(.empty) {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
}
.day-cell .day-num {
  align-self: flex-start;
  margin: 0;
  padding: 0;
}
.day-cell .day-shift {
  align-self: center;
  margin-top: auto;
  margin-bottom: 6px; /* room above color strip */
  min-height: 1.2em;
}
.day-cell .ot-badge,
.day-cell .ot-marker {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 3;
}

.day-cell .day-note {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  background: linear-gradient(135deg, #ef7c08, #212222);
  color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  z-index: 4;
  pointer-events: none;
}

/* ===== CELL SKINS (body.skin-*) ===== */

/* --- strip: neutral body + left color bar; vacation also calm (strip + light tint) --- */
body.skin-strip .day-cell.cell-R,
body.skin-strip .day-cell.cell-P,
body.skin-strip .day-cell.cell-N {
  background: var(--bg-cell);
  color: var(--text-main);
  border-color: var(--border-cell);
  box-shadow: none;
}
body.skin-strip .day-cell.cell-R::before,
body.skin-strip .day-cell.cell-P::before,
body.skin-strip .day-cell.cell-N::before,
body.skin-strip .day-cell.urlop::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 10px 0 0 10px;
  z-index: 1;
}
body.skin-strip .day-cell.cell-R::before {
  background: var(--color-R);
}
body.skin-strip .day-cell.cell-P::before {
  background: var(--color-P);
}
body.skin-strip .day-cell.cell-N::before {
  background: var(--color-N);
}
body.skin-strip .day-cell.urlop::before {
  background: var(--color-U);
}

body.skin-strip .day-cell.cell-R .day-shift {
  color: var(--color-R);
  text-shadow: none;
}
body.skin-strip .day-cell.cell-P .day-shift {
  color: var(--color-P);
  text-shadow: none;
}
body.skin-strip .day-cell.cell-N .day-shift {
  color: var(--color-N);
  text-shadow: none;
}
body.skin-strip .day-cell.cell-R .day-num,
body.skin-strip .day-cell.cell-P .day-num,
body.skin-strip .day-cell.cell-N .day-num {
  color: var(--text-main);
  text-shadow: none;
}

body.skin-strip .day-cell.urlop {
  background: color-mix(in srgb, var(--color-U) 18%, var(--bg-cell)) !important;
  color: var(--text-main) !important;
  border-color: var(--border-cell) !important;
  text-shadow: none !important;
}
body.skin-strip .day-cell.urlop .day-num,
body.skin-strip .day-cell.urlop .day-shift {
  color: var(--text-main) !important;
}
body.skin-strip .day-cell.urlop::after {
  display: none !important;
}

/* --- colored outline skin: colored cell frame + date ring --- */
body.skin-quiet .day-cell.cell-R,
body.skin-quiet .day-cell.cell-P,
body.skin-quiet .day-cell.cell-N {
  background: var(--bg-cell);
  color: var(--text-main);
  box-shadow: none;
}
body.skin-quiet .day-cell.cell-R {
  border-color: var(--color-R);
}
body.skin-quiet .day-cell.cell-P {
  border-color: var(--color-P);
}
body.skin-quiet .day-cell.cell-N {
  border-color: var(--color-N);
}
body.skin-quiet .day-cell.cell-R::after,
body.skin-quiet .day-cell.cell-P::after,
body.skin-quiet .day-cell.cell-N::after {
  display: none !important;
  content: none;
}
body.skin-quiet .day-cell.cell-R .day-shift,
body.skin-quiet .day-cell.cell-P .day-shift,
body.skin-quiet .day-cell.cell-N .day-shift {
  color: var(--text-main);
  text-shadow: none;
}
body.skin-quiet .day-cell.cell-R .day-num,
body.skin-quiet .day-cell.cell-P .day-num,
body.skin-quiet .day-cell.cell-N .day-num {
  color: var(--text-main);
  text-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55em;
  min-height: 1.55em;
  border-radius: 50%;
  border: 2px solid transparent;
  box-sizing: border-box;
  line-height: 1;
  padding: 1px;
}
body.skin-quiet .day-cell.cell-R .day-num {
  border-color: var(--color-R);
}
body.skin-quiet .day-cell.cell-P .day-num {
  border-color: var(--color-P);
}
body.skin-quiet .day-cell.cell-N .day-num {
  border-color: var(--color-N);
}

body.skin-quiet .day-cell.urlop {
  background: var(--bg-cell) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--color-U) !important;
  text-shadow: none !important;
}
body.skin-quiet .day-cell.urlop::after {
  display: none !important;
  content: none !important;
}
body.skin-quiet .day-cell.urlop .day-num {
  color: var(--text-main) !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55em;
  min-height: 1.55em;
  border-radius: 50%;
  border: 2px solid var(--color-U) !important;
  box-sizing: border-box;
  line-height: 1;
  padding: 1px;
}
body.skin-quiet .day-cell.urlop .day-shift {
  color: var(--text-main) !important;
}

/* === DZIŚ w skinach z neutralnym tłem komórek (strip/quiet) ===
   W tych skinach kolor zmiany jest tylko paskiem albo obramowaniem, a tło
   komórki pozostaje neutralne (--bg-cell), więc pierścień "dziś" musi iść
   w tonie motywu, a nie w kolorze zmiany. Reguła stoi po blokach skinów,
   bo to one zerują box-shadow komórek (także komórki "dziś"). */
body.skin-strip .day-cell.today,
body.skin-quiet .day-cell.today,
body.skin-strip .day-cell.urlop.today,
body.skin-quiet .day-cell.urlop.today {
  --today-ring: var(--text-main);
  box-shadow: inset 0 0 0 2px var(--today-ring);
}
