@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;900&display=swap');

:root {
  --navy-950: #0b1220;
  --navy-900: #111c33;
  --navy-800: #182548;
  --navy-700: #22315c;
  --gold-500: #c9a227;
  --gold-400: #dfb843;
  --gold-100: #f7ecc9;
  --surface: #ffffff;
  --surface-2: #f6f4ee;
  --text: #1c2333;
  --muted: #6b7280;
  --border: #e6e1d3;
  --success: #1f9d55;
  --success-bg: #e7f7ec;
  --warning: #b9790a;
  --warning-bg: #fdf1dc;
  --info: #2563eb;
  --info-bg: #e8effe;
  --danger: #d1373f;
  --danger-bg: #fbe9ea;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 2px rgba(11, 18, 32, 0.06), 0 1px 3px rgba(11, 18, 32, 0.08);
  --shadow-md: 0 8px 24px rgba(11, 18, 32, 0.10);
  --shadow-lg: 0 20px 45px rgba(11, 18, 32, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
  background: var(--surface-2);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

img { max-width: 100%; display: block; }
button { font-family: inherit; }
a { color: inherit; text-decoration: none; }

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

.container-narrow {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 18px;
}

/* ---------- عناصر عامة ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .15s ease;
}
.btn:active { transform: translateY(1px) scale(.99); }

.btn-primary {
  background: var(--navy-900);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--navy-800); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  color: var(--navy-950);
  box-shadow: var(--shadow-sm);
}
.btn-gold:hover { filter: brightness(1.05); }

.btn-outline {
  background: #fff;
  color: var(--navy-900);
  border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--navy-800); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
}
.btn-ghost:hover { color: var(--text); }

.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-new { background: var(--info-bg); color: var(--info); }
.badge-in_progress { background: var(--warning-bg); color: var(--warning); }
.badge-done { background: var(--success-bg); color: var(--success); }

.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--navy-950);
  color: #fff;
  padding: 14px 22px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-weight: 700;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   واجهة النزيل (Guest)
   ============================================================ */

.guest-header {
  background: radial-gradient(120% 160% at 20% 0%, var(--navy-800) 0%, var(--navy-950) 70%);
  color: #fff;
  padding: 28px 0 60px;
  position: relative;
  overflow: hidden;
}
.guest-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(135deg, rgba(201,162,39,.06) 0 2px, transparent 2px 40px);
  pointer-events: none;
}
.guest-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  z-index: 1;
}
.hotel-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: .3px;
}
.hotel-brand .mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  color: var(--navy-950);
}
.room-chip {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25);
  backdrop-filter: blur(6px);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
}
.lang-toggle {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12.5px;
  cursor: pointer;
  letter-spacing: .5px;
}
.lang-toggle:hover { background: rgba(255,255,255,.2); }

.rating-box {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.rating-box .stars { display: flex; gap: 4px; font-size: 20px; cursor: pointer; margin: 6px 0; }
.rating-box .stars span { opacity: .3; transition: opacity .1s ease; }
.rating-box .stars span.filled { opacity: 1; }
.rating-box textarea {
  width: 100%;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  padding: 8px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  min-height: 44px;
  margin-bottom: 8px;
}
.req-item .cancel-btn { margin-top: 8px; }

.urgent-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--danger);
  cursor: pointer;
  width: fit-content;
}
.urgent-check input { width: 16px; height: 16px; accent-color: var(--danger); cursor: pointer; }
.guest-header h1 {
  position: relative;
  z-index: 1;
  margin: 26px 0 6px;
  font-size: 26px;
  font-weight: 900;
}
.guest-header p {
  position: relative;
  z-index: 1;
  margin: 0;
  color: rgba(255,255,255,.72);
  font-size: 14.5px;
}

.guest-body {
  margin-top: -38px;
  position: relative;
  z-index: 2;
  padding-bottom: 60px;
}

.tabs {
  display: flex;
  gap: 8px;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 6px;
  box-shadow: var(--shadow-md);
  overflow-x: auto;
}
.tab-btn {
  flex: 1;
  white-space: nowrap;
  border: none;
  background: transparent;
  padding: 12px 10px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: background .15s ease, color .15s ease;
}
.tab-btn .icon { font-size: 20px; }
.tab-btn.active {
  background: var(--navy-950);
  color: #fff;
}

