/* ── Layout ───────────────────────────────────────────────────────────────── */

.app-body {
  display: flex;
  height: calc(100vh - 56px);
  overflow: hidden;
}

.sidebar {
  width: 200px;
  min-width: 200px;
  border-right: 1px solid #dee2e6;
  overflow-y: auto;
  background: #f8f9fa;
  padding: 12px 8px;
  transition: width 0.2s, min-width 0.2s, padding 0.2s;
}

.sidebar.collapsed {
  width: 0;
  min-width: 0;
  padding: 0;
  overflow: hidden;
}

.main-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Mini calendar ────────────────────────────────────────────────────────── */

.mini-cal-wrap { font-size: 0.75rem; }

.mini-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 0.8rem;
}

.mini-nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 2px;
  color: #495057;
  border-radius: 3px;
}

.mini-nav-btn:hover { color: #0d6efd; background: #e8f0fe; }

.mini-nav-placeholder { width: 18px; display: inline-block; }

.mini-cal-table {
  width: 100%;
  border-collapse: collapse;
}

.mini-cal-table th {
  text-align: center;
  color: #6c757d;
  font-weight: 600;
  padding: 2px 0;
  font-size: 0.7rem;
}

.mini-cal-table td {
  text-align: center;
  padding: 2px 1px;
  cursor: pointer;
  border-radius: 3px;
  font-size: 0.72rem;
}

.mini-cal-table td:hover { background: #dee2e6; }

.mini-kw-cell {
  color: #adb5bd;
  font-size: 0.65rem;
  cursor: pointer !important;
  padding-right: 4px !important;
}

.mini-kw-cell:hover { background: #dee2e6; color: #343a40; }

.mini-day-ok  { color: #198754; font-weight: 700; }
.mini-day-low { color: #a00000; font-weight: 800; }

.mini-today {
  background: #0d6efd !important;
  color: #fff !important;
  border-radius: 50% !important;
  font-weight: 700;
}

.mini-cur-week { background: #e8f0fe; }
.mini-cur-week:hover { background: #c5d8fc; }

.mini-other-month { color: #ced4da; }
.mini-weekend { color: #6c757d; }

/* ── Grid ─────────────────────────────────────────────────────────────────── */

.grid-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  flex: 1;
  width: 100%;
}

#gridContainer {
  width: 100%;
}

.grid-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 700px;
  table-layout: fixed;
  font-size: 0.8rem;
}

.grid-table th,
.grid-table td {
  border: 1px solid #dee2e6;
  padding: 0;
  height: 32px;
  vertical-align: middle;
  overflow: hidden;
}

.grid-table .time-col {
  width: 56px;
  min-width: 56px;
  text-align: right;
  padding-right: 6px;
  color: #6c757d;
  font-size: 0.75rem;
  background: #f8f9fa;
  white-space: nowrap;
  position: sticky;
  left: 0;
  z-index: 2;
  border-right: 2px solid #adb5bd;
}

.grid-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #343a40;
  color: #fff;
  text-align: center;
  padding: 4px 2px;
  font-size: 0.8rem;
}

.grid-table thead th.time-col {
  background: #343a40;
  z-index: 4;
}

.grid-table thead th.today-col {
  background: #0d6efd;
}

.grid-table thead th.weekend-col {
  background: #6c757d;
}

.today-cell {
  border-left: 2px solid #0d6efd !important;
  border-right: 2px solid #0d6efd !important;
}

.slot-weekend {
  background: #f0f0f0;
  cursor: default;
}

/* Half-hour separators */
.grid-table tr.half-hour td {
  border-top-color: #dee2e6;
}
.grid-table tr.full-hour td {
  border-top: 2px solid #adb5bd;
}

/* Slot types */
.slot-cell {
  cursor: pointer;
  position: relative;
}

.slot-cell:hover {
  background-color: #e9ecef !important;
}

.slot-empty {
  background: #fff;
}

.slot-manual {
  background: #d1e7dd;
  cursor: pointer;
}

.slot-manual:hover {
  background: #a3cfbb;
}

.slot-outlook {
  background: #cfe2ff;
  cursor: pointer;
}

.slot-outlook:hover {
  background: #9ec5fe;
}

.slot-cell .slot-text {
  padding: 0 4px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: block;
  line-height: 30px;
  font-size: 0.75rem;
}

.slot-outlook .slot-text {
  color: #084298;
  font-style: italic;
}

.slot-manual .slot-text {
  color: #0a3622;
}

.slot-icon {
  position: absolute;
  right: 3px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.65rem;
  opacity: 0.5;
}

/* ── Month view ────────────────────────────────────────────────────────────── */

.grid-wrapper.month-view {
  overflow-y: hidden;
}

.grid-wrapper.month-view #gridContainer {
  height: 100%;
}

.grid-wrapper.month-view .month-table {
  height: 100%;
}

.month-table td, .month-table th {
  height: auto;
  vertical-align: top;
  padding: 2px 4px !important;
}

.month-week-row td, .month-week-row th { height: 1px; /* auto-distribute via table height:100% */ }

.month-kw {
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  color: #6c757d;
  cursor: pointer !important;
  vertical-align: middle !important;
}
.month-kw:hover { background: #e9ecef; }

.month-day-cell {
  cursor: pointer;
  min-width: 80px;
}
.month-day-cell:hover { background: #f0f4ff !important; }

.month-day-num {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 2px;
  display: inline-block;
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  border-radius: 50%;
}
.month-day-num.is-today {
  background: #0d6efd;
  color: #fff;
}

.month-other   { color: #adb5bd !important; background: #fafafa; }
.month-other .month-day-num { color: #adb5bd !important; }
.month-weekend { background: #f8f8f8; }
.month-today   { background: #eef3ff !important; }

.month-ev {
  font-size: 0.7rem;
  padding: 1px 5px;
  border-radius: 3px;
  margin-bottom: 1px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
}
.month-ev.ev-allday  { background: #6ea8fe; color: #fff; }
.month-ev.ev-outlook { background: #cfe2ff; color: #084298; }
.month-ev.ev-manual  { background: #d1e7dd; color: #0a3622; }

.month-ev-more {
  font-size: 0.68rem;
  color: #6c757d;
  padding-left: 4px;
  cursor: pointer;
}

/* All-day event badge in column header */
.allday-badge {
  display: inline-block;
  margin: 2px auto;
  padding: 1px 6px;
  background: #6ea8fe;
  color: #fff;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 500;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ── Day hours indicator ───────────────────────────────────────────────────── */

.day-hours {
  font-size: 0.7rem;
  font-weight: 500;
  margin-top: 2px;
  opacity: 0.9;
}
.day-hours-ok   { color: #75d2a0; }
.day-hours-warn { color: #ffc107; }
.day-hours-low  { color: #ff8080; }

/* Repeat button */
.repeat-btn {
  font-size: 0.65rem;
  padding: 0 3px;
  height: 20px;
  line-height: 20px;
  opacity: 0.7;
}

.repeat-btn:hover {
  opacity: 1;
}

/* ── Favorites bar ─────────────────────────────────────────────────────────── */

.fav-bar {
  min-height: 34px;
}

.fav-chip {
  display: inline-block;
  padding: 2px 8px;
  background: #e9ecef;
  border: 1px solid #ced4da;
  border-radius: 999px;
  font-size: 0.75rem;
  cursor: pointer;
  max-width: 180px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.fav-chip:hover {
  background: #0d6efd;
  color: #fff;
  border-color: #0d6efd;
}

/* ── Misc ──────────────────────────────────────────────────────────────────── */

.btn-xs {
  padding: 1px 5px;
  font-size: 0.75rem;
}

/* ── Drag-to-select ───────────────────────────────────────────────────────── */

.slot-drag {
  background-color: #bfdbfe !important;
  outline: 1px solid #3b82f6 !important;
  outline-offset: -1px;
}

/* ── Multi-select ─────────────────────────────────────────────────────────── */

.slot-selected {
  outline: 2px solid #0d6efd !important;
  outline-offset: -2px;
  background-color: #cfe2ff !important;
}

/* ── Schattenbuch badge in grid ────────────────────────────────────────────── */

.sb-badge {
  position: absolute;
  top: 1px;
  right: 2px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  padding: 1px 3px;
  border-radius: 3px;
  pointer-events: none;
}

.sb-credit { background: #d1e7dd; color: #0f5132; }
.sb-debit  { background: #f8d7da; color: #842029; }


/* Urlaub slots */
.slot-urlaub {
  background: #fff3e0;
  cursor: pointer;
}

.slot-urlaub:hover {
  background: #ffe0b2;
}

.slot-urlaub .slot-text {
  color: #e65100;
  font-weight: 600;
}

/* ── Feiertag (public holiday) ────────────────────────────────────────────── */

.feiertag-col {
  background: #dc3545 !important;
}

.feiertag-badge {
  font-size: 0.65rem;
  font-weight: 500;
  color: #fff;
  background: #b02a37;
  border-radius: 3px;
  padding: 0 4px;
  display: inline-block;
  margin-top: 2px;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.slot-feiertag {
  background: #fce4ec;
  cursor: default;
}

.feiertag-text {
  color: #b02a37 !important;
  font-style: italic;
  font-weight: 500;
}

.month-feiertag {
  background: #fce4ec !important;
}

.month-ev-feiertag {
  background: #f8d7da;
  color: #842029;
  font-style: italic;
  font-weight: 500;
}

/* Loading overlay */
#loadingSpinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
