body {
      font-family: 'Segoe UI', sans-serif;
      background: #f4f4f4;
      margin: 0;
      padding: 20px;
    }

    h2 {
      text-align: center;
    }

/* =======================
   NAVIGATION
   ======================= */
.calendar-navigation{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:18px;
  margin:20px 0 10px;
}
.calendar-title{
  margin:0;
  font-size:1.6rem;
  font-weight:800;
}
.calendar-nav-btn{
  background:#7d4cc9;
  color:#fff;
  border:none;
  padding:10px 14px;
  border-radius:10px;
  font-weight:600;
  cursor:pointer;
}
.calendar-nav-btn:hover{ filter:brightness(.95); }

/* =======================
   CONTAINER & GRID
   ======================= */
.calendar-container{
  overflow:auto;                 /* scroll 2 arah (wajib untuk sticky) */
  position:relative;
  background:#fff;
  border-radius:8px;
  box-shadow:0 2px 6px rgba(0,0,0,.1);
  margin:0 auto;
  padding-bottom:60px;           /* ruang bar tombol bawah */
}
.calendar-week{ margin-bottom:12px; }

.calendar-grid{
  display:grid;
  position:relative;
  min-width:100%;
  /* 1 kolom ROOM + 7 hari */
  grid-template-columns:180px repeat(7, minmax(160px, 1fr));
  border-top:1px solid transparent;
  background:#fff;
}

/* =======================
   HEADER (STICKY TOP)
   ======================= */
.calendar-header-cell,
.calendar-cell{
  border:1px solid #ddd;
  min-height:60px;
  position:relative;
  box-sizing:border-box;
}
.calendar-header-cell{
  font-weight:700;
  text-align:center;
  font-size:.95rem;
  color:#555;
  background:#fafafa;
  position:sticky;               /* nempel di atas saat scroll vertikal */
  top:0;
  z-index:35;
  min-height:60px;
  display:flex;
  flex-direction:column;
  justify-content:center;
}
.calendar-header-cell:first-child{
  left:0;
  z-index:45;
}

/* =======================
   KOLOM ROOM (STICKY LEFT)
   ======================= */
/* 8 kolom per baris → item ke (8n+1) selalu kolom 1 */
.calendar-grid > :nth-child(8n+1){
  position:sticky;
  left:0;
  z-index:25;                    /* di atas event, di bawah header */
  background:#f0f0f0;
  border-right:1px solid #ddd;
  box-shadow:2px 0 0 rgba(0,0,0,.04);
}
.room-name{
  display:flex; align-items:center; justify-content:center;
  font-weight:700; color:#333; background:#f0f0f0; font-size:.92rem;
}
.calendar-grid > .calendar-header-cell:nth-child(8n+1){
  z-index:45; background:#fafafa;
}

/* =======================
   CELLS & WEEKEND
   ======================= */