.panel { display: none; margin-top: 20px; }
.panel.active { display: block; animation: fadeUp .25s ease; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-title {
  font-size: 15px;
  font-weight: 900;
  margin: 22px 0 12px;
  color: var(--navy-900);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title:first-child { margin-top: 4px; }

/* menu items (room service) */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.menu-item {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.menu-item .emoji { font-size: 26px; }
.menu-item .name { font-weight: 700; font-size: 14px; }
.menu-item .price { color: var(--muted); font-size: 12.5px; }
.qty-row {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.qty-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 4px;
}
.qty-controls button {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: none;
  background: #fff;
  box-shadow: var(--shadow-sm);
  font-weight: 900;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}
.qty-controls .qty-val { min-width: 18px; text-align: center; font-weight: 700; font-size: 13px; }

/* quick action chips (housekeeping / general) */
.chip-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.chip-card {
  padding: 16px 14px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border: 1.5px solid var(--border);
  transition: border-color .15s ease, background .15s ease, transform .1s ease;
}
.chip-card .emoji { font-size: 26px; }
.chip-card .label { font-weight: 700; font-size: 13.5px; }
.chip-card.selected {
  border-color: var(--gold-500);
  background: var(--gold-100);
}
.chip-card:active { transform: scale(.97); }

.note-box textarea {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  padding: 12px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  min-height: 70px;
}

.cart-bar {
  position: sticky;
  bottom: 14px;
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}
.cart-bar .summary { font-size: 13.5px; color: var(--muted); }
.cart-bar .summary b { color: var(--text); }

/* my requests list */
.req-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  margin-bottom: 10px;
}
.req-item .emoji {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}
.req-item .body { flex: 1; min-width: 0; }
.req-item .title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.req-item .title { font-weight: 700; font-size: 14px; }
.req-item .meta { font-size: 12px; color: var(--muted); }
.req-item .details { font-size: 13px; color: var(--muted); margin-top: 2px; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}
.empty-state .emoji { font-size: 38px; margin-bottom: 10px; }

/* ============================================================
   لوحة تحكم الموظفين (Staff)
   ============================================================ */

.staff-shell { min-height: 100vh; }

.staff-topbar {
  background: var(--navy-950);
  color: #fff;
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow-md);
}
.staff-topbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.staff-topbar .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 900;
}
.staff-topbar .brand .mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  display: flex; align-items: center; justify-content: center;
  color: var(--navy-950);
}
.staff-topbar nav { display: flex; gap: 6px; align-items: center; }
.staff-topbar nav a {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: rgba(255,255,255,.75);
}
.staff-topbar nav a.active, .staff-topbar nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.staff-name-chip {
  font-size: 12.5px;
  font-weight: 700;
  color: rgba(255,255,255,.7);
  padding: 6px 10px;
  white-space: nowrap;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 24px 0;
}
.stat-card {
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.stat-card .icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-card .num { font-size: 24px; font-weight: 900; line-height: 1; }
.stat-card .label { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.select, .input {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}

.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: start;
}
.board-col {
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 12px;
  min-height: 200px;
}
.board-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 6px 12px;
  font-weight: 900;
  font-size: 14px;
}
.board-col-head .count {
  background: rgba(0,0,0,.06);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
}

