/* ============================================================
   RuangKu — app.css
   ============================================================ */

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

:root {
  --blue:       #378ADD;
  --blue-dark:  #185FA5;
  --blue-light: #E6F1FB;
  --green:      #639922;
  --green-light:#EAF3DE;
  --amber:      #EF9F27;
  --amber-light:#FAEEDA;
  --red:        #E24B4A;
  --red-light:  #FCEBEB;
  --gray:       #888780;
  --gray-light: #F1EFE8;

  --bg:         #f5f5f3;
  --surface:    #ffffff;
  --surface-2:  #f8f8f6;
  --border:     rgba(0,0,0,.1);
  --border-md:  rgba(0,0,0,.18);
  --text:       #1a1a18;
  --text-2:     #5a5a58;
  --text-3:     #999895;

  --radius:     8px;
  --radius-lg:  12px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
}

html, body { height: 100%; font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 13px; }

/* ---------- Layout ---------- */
.app-layout {
  display: grid;
  grid-template-columns: 210px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--surface);
  border-right: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
}
.logo-icon {
  width: 32px; height: 32px;
  background: var(--blue-light);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--blue-dark); font-size: 17px;
}
.logo-text { font-size: 14px; font-weight: 600; color: var(--text); }
.logo-sub  { font-size: 10px; color: var(--text-3); margin-top: 1px; }

.sidebar-nav { padding: 10px 0; flex: 1; }
.nav-group {
  font-size: 10px; font-weight: 600; color: var(--text-3);
  padding: 12px 18px 4px; letter-spacing: .07em; text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 18px; font-size: 13px; color: var(--text-2);
  border-left: 2px solid transparent;
  transition: background .1s, color .1s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--blue-light); color: var(--blue-dark); border-left-color: var(--blue); font-weight: 500; }
.nav-item i { font-size: 15px; }
.nav-badge {
  margin-left: auto; background: var(--blue); color: #fff;
  font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 10px;
}

.sidebar-user {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 18px; border-top: 0.5px solid var(--border);
  flex-shrink: 0;
}
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--blue-light); color: var(--blue-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; flex-shrink: 0;
}
.user-name { font-size: 12px; font-weight: 500; color: var(--text); }
.user-role { font-size: 10px; color: var(--text-3); }
.logout-btn {
  margin-left: auto; color: var(--text-3); font-size: 16px;
  padding: 4px; border-radius: var(--radius);
  display: flex; align-items: center;
}
.logout-btn:hover { color: var(--red); background: var(--red-light); }