.calendar-cell{
  background:#fff;
  overflow:hidden;               /* cegah event keluar sel */
  display:grid;                  /* stack event */
  grid-auto-rows:min-content;
  align-content:start;
  gap:6px;
  padding:6px;
  font-size:.9rem;
}
.sunday,.saturday{ background:#ff5353; }

/* =======================
   EVENT CARD
   ======================= */
.event{
  position:relative;             /* JANGAN absolute */
  z-index:1;                     /* < header & ROOM */
  display:block;
  width:100%;
  padding:8px 10px;
  border-radius:8px;
  border-left:4px solid #00acc1;
  background:#e0f7fa;
  box-shadow:0 1px 0 rgba(0,0,0,.06);
  line-height:1.25;
  white-space:normal;
  word-break:break-word;
  color:#0f3a46;
  font-size:.86rem;
}
.event.green { background:#e8f5e9; border-left-color:#43a047; color:#194d2b; }
.event.purple{ background:#ede7f6; border-left-color:#673ab7; color:#2c205b; }
.event.red   { background:#fdecea; border-left-color:#e53935; color:#5d1b1b; }

/* === Drag & Drop states === */
.event[draggable="true"]{ cursor:grab; }
.event[draggable="true"]:active{ cursor:grabbing; }
.calendar-cell.drop-target{
  outline:2px dashed #7d4cc9;
  outline-offset:-4px;
}

/* =======================
   ADD ROOM BAR (dipakai JS)
   ======================= */
.add-room-button-wrapper{
  position:sticky; bottom:0; z-index:50;
  background:#fff; border-top:1px solid #eee; padding:10px 12px;
}
.add-room-button{
  display:inline-block; width:100%;
  padding:12px 18px; background:#7d4cc9; color:#fff;
  border:none; border-radius:10px; font-weight:600; cursor:pointer;
}
.add-room-button:hover{ filter:brightness(.95); }

/* =======================
   MODAL
   ======================= */
.modal{ display:none; }
.modal .modal-content{ max-height:80vh; overflow:auto; }

/* =======================
   RESPONSIVE
   ======================= */
@media (max-width: 768px){
  .calendar-grid{ grid-template-columns:150px repeat(7, minmax(135px, 1fr)); min-width:2000px; }
  .calendar-header-cell, .calendar-cell, .room-name { font-size:.82rem; }
  .calendar-title{ font-size:1.4rem; }
}
@media (max-width: 480px){
  .calendar-grid{ grid-template-columns:120px repeat(7, minmax(120px, 1fr)); min-width:1000px; }
  .calendar-title{ font-size:1.2rem; }
}


    .add-room-button-wrapper {
      display: flex;
      justify-content: center;
      margin-top: 12px;
      margin-bottom: 36px;
    }

    .add-room-button {
      background-color: #8e44ad;
      color: white;
      width: 95%;
      font-weight: 600;
      padding: 10px 20px;
      border: none;
      border-radius: 8px;
      font-size: 15px;
      cursor: pointer;
      box-shadow: 0 2px 6px rgba(0,0,0,0.15);
      transition: background-color 0.3s ease, transform 0.2s ease;
    }

    .add-room-button:hover {
      background-color: #732d91;
      transform: translateY(-1px);
    }

    .add-room-button:active {
      transform: scale(0.98);
    }


    .modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: white;
  padding: 20px;
  width: 300px;
  border-radius: 10px;
  text-align: center;
}

.modal-content input {
  width: 100%;
  padding: 8px;
  font-size: 16px;
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 25px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}


.modal {
  display: none;
  position: fixed;
  z-index: 999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.5);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: #fefefe;
  padding: 20px;
  border-radius: 10px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0px 0px 15px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
}

.close-btn {
  align-self: flex-end;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
}

.event {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 4px 6px;
  /* margin: 2px 0; */
  border-radius: 4px;
  color: white;
  font-size: 12px;
  cursor: pointer;
  overflow-wrap: break-word;
  white-space: normal;
  color: #333;

}

/* Tombol Umum */
.modal-content button {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s, box-shadow 0.2s;
}

/* Tombol Simpan */
#saveRoomBtn,
#saveEventBtn {
  background-color: #6a1b9a;
  color: white;
}

#saveRoomBtn:hover,
#saveEventBtn:hover {
  background-color: #8e24aa;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Tombol Hapus */
#deleteRoomBtn,
#deleteEventBtn {
  background-color: #d32f2f;
  color: white;
  margin-left: 20px;
}

#deleteRoomBtn:hover,
#deleteEventBtn:hover {
  background-color: #b71c1c;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Tombol Tutup */
#closeModalBtn,
#cancelEventBtn {
  background-color: #e0e0e0;
  color: #333;
}

#closeModalBtn:hover,
#cancelEventBtn:hover {
  background-color: #d5d5d5;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}



/* Tanggal merah (libur nasional) */
.holiday { background:#ff5353 !important; }


.calendar-cell.selected { outline: 3px solid #7d4cc9; outline-offset: -3px; }
.bulk-toolbar { position: sticky; bottom: 0; background:#fff; border-top:1px solid #eee; padding:10px; display:flex; gap:8px; align-items:center; z-index:60; }
.bulk-toolbar input[type="text"]{ padding:6px 8px; border:1px solid #ddd; border-radius:8px; }


.calendar-cell.drop-target { outline: 2px dashed #7d4cc9; outline-offset: -4px; }

/* --- Search Bar --- */
.cal-search{
  display:flex;
  gap:10px;
  align-items:center;
  width:98%;
  margin:12px 0 8px;
  padding:8px 12px;
  background:#fff;
  border:1px solid #e7e7e7;
  border-radius:12px;
  box-shadow: 0 2px 6px rgba(0,0,0,.04);
}
.cal-search__input{
  flex:1;
  height:40px;
  padding:0 12px;
  border:1px solid #ddd;
  border-radius:10px;
  outline:none;
}
.cal-search__input:focus{
  border-color:#7d4cc9;
  box-shadow: 0 0 0 3px rgba(125,76,201,.15);
}
.cal-search__btn{
  height:40px;
  min-width:40px;
  padding:0 12px;
  border:1px solid #ddd;
  background:#fafafa;
  border-radius:10px;
  cursor:pointer;
}
.cal-search__btn:hover{ background:#f2f2f2; }
.cal-search__count{
  margin-left:auto;
  font-size:14px;
  color:#555;
  padding:4px 10px;
  background:#f6f3ff;
  border:1px solid #e6dcff;
  border-radius:999px;
}

/* --- Highlight hasil --- */
.calendar-cell.search-hit{
  outline: 3px solid #7d4cc9;
  outline-offset: -3px;
}
.calendar-cell .event.search-hit-event{
  box-shadow: 0 0 0 3px rgba(125,76,201,.35) inset;
}
.calendar-cell.search-current{
  box-shadow: 0 0 0 3px #ff9800 inset;
}

/* --- Responsive --- */
@media (max-width: 900px){
  .cal-search{ flex-wrap:wrap; }
  .cal-search__count{ width:100%; text-align:right; }
}