.req-card {
  padding: 14px;
  margin-bottom: 12px;
  border-inline-start: 4px solid var(--border);
}
.req-card.cat-room_service { border-inline-start-color: #2563eb; }
.req-card.cat-housekeeping { border-inline-start-color: #b9790a; }
.req-card.cat-general { border-inline-start-color: #1f9d55; }
.req-card.urgent {
  border-inline-start-color: var(--danger);
  box-shadow: 0 0 0 1.5px var(--danger), var(--shadow-sm);
}
.badge-urgent { background: var(--danger-bg); color: var(--danger); }

.req-card .top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.req-card .room {
  font-weight: 900;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.req-card .time { font-size: 11.5px; color: var(--muted); }
.req-card .cat-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.req-card ul.items {
  margin: 6px 0;
  padding-inline-start: 18px;
  font-size: 13px;
}
.req-card .note {
  font-size: 13px;
  color: var(--muted);
  background: var(--surface-2);
  padding: 8px 10px;
  border-radius: 8px;
  margin-top: 6px;
}
.req-card .actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(120% 160% at 20% 0%, var(--navy-800) 0%, var(--navy-950) 70%);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-card .mark {
  width: 54px; height: 54px; margin: 0 auto 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  color: var(--navy-950);
}
.pin-input {
  width: 100%;
  text-align: center;
  letter-spacing: 10px;
  font-size: 22px;
  font-weight: 900;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  margin: 18px 0 10px;
}
.error-msg { color: var(--danger); font-size: 13px; font-weight: 700; min-height: 18px; margin-bottom: 6px; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 14px; }

/* ============================================================
   صفحة الإدارة (QR / روابط الغرف)
   ============================================================ */

.admin-header {
  background: var(--navy-950);
  color: #fff;
  padding: 26px 0;
}
.admin-header h1 { margin: 0 0 6px; font-size: 22px; }
.admin-header p { margin: 0; color: rgba(255,255,255,.7); font-size: 13.5px; }

.base-url-box {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 20px 0;
  flex-wrap: wrap;
}
.base-url-box .input { flex: 1; min-width: 240px; }

.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  margin: 20px 0 40px;
}
.room-card {
  padding: 18px;
  text-align: center;
}
.room-card .qr-box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: inline-flex;
  margin-bottom: 12px;
}
.room-card h3 { margin: 0 0 2px; font-size: 16px; }
.room-card .type { font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.room-card .link-row {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.room-card .link-row .input { flex: 1; font-size: 11.5px; padding: 7px 8px; }

.add-room-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 8px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 700; color: var(--muted); }

/* ============================================================
   صفحة الموظفين / إدارة القائمة
   ============================================================ */

.staff-avatar {
  width: 56px; height: 56px;
  margin: 0 auto 10px;
  border-radius: 16px;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
}

.staff-card .type, .menu-item-card .type {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.badge-admin { background: var(--gold-100); color: #7a5c0c; }
.badge-staff { background: var(--info-bg); color: var(--info); }
.badge-inactive { background: var(--danger-bg); color: var(--danger); }

.perf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.perf-table th {
  text-align: right;
  padding: 12px 16px;
  background: var(--surface-2);
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 700;
}
.perf-table td {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.activity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.activity-row:last-child { border-bottom: none; }
.activity-row .who { font-weight: 900; font-size: 13.5px; min-width: 100px; }
.activity-row .what { flex: 1; font-size: 13.5px; min-width: 180px; }
.activity-row .when { white-space: nowrap; }

/* ---------- Utility ---------- */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.mt-0 { margin-top: 0; }
.text-muted { color: var(--muted); }
.small { font-size: 12.5px; }

footer.site-footer {
  text-align: center;
  padding: 30px 20px 50px;
  color: var(--muted);
  font-size: 12.5px;
}

/* ---------- استجابة الشاشات ---------- */
@media (max-width: 860px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .board { grid-template-columns: 1fr; }
  .staff-topbar .container { flex-wrap: wrap; row-gap: 8px; }
  .staff-topbar nav {
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }
  .staff-topbar nav a { padding: 7px 10px; font-size: 12.5px; white-space: nowrap; }
  .staff-name-chip { padding: 6px 4px; }
}

@media (max-width: 520px) {
  .menu-grid, .chip-grid { grid-template-columns: repeat(2, 1fr); }
  .guest-header h1 { font-size: 22px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- طباعة روابط/QR الغرف ---------- */
@media print {
  body * { visibility: hidden; }
  #roomGrid, #roomGrid * { visibility: visible; }
  #roomGrid {
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 16px;
    grid-template-columns: repeat(3, 1fr);
  }
  .room-card { break-inside: avoid; page-break-inside: avoid; box-shadow: none; border: 1px solid #999; }
  .room-card .flex,
  .room-card .link-row {
    display: none !important;
  }
}