/* ---------- Main wrap & topbar ---------- */
.main-wrap {
  display: flex; flex-direction: column; overflow: hidden;
}
.topbar {
  background: var(--surface); border-bottom: 0.5px solid var(--border);
  padding: 12px 20px; display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; gap: 12px;
}
.topbar-title { font-size: 16px; font-weight: 600; color: var(--text); }
.topbar-sub   { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.page-content { flex: 1; overflow-y: auto; padding: 20px; }

/* ---------- Flash messages ---------- */
.flash {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; margin: 0 20px 0;
  border-radius: var(--radius); font-size: 13px;
  border-left: 3px solid;
}
.flash-sukses { background: var(--green-light); border-color: var(--green); color: #27500A; }
.flash-error  { background: var(--red-light);   border-color: var(--red);   color: #791F1F; }
.flash-info   { background: var(--blue-light);  border-color: var(--blue);  color: var(--blue-dark); }
.flash-close  { margin-left: auto; background: none; border: none; font-size: 16px; cursor: pointer; opacity: .6; }
.flash-close:hover { opacity: 1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px; border-radius: var(--radius); font-size: 13px; font-weight: 500;
  border: 0.5px solid var(--border-md); background: transparent;
  color: var(--text-2); transition: background .12s, color .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-danger  { background: var(--red);  color: #fff; border-color: var(--red); }
.btn-danger:hover  { background: #c43d3c; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 5px 8px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 0.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.card-title { font-size: 14px; font-weight: 600; color: var(--text); }

/* ---------- Stat cards ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface-2); border-radius: var(--radius); padding: 13px 15px;
}
.stat-label { font-size: 11px; color: var(--text-2); display: flex; align-items: center; gap: 5px; margin-bottom: 5px; }
.stat-value { font-size: 24px; font-weight: 600; color: var(--text); }
.stat-sub   { font-size: 10px; color: var(--text-3); margin-top: 3px; }

/* ---------- Grid layouts ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.rooms-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 20px; }

/* ---------- Room card ---------- */
.room-card {
  background: var(--surface); border: 0.5px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; transition: border-color .12s;
}
.room-card:hover { border-color: var(--border-md); }
.room-thumb {
  height: 82px; display: flex; align-items: center; justify-content: center; font-size: 32px;
}
.room-thumb.c-b  { background: #E6F1FB; color: #185FA5; }
.room-thumb.c-g  { background: #E1F5EE; color: #0F6E56; }
.room-thumb.c-a  { background: #FAEEDA; color: #854F0B; }
.room-thumb.c-p  { background: #FBEAF0; color: #993556; }
.room-thumb.c-gr { background: #EAF3DE; color: #27500A; }
.room-thumb.c-pu { background: #EEEDFE; color: #3C3489; }
.room-body  { padding: 10px 12px; }
.room-name  { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 3px; }
.room-meta  { font-size: 11px; color: var(--text-2); display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.room-foot  { display: flex; align-items: center; justify-content: space-between; }

/* ---------- Badges ---------- */
.badge { font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 500; white-space: nowrap; }
.b-ok   { background: #EAF3DE; color: #3B6D11; }
.b-busy { background: #FCEBEB; color: #A32D2D; }
.b-warn { background: #FAEEDA; color: #854F0B; }
.b-info { background: #E6F1FB; color: #185FA5; }
.b-gray { background: #F1EFE8; color: #5F5E5A; }
.role-badge     { font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 500; }
.role-admin     { background: #EEEDFE; color: #3C3489; }
.role-staff     { background: #E1F5EE; color: #085041; }
.role-pengguna  { background: #F1EFE8; color: #444441; }

/* ---------- Schedule list ---------- */
.sched-list .sched-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 0.5px solid var(--border);
}
.sched-list .sched-item:last-child { border-bottom: none; padding-bottom: 0; }
.sched-bar { width: 3px; height: 34px; border-radius: 2px; flex-shrink: 0; }
.sched-info { flex: 1; min-width: 0; }
.sched-title { font-size: 12px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sched-meta  { font-size: 11px; color: var(--text-2); margin-top: 2px; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; font-size: 11px; font-weight: 600; color: var(--text-2);
  padding: 8px 12px; border-bottom: 0.5px solid var(--border);
  background: var(--surface-2); white-space: nowrap;
}
.data-table td { padding: 10px 12px; border-bottom: 0.5px solid var(--border); color: var(--text); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface-2); }

/* ---------- Form elements ---------- */
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 4px; font-weight: 500; }
.form-control {
  width: 100%; padding: 8px 10px; border: 0.5px solid var(--border-md);
  border-radius: var(--radius); background: var(--surface); color: var(--text);
  font-size: 13px; transition: border-color .12s;
}
.form-control:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(55,138,221,.12); }
textarea.form-control { resize: vertical; min-height: 70px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* ---------- Filter bar ---------- */
.filter-bar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px;
}
.filter-bar .form-control { max-width: 200px; }
.filter-bar input[type="search"] { flex: 1; min-width: 150px; max-width: 280px; }

/* ---------- Pagination ---------- */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; margin-top: 4px; border-top: 0.5px solid var(--border);
}
.pag-info  { font-size: 12px; color: var(--text-2); }
.pag-pages { display: flex; gap: 4px; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.38);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
  opacity: 0; visibility: hidden; transition: opacity .15s, visibility .15s;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal-box {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 0.5px solid var(--border-md); width: 360px; max-width: 100%;
  padding: 20px; transform: scale(.96); transition: transform .15s;
  max-height: 90vh; overflow-y: auto;
}
.modal-overlay.open .modal-box { transform: scale(1); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.modal-title { font-size: 15px; font-weight: 600; color: var(--text); }
.modal-close { background: none; border: none; font-size: 18px; color: var(--text-3); cursor: pointer; padding: 2px; }
.modal-close:hover { color: var(--text); }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ---------- Calendar ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; }
.cal-head { text-align: center; font-size: 11px; font-weight: 600; color: var(--text-2); padding: 6px 0; }
.cal-day  {
  text-align: center; padding: 6px 3px; font-size: 12px;
  border-radius: var(--radius); cursor: pointer; color: var(--text-2); position: relative;
}
.cal-day:hover { background: var(--surface-2); }
.cal-day.today { background: var(--blue); color: #fff; font-weight: 600; }
.cal-day.other { color: var(--text-3); }
.cal-day.has-event::after {
  content: ''; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: var(--amber);
}
.cal-day.today.has-event::after { background: #fff; }
.cal-event {
  border-left: 3px solid var(--blue); background: var(--blue-light);
  padding: 5px 8px; border-radius: 0 var(--radius) var(--radius) 0; margin-bottom: 6px;
}
.cal-event.g  { border-left-color: #639922; background: #EAF3DE; }
.cal-event.a  { border-left-color: #EF9F27; background: #FAEEDA; }
.cal-event.co { border-left-color: #D85A30; background: #FAECE7; }
.cal-event.pu { border-left-color: #534AB7; background: #EEEDFE; }
.cal-event-title { font-size: 12px; font-weight: 500; }
.cal-event-meta  { font-size: 11px; margin-top: 1px; }

/* ---------- Progress bar ---------- */
.progress-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.progress-label { font-size: 12px; color: var(--text-2); min-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-track { flex: 1; height: 7px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.progress-fill  { height: 100%; border-radius: 4px; }
.progress-pct   { font-size: 11px; color: var(--text-2); min-width: 34px; text-align: right; }

/* ---------- Toggle switch ---------- */
.toggle-wrap { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 0.5px solid var(--border); }
.toggle-wrap:last-child { border-bottom: none; }
.toggle-info .toggle-title { font-size: 13px; font-weight: 500; color: var(--text); }
.toggle-info .toggle-desc  { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.toggle {
  position: relative; width: 36px; height: 20px; flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--border-md); border-radius: 10px; cursor: pointer; transition: background .15s;
}
.toggle-slider::before {
  content: ''; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; left: 3px; top: 3px; transition: transform .15s;
}
.toggle input:checked + .toggle-slider { background: var(--blue); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ---------- Time slots ---------- */
.time-slots { display: grid; grid-template-columns: repeat(6,1fr); gap: 5px; margin-top: 8px; }
.time-slot {
  text-align: center; padding: 6px 3px; font-size: 11px;
  border-radius: var(--radius); border: 0.5px solid var(--border);
  cursor: pointer; color: var(--text-2);
}
.time-slot.free   { border-color: #C0DD97; background: #EAF3DE; color: #3B6D11; }
.time-slot.busy   { border-color: #F7C1C1; background: #FCEBEB; color: #A32D2D; cursor: not-allowed; }
.time-slot.picked { border: 2px solid var(--blue); background: var(--blue-light); color: var(--blue-dark); }

/* ---------- Notification items ---------- */
.notif-item { display: flex; gap: 10px; padding: 12px 0; border-bottom: 0.5px solid var(--border); }
.notif-item:last-child { border-bottom: none; }
.notif-dot  { width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; }
.notif-title{ font-size: 13px; font-weight: 500; color: var(--text); }
.notif-text { font-size: 12px; color: var(--text-2); margin-top: 2px; line-height: 1.5; }
.notif-time { font-size: 10px; color: var(--text-3); margin-top: 4px; }
.notif-unread .notif-title { color: var(--blue-dark); }

/* ---------- Login page ---------- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 20px;
}
.login-card {
  background: var(--surface); border: 0.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px; width: 360px; max-width: 100%;
}
.login-logo {
  display: flex; align-items: center; gap: 10px; margin-bottom: 24px;
}
.login-logo .logo-icon { width: 38px; height: 38px; font-size: 20px; }
.login-logo .logo-text { font-size: 18px; font-weight: 700; }
.login-logo .logo-sub  { font-size: 12px; }

/* ---------- Detail page ---------- */
.detail-hero {
  display: flex; gap: 16px; margin-bottom: 20px;
}
.detail-thumb {
  width: 110px; height: 90px; border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center; font-size: 40px; flex-shrink: 0;
}
.detail-info h2 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.detail-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.facility-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.ftag { font-size: 11px; padding: 3px 9px; border: 0.5px solid var(--border-md); border-radius: 10px; color: var(--text-2); }

/* ---------- Utilities ---------- */
.mb-0  { margin-bottom: 0 !important; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.text-muted { color: var(--text-2); }
.text-sm    { font-size: 12px; }
.fw-500     { font-weight: 500; }
.d-flex     { display: flex; }
.align-center { align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.ms-auto { margin-left: auto; }
.w-100  { width: 100%; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .rooms-grid { grid-template-columns: repeat(2,1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
