@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&family=DM+Mono:wght@400;500&display=swap');

:root {
  --ink:       #1a1f2e;
  --ink-soft:  #4a5168;
  --ink-muted: #8891a8;
  --surface:   #f5f6f8;
  --white:     #ffffff;
  --border:    #e2e5ec;
  --accent:    #2563eb;
  --accent-hover: #1d4ed8;
  --red:       #ef4444;
  --green:     #10b981;
  --shadow-sm: 0 1px 3px rgba(26,31,46,0.08);
  --shadow:    0 4px 16px rgba(26,31,46,0.10);
  --shadow-lg: 0 8px 32px rgba(26,31,46,0.13);
  --radius:    10px;
  --radius-sm: 6px;
  --transition: 0.18s ease;
  --nav-h: 56px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--surface);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
}
body.has-bottom-nav {
  padding-bottom: calc(60px + env(safe-area-inset-bottom));
}

/* ── TOP NAV ─────────────────────────────────────────── */
.nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.nav-brand {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.nav-brand-mark {
  display: inline-flex;
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: 7px;
  align-items: center; justify-content: center;
}
.nav-brand-mark svg { width: 14px; height: 14px; }
.nav-links {
  display: none;
  align-items: center;
  gap: 0.15rem;
}
.nav-link {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  white-space: nowrap;
}
.nav-link:hover, .nav-link.active { color: var(--ink); background: var(--surface); }
.nav-actions { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
.nav-user { font-size: 0.75rem; color: var(--ink-muted); font-family: 'DM Mono', monospace; }

/* ── LANG SWITCHER ───────────────────────────────────── */
.lang-switcher {
  display: flex;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.lang-btn {
  padding: 0.18rem 0.45rem;
  font-size: 0.68rem;
  font-weight: 600;
  font-family: 'DM Mono', monospace;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.04em;
}
.lang-btn.active { background: var(--white); color: var(--accent); box-shadow: var(--shadow-sm); }
.lang-btn:hover:not(.active) { color: var(--ink); }

/* ── BOTTOM NAV (mobile only) ────────────────────────── */
.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 60px;
  background: var(--white);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 12px rgba(26,31,46,0.06);
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--ink-muted);
  font-size: 0.62rem;
  font-weight: 500;
  border: none;
  background: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-item svg { width: 22px; height: 22px; stroke-width: 1.7; }
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item span { font-size: 0.6rem; }

/* ── PAGE LAYOUT ─────────────────────────────────────── */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.1rem 0.9rem;
}
.page-header {
  margin-bottom: 1.1rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.page-title { font-size: 1.2rem; font-weight: 600; letter-spacing: -0.02em; }
.page-subtitle { font-size: 0.78rem; color: var(--ink-muted); margin-top: 0.15rem; }

/* ── CARDS ───────────────────────────────────────────── */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-body { padding: 1rem; }
.card-header { padding: 0.9rem 1rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 0.875rem; font-weight: 600; }

/* ── BUTTONS ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 1rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem; font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  min-height: 40px;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface); color: var(--ink); }
.btn-danger { background: #fef2f2; color: var(--red); border-color: #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-success { background: #f0fdf4; color: var(--green); border-color: #bbf7d0; }
.btn-success:hover { background: #dcfce7; }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.78rem; min-height: 34px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-full { width: 100%; justify-content: center; }

/* ── FORMS ───────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.8rem; font-weight: 500; color: var(--ink-soft); margin-bottom: 0.35rem; }
.form-input, .form-select {
  width: 100%;
  padding: 0.65rem 0.9rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 16px; /* Prevents iOS zoom */
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none; -webkit-appearance: none;
}
.form-input:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238891a8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.2rem;
}
.form-hint { font-size: 0.75rem; color: var(--ink-muted); margin-top: 0.3rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

/* ── ALERTS ──────────────────────────────────────────── */
.alert { padding: 0.85rem 1rem; border-radius: var(--radius-sm); font-size: 0.875rem; border: 1px solid; margin-bottom: 1rem; }
.alert-error   { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.alert-info    { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }

/* ── BADGES ──────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 0.2rem 0.5rem; font-size: 0.68rem; font-weight: 500; border-radius: 99px; font-family: 'DM Mono', monospace; }
.badge-blue  { background: #eff6ff; color: #1d4ed8; }
.badge-green { background: #f0fdf4; color: #166534; }
.badge-red   { background: #fef2f2; color: #b91c1c; }
.badge-amber { background: #fffbeb; color: #92400e; }
.badge-gray  { background: var(--surface); color: var(--ink-muted); }

/* ── TABLE ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th { font-size: 0.7rem; font-weight: 500; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 0.65rem 0.85rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 0.8rem 0.85rem; font-size: 0.875rem; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface); }
.mono { font-family: 'DM Mono', monospace; font-size: 0.78rem; }

/* ── RESERVATION CARD (mobile list) ─────────────────── */
.res-card { padding: 1rem; border-bottom: 1px solid var(--border); }
.res-card:last-child { border-bottom: none; }
.res-card-room { font-size: 0.68rem; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.2rem; font-family: 'DM Mono', monospace; }
.res-card-time { font-weight: 500; font-size: 0.95rem; }
.res-card-date { font-size: 0.78rem; color: var(--ink-muted); margin-top: 0.1rem; }
.res-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 0.6rem; }

/* ── TABS ────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 1.1rem; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 0.6rem 0.85rem; font-size: 0.82rem; font-weight: 400; color: var(--ink-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all var(--transition); background: none; border-top: none; border-left: none; border-right: none; font-family: 'DM Sans', sans-serif; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }

/* ── ROOM PILLS ──────────────────────────────────────── */
.room-pills { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.room-pill { padding: 0.4rem 0.85rem; border-radius: 99px; font-size: 0.8rem; font-weight: 500; border: 1.5px solid var(--border); background: var(--white); color: var(--ink-soft); cursor: pointer; transition: all var(--transition); min-height: 36px; }
.room-pill:hover { border-color: var(--accent); color: var(--accent); }
.room-pill.active { background: var(--accent); border-color: var(--accent); color: white; }

/* ── MODAL (bottom sheet on mobile, centered on desktop) */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(26,31,46,0.5);
  backdrop-filter: blur(3px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--white);
  border-radius: 14px 14px 0 0;
  box-shadow: var(--shadow-lg);
  width: 100%;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 92vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-drag { width: 36px; height: 4px; background: var(--border); border-radius: 99px; margin: 0.75rem auto 0; }
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 1rem; font-weight: 600; }
.modal-close { width: 32px; height: 32px; border-radius: var(--radius-sm); border: none; background: var(--surface); color: var(--ink-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1rem; transition: all var(--transition); }
.modal-close:hover { background: var(--border); }
.modal-body { padding: 1.25rem; }
.modal-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border); display: flex; flex-direction: column-reverse; gap: 0.5rem; }
.modal-footer .btn { justify-content: center; }


