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

/* === YEAR VIEW === */
.year-view {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 10px;
  max-width: 100%;
  overflow: hidden;
}
.year-month {
  background: var(--bg-cell);
  border-radius: 12px;
  padding: 10px;
  border: 1px solid var(--border-cell);
  cursor: pointer;
  transition: all 0.2s;
  min-width: 0;
  overflow: hidden;
}
.year-month:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px var(--shadow-color);
}
.year-month h4 {
  margin: 0 0 6px;
  text-align: center;
  color: var(--text-header);
  font-size: 14px;
}
.mini-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  min-width: 0;
}
.mini-day {
  border-radius: 3px;
  font-size: 9px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  min-width: 0;
  width: 100%;
  height: 18px;
  overflow: hidden;
  transition: transform 0.1s;
  cursor: pointer;
  position: relative;
}
.mini-day:hover {
  transform: scale(1.3);
  z-index: 5;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}
.mini-day.mR {
  background: var(--color-R);
}
.mini-day.mP {
  background: var(--color-P);
}
.mini-day.mN {
  background: var(--color-N);
}
.mini-day.mW {
  background: var(--color-W);
  color: var(--color-W-text);
  text-shadow: none;
}
.mini-day.mE {
  background: transparent;
  cursor: default;
}
.mini-day.mE:hover {
  transform: none;
  box-shadow: none;
}
/* === DZIŚ (widok Rok) — pierścień kontrastujący z KOLOREM mini-komórki ===
   --today-ring = token tekstu komórki (auto-kontrast palety), jak w kalendarzu
   miesięcznym. 2px w całości wewnątrz mini-komórki (offset -2px), bo
   .mini-day ma overflow: hidden. */
