/* ===== RESET / BASE ===== */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: #f4f4f4;
  color: #222;
}

button {
  cursor: pointer;
}

.hidden {
  display: none;
}

/* ===== HEADER ===== */
header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  background: #2c3e50;
  color: #fff;
  padding: 10px;
}

#months button {
  margin-right: 5px;
  padding: 5px 10px;
  background: #34495e;
  border: none;
  color: #fff;
}

#months button.active {
  background: #1abc9c;
}

header button {
  background: #1abc9c;
  border: none;
  padding: 6px 12px;
  color: #fff;
}

/* ===== SEARCH ===== */
#search {
  width: calc(100% - 20px);
  margin: 10px;
  padding: 8px;
  font-size: 14px;
}

/* ===== CALENDAR GRID ===== */
#calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 10px;
}

.weekday {
  text-align: center;
  font-weight: bold;
  padding: 5px 0;
  background: #ddd;
}

.day {
  background: #fff;
  border: 1px solid #ccc;
  min-height: 110px;
  position: relative;
  display: flex;
  flex-direction: column;
}

.day.today {
  border: 3px solid #000;
}

.day.closed {
  background: #eee;
}

/* ===== DAY HEADER ===== */
.dayHeader {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  padding: 2px 4px;
  background: #fafafa;
}

/* ===== SHIFTS ===== */
.shift {
  flex: 1;
  font-size: 12px;
  padding: 2px 4px;
  overflow: hidden;
  position: relative;
}

.shift.morning {
  border-bottom: 1px solid #ccc;
}

.shift.empty {
  background: #f44336;
  color: #fff;
}

.shift.half {
  background: #ff9800;
}

.shift.filled {
  background: #8bc34a;
}

.shift.closed {
  background: #bbb;
}

.shift span.name {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* clickable shift */
.shift.clickable {
  cursor: pointer;
}

/* ===== SEARCH HIGHLIGHT ===== */
.shift.highlight {
  outline: 3px solid #000;
}

/* ===== POPUPS ===== */
.popup {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
}

.popupBox {
  background: #fff;
  width: 90%;
  max-width: 320px;
  margin: 10% auto;
  padding: 15px;
  position: relative;
}

.popupBox h3 {
  margin-top: 0;
}

.popupBox input {
  width: 100%;
  padding: 8px;
  margin-bottom: 10px;
}

.popupBox button {
  width: 100%;
  padding: 8px;
  background: #1abc9c;
  border: none;
  color: #fff;
}

.popupBox .error {
  color: #c00;
  margin-top: 5px;
  font-size: 13px;
}

/* close button */
.popupBox .close {
  position: absolute;
  top: 5px;
  right: 8px;
  font-size: 18px;
  cursor: pointer;
}

/* ===== SHAKE ===== */
input.shake {
  animation: shake 0.3s;
}

@keyframes shake {
  0%   { transform: translateX(0); }
  25%  { transform: translateX(-5px); }
  50%  { transform: translateX(5px); }
  75%  { transform: translateX(-5px); }
  100% { transform: translateX(0); }
}

/* ===== MOBILE ===== */
@media (max-width: 700px) {
  #calendar {
    grid-template-columns: repeat(1, 1fr);
  }
}