/* ── CALENDAR ────────────────────────────────────────── */
#calendar { min-height: 380px; }
.fc { font-family: 'DM Sans', sans-serif !important; font-size: 0.82rem !important; }
.fc-toolbar { flex-wrap: wrap; gap: 0.4rem !important; margin-bottom: 0.75rem !important; }
.fc-toolbar-title { font-size: 0.95rem !important; font-weight: 700 !important; color: var(--ink) !important; }
.fc-button { font-family: 'DM Sans', sans-serif !important; font-size: 0.75rem !important; font-weight: 500 !important; background: var(--white) !important; border: 1.5px solid #c8cdd8 !important; color: var(--ink) !important; box-shadow: 0 1px 2px rgba(0,0,0,0.06) !important; border-radius: var(--radius-sm) !important; padding: 0.3rem 0.65rem !important; }
.fc-button:hover { background: var(--surface) !important; }
.fc-button-primary:not(:disabled).fc-button-active,.fc-button-primary:not(:disabled):active { background: var(--accent) !important; border-color: var(--accent) !important; color: white !important; box-shadow: none !important; }
.fc-daygrid-event, .fc-timegrid-event { border-radius: 5px !important; border: none !important; font-size: 0.73rem !important; font-weight: 600 !important; }
.fc-event-blocked,
.fc-event-reserved { background: #fee2e2 !important; color: #991b1b !important; border-left: 3px solid #ef4444 !important; }
.fc-event-mine     { background: #d1fae5 !important; color: #065f46 !important; border-left: 3px solid #10b981 !important; }
.fc-col-header-cell { background: #e8ebf2 !important; border-bottom: 2px solid #a0a8be !important; }
.fc-col-header-cell-cushion { font-size: 0.73rem !important; font-weight: 800 !important; color: #1a1f2e !important; text-transform: uppercase; letter-spacing: 0.07em; text-decoration: none !important; padding: 0.45rem 0.3rem !important; }
.fc-day-today .fc-col-header-cell-cushion { color: var(--accent) !important; }
.fc-day-today { background: #eaf2ff !important; }
/* Disable FullCalendar hover/selection highlight — keep calendar colors clean */
.fc-highlight { background: transparent !important; opacity: 1 !important; }
.fc-timegrid-col:hover, .fc-daygrid-day:hover { background: inherit !important; }
.fc-day:hover { background: inherit !important; }
.fc-day-today:hover { background: #eaf2ff !important; }
/* Hour rows: dark solid line; minor (15/30/45) rows: lighter */
.fc-timegrid-slot { height: 2.2rem !important; }
.fc-timegrid-slot-label { font-size: 0.74rem !important; font-weight: 700 !important; color: #1a1f2e !important; padding-right: 0.6rem !important; background: #f5f6f8; }
.fc-timegrid-slot-lane { border-color: #b0b7c9 !important; }
.fc-timegrid-slot-lane.fc-timegrid-slot-minor { border-color: #dde1ea !important; border-style: dashed !important; }
.fc-scrollgrid { border-color: #a0a8be !important; border-width: 2px !important; }
.fc-scrollgrid td { border-color: #b0b7c9 !important; }
.fc-scrollgrid th { border-color: #a0a8be !important; }
.fc-timegrid-now-indicator-line { border-color: #dc2626 !important; border-width: 2px !important; }
.fc-timegrid-now-indicator-arrow { border-top-color: #dc2626 !important; border-bottom-color: #dc2626 !important; }

/* ── AUTH PAGE ───────────────────────────────────────── */
.auth-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem; }
.auth-wrap { width: 100%; max-width: 420px; }
.auth-logo { text-align: center; margin-bottom: 1.75rem; }
.auth-logo-mark { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; background: var(--accent); border-radius: 14px; margin-bottom: 0.85rem; }
.auth-logo-mark svg { width: 24px; height: 24px; }
.auth-logo h1 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.02em; }
.auth-logo p { font-size: 0.8rem; color: var(--ink-muted); margin-top: 0.2rem; }

/* ── SPINNER ─────────────────────────────────────────── */
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── EMPTY ───────────────────────────────────────────── */
.empty { text-align: center; padding: 2.5rem 1.5rem; color: var(--ink-muted); }
.empty-icon { font-size: 2rem; margin-bottom: 0.6rem; }
.empty p { font-size: 0.875rem; }

/* ── UTILS ───────────────────────────────────────────── */
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; } .gap-3 { gap: 0.75rem; }
.mt-2 { margin-top: 0.5rem; } .mt-3 { margin-top: 0.75rem; } .mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; } .mb-3 { margin-bottom: 0.75rem; }
.text-sm { font-size: 0.875rem; } .text-xs { font-size: 0.75rem; }
.text-muted { color: var(--ink-muted); } .text-center { text-align: center; }
.font-mono { font-family: 'DM Mono', monospace; }
.divider { height: 1px; background: var(--border); margin: 1.25rem 0; }

/* ── PAGE TRANSITION ─────────────────────────────────── */
.page-content { animation: fadeUp 0.2s ease forwards; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* ── DESKTOP ─────────────────────────────────────────── */
@media (min-width: 640px) {
  .page { padding: 1.5rem; }
  .card-body { padding: 1.25rem; }
}
@media (min-width: 768px) {
  :root { --nav-h: 58px; }
  body.has-bottom-nav { padding-bottom: 0; }
  .nav-links { display: flex; }
  .bottom-nav { display: none; }
  .page { padding: 2rem 1.5rem; }
  .page-title { font-size: 1.5rem; }
  .nav-inner { padding: 0 1.5rem; }
  .modal-overlay { align-items: center; padding: 1rem; }
  .modal { border-radius: var(--radius); max-width: 500px; transform: translateY(10px) scale(0.98); }
  .modal-drag { display: none; }
  .modal-overlay.open .modal { transform: none; }
  .modal-footer { flex-direction: row; }
  .modal-footer .btn { justify-content: unset; }
}