.mini-day.mToday {
  --today-ring: var(--text-main);
  outline: 2px solid var(--today-ring);
  outline-offset: -2px;
}
.mini-day.mR.mToday {
  --today-ring: var(--color-R-text, #1a1a1a);
}
.mini-day.mP.mToday {
  --today-ring: var(--color-P-text, #ffffff);
}
.mini-day.mN.mToday {
  --today-ring: var(--color-N-text, #ffffff);
}
.mini-day.mU.mToday {
  --today-ring: var(--color-U-text, #ffffff);
}
.mini-day.mHoliday {
  box-shadow: inset 0 0 0 2px #c0392b;
}
.mini-day.mU {
  background: var(--color-U-grad) !important;
  color: #fff !important;
}
.mini-day.mDirty {
  outline: 2px dashed #f1c40f !important;
  outline-offset: -1px;
}
.mini-weekday {
  font-size: 8px;
  text-align: center;
  color: var(--text-muted);
  font-weight: bold;
  padding: 1px 0;
  min-width: 0;
}





/* === TABLE VIEW === */
.table-view {
  margin-top: 10px;
  overflow-x: visible;
  background: var(--bg-cell);
  border-radius: 12px;
  padding: 10px 8px;
  border: 1px solid var(--border-cell);
  animation: slideIn 0.3s ease-out;
}
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
}
.table-month-block {
  width: 100%;
}
.table-month-title,
.table-month-block h3 {
  text-align: center;
  color: var(--text-header);
  margin: 10px 0 8px;
  font-size: 17px;
  position: sticky;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 2;
  background: var(--bg-cell);
  padding: 4px 0;
}
.brigade-table {
  /* B: compact rounded cells + separate spacing */
  border-collapse: separate;
  border-spacing: 2px;
  width: 100%;
  font-size: 12px;
  min-width: 0;
  table-layout: fixed;
}
.brigade-table th,
.brigade-table td {
  border: none;
  padding: 0;
  text-align: center;
  height: 40px;
  min-width: 0;
  position: relative;
  overflow: hidden;
  border-radius: 2px;
}
.brigade-table th {
  background: linear-gradient(180deg, #4b5563, #374151);
  color: #f3f4f6;
  font-weight: bold;
  font-size: 12px;
  padding: 6px 4px;
  position: sticky;
  top: 0;
  z-index: 3;
}
body:not(.theme-dark) .brigade-table th {
  background: linear-gradient(180deg, #e5e7eb, #d1d5db);
  color: #1f2937;
}
.brigade-table th.brig-label {
  background: var(--bg-controls);
  color: var(--text-header);
  position: sticky;
  left: 0;
  z-index: 5;
  min-width: 40px;
  width: 40px;
  padding: 2px 4px;
  font-size: 13px;
  border-radius: 2px;
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.25);
}
.brigade-table th.brig-label.A {
  border-left: 5px solid var(--brig-A);
}
.brigade-table th.brig-label.B {
  border-left: 5px solid var(--brig-B);
}
.brigade-table th.brig-label.C {
  border-left: 5px solid var(--brig-C);
}
.brigade-table th.brig-label.D {
  border-left: 5px solid var(--brig-D);
}
.brigade-table th.date-header {
  min-width: 0;
  padding: 3px 1px;
  font-size: 10px;
  line-height: 1.15;
  border-radius: 2px;
  height: 36px;
}
.brigade-table th.date-header .dh-day {
  display: block;
  font-size: 10px;
  opacity: 0.8;
  font-weight: normal;
}
.brigade-table th.date-header .dh-num {
  display: block;
  font-size: 11px;
  font-weight: bold;
}
.brigade-table th.date-header.weekend {
  background: linear-gradient(180deg, #4b5563, #374151);
  color: #fca5a5;
  box-shadow: inset 0 -2px 0 #ef4444;
}
body:not(.theme-dark) .brigade-table th.date-header.weekend {
  background: linear-gradient(180deg, #e5e7eb, #d1d5db);
  color: #b91c1c;
  box-shadow: inset 0 -2px 0 #ef4444;
}
.brigade-table th.date-header.today {
  background: linear-gradient(135deg, #f1c40f, #f39e0b);
  color: #111;
  box-shadow: inset 0 0 0 2px #d97706;
}
.brigade-table th.date-header.holiday {
  background: linear-gradient(180deg, #4b5563, #374151);
  color: #fecaca;
  box-shadow: inset 0 -2px 0 #f87171, inset 0 0 0 1px rgba(255,200,200,0.3);
}
body:not(.theme-dark) .brigade-table th.date-header.holiday {
  background: linear-gradient(180deg, #e5e7eb, #d1d5db);
  color: #991b1b;
  box-shadow: inset 0 -2px 0 #ef4444;
}
.brigade-table td.tc {
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  border-radius: 2px;
}
.brigade-table td.tc:hover {
  transform: scale(1.08);
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
body.edit-active .brigade-table td.tc {
  cursor: crosshair;
}
body.edit-active .brigade-table td.tc:hover {
  outline: 3px solid #e67e22;
  outline-offset: -3px;
  transform: scale(1.2);
}
.brigade-table td.tc-R {
  background: var(--color-R);
}
.brigade-table td.tc-P {
  background: var(--color-P);
}
.brigade-table td.tc-N {
  background: var(--color-N);
}
.brigade-table td.tc-W {
  background: transparent;
  color: var(--text-muted, #6b7c90);
  font-size: 11px;
  font-weight: 600;
  border: 1px dashed var(--border-cell);
  box-shadow: none;
}
.brigade-table td.tc-U {
  background: var(--color-U-grad);
  color: #fff;
  position: relative;
  font-size: 14px;
}
/* D: weekend column tint */
.brigade-table td.weekend-col {
  box-shadow: inset 0 0 0 1px rgba(192, 57, 43, 0.35);
}
.brigade-table td.tc-W.weekend-col {
  background: rgba(90, 30, 30, 0.22);
  border: 1px dashed rgba(185, 70, 70, 0.5);
  color: #c4a4a4;
}
.brigade-table td.tc-R.weekend-col,
.brigade-table td.tc-P.weekend-col,
.brigade-table td.tc-N.weekend-col,
.brigade-table td.tc-U.weekend-col {
  box-shadow: inset 0 0 0 2px rgba(192, 57, 43, 0.45);
}
.brigade-table td.my-brigade {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}
.brigade-table td.dirty-edit {
  outline: 3px dashed #f1c40f !important;
  outline-offset: -3px;
}

.table-year-wrap {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.table-legend {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 8px;
  background: var(--bg-controls);
  border-radius: 8px;
  font-size: 12px;
}
.table-legend span {
  padding: 3px 10px;
  border-radius: 4px;
  font-weight: bold;
  color: #fff;
}
.table-legend .tl-R {
  background: var(--color-R);
}
.table-legend .tl-P {
  background: var(--color-P);
}
.table-legend .tl-N {
  background: var(--color-N);
}
.table-legend .tl-W {
  background: var(--color-W);
  color: var(--color-W-text);
}
.table-legend .tl-U {
  background: var(--color-U-grad);
}

/* Year month title: neutral, not header-blue */
.year-month h4 {
  color: var(--text-main);
}
.mini-weekday {
  color: var(--text-muted);
}


/* Year: weekend columns more visible */
.mini-weekday.mini-weekend {
  color: #f87171;
  font-weight: 800;
}
.mini-day.mWeekend {
  box-shadow: inset 0 0 0 1.5px rgba(239, 68, 68, 0.85);
}
.mini-day.mW.mWeekend {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  text-shadow: none;
}
body:not(.theme-dark) .mini-day.mW.mWeekend {
  background: #fee2e2;
  color: #b91c1c;
}
.mini-day.mWeekend:not(.mW):not(.mE) {
  /* working weekend still has shift color + red ring */
  outline: 1.5px solid rgba(239, 68, 68, 0.9);
  outline-offset: -1px;
}


/* ===== Table density: comfortable (mockup-like) ===== */
body.table-density-comfortable .brigade-table {
  border-spacing: 5px;
  min-width: 720px;
}
body.table-density-comfortable .brigade-table th,
body.table-density-comfortable .brigade-table td {
  border-radius: 10px;
}
body.table-density-comfortable .brigade-table th.brig-label {
  min-width: 44px;
  padding: 8px 6px;
  font-size: 13px;
  border-radius: 10px;
}
body.table-density-comfortable .brigade-table th.date-header {
  min-width: 36px;
  padding: 6px 3px;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
}
body.table-density-comfortable .brigade-table th.date-header .dh-num {
  font-size: 13px;
  font-weight: 700;
}
body.table-density-comfortable .brigade-table th.date-header .dh-day {
  font-size: 10px;
  opacity: 0.75;
}
body.table-density-comfortable .brigade-table th.date-header.weekend {
  background: transparent;
  color: #f87171;
  box-shadow: none;
}
body.table-density-comfortable .brigade-table th.date-header.today {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #111;
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.45);
}
body.table-density-comfortable .brigade-table td {
  height: 40px;
  min-width: 36px;
}
body.table-density-comfortable .brigade-table td.tc {
  font-size: 15px;
  font-weight: 800;
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
body.table-density-comfortable .brigade-table td.tc:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}
body.table-density-comfortable .table-legend {
  gap: 10px;
  padding: 12px 8px 4px;
}
body.table-density-comfortable .table-legend span {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-controls);
  font-size: 12px;
}
body.table-density-comfortable .table-scroll {
  border-radius: 14px;
  padding: 8px;
  background: color-mix(in srgb, var(--bg-controls) 55%, transparent);
}

@media (max-width: 600px) {
  body.table-density-comfortable .brigade-table {
    min-width: 640px;
  }
  body.table-density-comfortable .brigade-table td {
    height: 36px;
    min-width: 32px;
  }
  body.table-density-comfortable .brigade-table td.tc {
    font-size: 13px;
  }
}

/* === DZIŚ (widok Tabela) — pierścień wewnątrz komórki w kolorze
   kontrastującym z KOLOREM KOMÓRKI ===
   Inset, bo td.today-col to kolumna dnia: pierścień nie wystaje poza komórkę
   (td ma overflow: hidden) i nie koliduje z tintem weekendu.
   --today-ring = token tekstu komórki (auto-kontrast palety z prefs.cellColors),
   dlatego żółta komórka R dostaje ciemny pierścień, a ciemna P/N/U jasny.
   !important: gęstość "comfortable" (body.table-density-comfortable ...
   td.tc) i cieniowanie hover nadpisują box-shadow komórki własną, wyższą
   specyficznością — bez tego znacznik "dziś" zniknąłby w tym trybie.
   Outline zostaje wolny dla .my-brigade (obwódka brygady). */
.brigade-table td.today-col {
  --today-ring: var(--text-main);
  box-shadow: inset 0 0 0 3px var(--today-ring) !important;
}
.brigade-table td.tc-R.today-col {
  --today-ring: var(--color-R-text, #1a1a1a);
}
.brigade-table td.tc-P.today-col {
  --today-ring: var(--color-P-text, #ffffff);
}
.brigade-table td.tc-N.today-col {
  --today-ring: var(--color-N-text, #ffffff);
}
.brigade-table td.tc-U.today-col {
  --today-ring: var(--color-U-text, #ffffff);
}
