/* SOUBOR: css/calendar.css (v6.1 - COMPLETE SPLIT SUPPORT) */
/* POPIS: Styly kalendáře včetně nové fialové pro dělené směny (Split Shifts). */

/* --- WRAPPER & HEADER --- */
.calendar-wrapper {
  background: var(--c-card);
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 10px;
}

/* Desktop: Odstraň margin-bottom v grid layoutu */
@media (min-width: 1024px) {
  .desktop-layout > .calendar-wrapper {
    margin-bottom: 0;
  }
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  gap: 10px;
  position: relative;
}

.calendar-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--c-text-main);
  text-transform: capitalize;
  position: absolute;
  left: 44px;
  transform: none;
}

.nav-buttons {
  display: flex;
  gap: 6px;
  align-items: center;
}

.nav-btn {
  background: var(--c-input-bg);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--c-text-main);
  transition: var(--trans-fast);
}

.nav-btn:active {
  transform: scale(0.9);
  background: var(--c-border);
}

/* ✅ TLAČÍTKO "DNES" - Bílé pozadí s šedým okrajem */
.today-btn {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--trans-fast);
  padding: 0;
}

.today-btn:hover {
  background: var(--c-input-bg);
}

.today-btn:active {
  transform: scale(0.9);
  background: var(--c-border);
}

/* --- GRID & DAYS --- */
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--c-text-muted);
  margin-bottom: 12px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal-day {
  aspect-ratio: 1/1;
  border-radius: 10px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 4px;
  cursor: pointer;
  position: relative;
  transition: var(--trans-fast);
}

.cal-day:active {
  transform: scale(0.95);
}

.cal-day.empty {
  background: transparent;
  border: none;
  cursor: default;
}

.cal-day.today {
  border-color: var(--c-text-main);
  background: var(--c-bg);
  font-weight: 800;
}

/* --- LOGIKA MINULOSTI (Past) --- */
/* Výchozí: Minulost je šedá a zamčená */
.cal-day.past {
  opacity: 0.5;
  background-color: var(--c-input-bg);
  filter: grayscale(100%);
  cursor: not-allowed;
}

/* VÝJIMKA: Pokud je směna potvrzená nebo dělená, je v minulosti vidět barevně */
.cal-day.past.s-confirmed,
.cal-day.past.s-split {
  opacity: 1;
  /* background barvy se dědí ze specifických tříd níže */
  filter: none;
  cursor: pointer;
}

/* --- STATES (Barvy stavů) --- */
.day-num {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 2px;
  color: var(--c-text-main);
}

/* 1. CONFIRMED (Zelená - 1 člověk) */
.s-confirmed {
  background-color: rgba(52, 199, 89, 0.15);
  border-color: rgba(52, 199, 89, 0.4);
}
.s-confirmed .status-dot {
  background: var(--c-green);
}

/* 2. PENDING (Žlutá - Zájemci) */
.s-pending {
  background-color: rgba(255, 204, 0, 0.15);
  border-color: rgba(255, 204, 0, 0.4);
}
.s-pending .day-num {
  color: var(--c-text-main);
}
.s-pending .status-dot {
  background: var(--c-gold);
}

/* 3. SPLIT SHIFT (Fialová - Více lidí) - NOVÉ */
.s-split {
  background-color: var(--c-purple-bg);
  border-color: var(--c-purple);
}
.s-split .status-dot {
  background: var(--c-purple);
}

/* --- DOTS & BADGES --- */
.day-status {
  width: 100%;
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-badge-mini {
  font-size: 0.6rem;
  padding: 2px 4px;
  border-radius: 4px;
  width: 100%;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: none;
}

/* --- LEGEND --- */
.calendar-legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 0.75rem;
  color: var(--c-text-muted);
  margin-top: 16px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot.confirmed { background: var(--c-green); }
.dot.pending { background: var(--c-gold); }
.dot.split { background: var(--c-purple); } /* NOVÉ */
.dot.free { border: 1px solid var(--c-border); }

/* --- RESPONSIVE --- */
@media (min-width: 768px) {
  .calendar-grid {
    gap: 8px;
  }

  .cal-day {
    height: 90px;
    align-items: flex-start;
    padding: 8px;
    aspect-ratio: auto;
  }

  .status-badge-mini {
    display: block;
    margin-top: auto;
  }

  .day-status {
    display: none;
  }
}

/* --- DESKTOP - Menší kalendář aby odpovídal statistikám --- */
@media (min-width: 1024px) {
  .calendar-header h3 {
    font-size: 1.1rem;
  }

  .calendar-weekdays {
    font-size: 0.8rem;
    margin-bottom: 10px;
  }

  .calendar-grid {
    gap: 6px;
  }

  .cal-day {
    height: 70px;
    padding: 6px;
    border-radius: 10px;
  }

  .day-num {
    font-size: 0.9rem;
  }

  .status-badge-mini {
    font-size: 0.65rem;
    padding: 2px 4px;
  }

  .calendar-legend {
    font-size: 0.8rem;
    gap: 16px;
    margin-top: 12px;
  }

  .dot {
    width: 8px;
    height: 8px;
  }
}

/* --- ADMIN OVERRIDE --- */
/* Admin vidí v minulosti vše živé */
body.is-admin .cal-day.past {
  opacity: 1;
  filter: none;
  cursor: default;
  background-color: var(--c-card);
}

/* Vynucení barev pro Admina v minulosti */
body.is-admin .cal-day.past.s-confirmed { background-color: rgba(52, 199, 89, 0.15); }
body.is-admin .cal-day.past.s-pending { background-color: rgba(255, 204, 0, 0.15); }
body.is-admin .cal-day.past.s-split { background-color: var(--c-purple-bg); }