/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Roboto', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #f4f5f7;
  color: #2d3436;
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 494px;
  margin: 0 auto;
}

/* ── Header ── */
header {
  text-align: center;
  margin-bottom: 36px;
}

header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 8px;
}

.selected-label {
  text-align: center;
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 18px;
}

.legend {
  display: flex;
  justify-content: center;
  gap: 28px;
  font-size: 0.9rem;
  color: #555;
  flex-wrap: wrap;
}

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

.legend-color {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 4px;
}

.holiday-legend {
  background: #e74c3c;
}

.leave-legend {
  background: #f5d657;
}

.selected-legend {
  background: transparent;
  border: 3px dashed #6c5ce7;
  border-radius: 2px;
}

.school-legend {
  background: #74b9ff;
}

/* ── Month Card ── */
.month-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
  padding: 24px 20px 20px;
  margin-bottom: 28px;
  transition: box-shadow 0.2s;
}

.month-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.month-header {
  font-size: 1.4rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 16px;
  color: #1a1a2e;
  letter-spacing: 0.5px;
}

/* ── Calendar Grid ── */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  max-width: 600px;
  margin: 0 auto;
}

.day-header {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: #888;
  padding: 6px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.day-cell {
  position: relative;
  text-align: center;
  padding: 10px 4px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  color: #333;
  background: #fafafa;
  transition: background 0.15s, transform 0.12s;
  cursor: default;
}

.day-cell.empty {
  background: transparent;
  cursor: default;
}

.day-cell.holiday {
  background: #e74c3c;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.day-cell.holiday:hover {
  background: #c0392b;
  transform: scale(1.08);
  z-index: 2;
}

.day-cell.paid-leave {
  background: #f5d657;
  color: #333;
  font-weight: 600;
  cursor: pointer;
}

.day-cell.paid-leave:hover {
  background: #e1bc5c;
  color: #fff;
  transform: scale(1.08);
  z-index: 2;
}

.day-cell.user-selected {
  box-shadow: inset 0 0 0 3px #6c5ce7;
}

.day-cell.empty.user-selected {
  box-shadow: none;
}

.day-cell.school-off {
  background: #74b9ff;
  color: #1a1a2e;
  font-weight: 500;
  cursor: pointer;
}

.day-cell.school-off:hover {
  background: #5a9fd4;
  transform: scale(1.08);
  z-index: 2;
}

/* ── Split-color intersections ── */
.day-cell.holiday.school-off {
  background: linear-gradient(to right, #e74c3c 50%, #74b9ff 50%);
  color: #fff;
}

.day-cell.holiday.school-off:hover {
  background: linear-gradient(to right, #c0392b 50%, #5a9fd4 50%);
  transform: scale(1.08);
  z-index: 2;
}

.day-cell.paid-leave.school-off {
  background: linear-gradient(to right, #f5d657 50%, #74b9ff 50%);
  color: #333;
}

.day-cell.paid-leave.school-off:hover {
  background: linear-gradient(to right, #e1bc5c 50%, #5a9fd4 50%);
  transform: scale(1.08);
  z-index: 2;
}

.day-cell.holiday.paid-leave {
  background: linear-gradient(to right, #e74c3c 50%, #f5d657 50%);
  color: #fff;
}

.day-cell.holiday.paid-leave:hover {
  background: linear-gradient(to right, #c0392b 50%, #e1bc5c 50%);
  transform: scale(1.08);
  z-index: 2;
}

.day-cell.today {
  outline: 2px solid #0984e3;
  outline-offset: -2px;
}

.day-cell.weekend {
  color: #b2bec3;
}

.day-cell.weekend.holiday {
  color: #fff;
}

.day-cell.weekend.paid-leave {
  color: #333;
}

.day-cell.weekend.user-selected {
  box-shadow: inset 0 0 0 3px #6c5ce7;
}

.day-cell.weekend.school-off {
  color: #1a1a2e;
}

/* ── Month Selected List ── */
.month-selected {
  margin-top: 14px;
  padding: 10px 14px;
  background: #f8f9fa;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #636e72;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.month-selected.hidden {
  display: none;
}

.sel-clear {
  font-size: 0.78rem;
  color: #b2bec3;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: color 0.15s;
}

.sel-clear:hover {
  color: #e74c3c;
}

/* ── Tooltip ── */
.tooltip {
  position: fixed;
  background: #1a1a2e;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  max-width: 280px;
  line-height: 1.4;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  transition: opacity 0.15s;
}

.tooltip.hidden {
  opacity: 0;
  visibility: hidden;
}

.tooltip .tooltip-date {
  font-weight: 300;
  font-size: 0.8rem;
  color: #b2bec3;
  margin-top: 4px;
}

/* ── Mobile Drawer ── */
.drawer {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
}

.drawer.open {
  display: block;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  animation: drawer-fade-in 0.25s ease;
}

.drawer-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 12px 20px 28px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 60vh;
  overflow-y: auto;
}

.drawer.open .drawer-content {
  transform: translateY(0);
}

.drawer-handle {
  width: 36px;
  height: 4px;
  background: #ddd;
  border-radius: 2px;
  margin: 0 auto 14px;
}

.drawer-date {
  font-size: 1.05rem;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 10px;
}

.drawer-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 6px;
}

.drawer-tag::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.holiday-tag {
  background: #fdeaea;
  color: #c0392b;
}

.holiday-tag::before {
  background: #e74c3c;
}

.school-tag {
  background: #e8f4fd;
  color: #2980b9;
}

.school-tag::before {
  background: #74b9ff;
}

.leave-tag {
  background: #fef9e7;
  color: #b7950b;
}

.leave-tag::before {
  background: #f5d657;
}

.normal-tag {
  background: #f8f9fa;
  color: #636e72;
}

.normal-tag::before {
  background: #b2bec3;
}

@keyframes drawer-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Holiday List ── */
.holiday-list {
  margin-top: 40px;
  margin-bottom: 40px;
}

.hl-heading {
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  color: #1a1a2e;
  margin-bottom: 20px;
}

.hl-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 560px;
  margin: 0 auto;
}

.hl-item {
  display: flex;
  align-items: baseline;
  padding: 10px 18px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
  font-size: 0.9rem;
}

.hl-date {
  color: #e74c3c;
  font-weight: 600;
  white-space: nowrap;
  min-width: 130px;
}

.hl-sep {
  color: #ccc;
  margin: 0 4px;
}

.hl-name {
  color: #2d3436;
  font-weight: 500;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  body { padding: 12px; }
  header h1 { font-size: 1.3rem; }
  .month-card { padding: 16px 10px; }
  .calendar-grid { max-width: 100%; gap: 2px; }
  .day-cell { padding: 8px 2px; font-size: 0.85rem; }
  .day-header { font-size: 0.7rem; }
  .legend { gap: 14px; font-size: 0.8rem; }
}
