/* ═══════════════════════════════════════════════════════════════════════════
   CHABAD RECHAVIA CENTER — Room Scheduling Calendar
   Aesthetic: Refined liturgical — deep navy, gold, warm cream
   Fonts: Cormorant Garamond (headings) · DM Sans (body)
═══════════════════════════════════════════════════════════════════════════ */

:root {
  --navy:        #12183a;
  --navy-mid:    #1c2550;
  --navy-light:  #2a3470;
  --gold:        #c9a84c;
  --gold-light:  #e6c97a;
  --gold-pale:   #f5e9c4;
  --cream:       #faf6ef;
  --cream-mid:   #f0e9da;
  --white:       #ffffff;
  --text-dark:   #1a1e3a;
  --text-mid:    #4a4f72;
  --text-light:  #8b90aa;
  --border:      #e2ddd4;
  --border-dark: #ccc5b5;
  --red:         #c0392b;
  --green:       #217a3c;
  --amber:       #b8630a;
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --shadow-sm:   0 1px 4px rgba(18,24,58,0.08);
  --shadow-md:   0 4px 16px rgba(18,24,58,0.12);
  --shadow-lg:   0 8px 32px rgba(18,24,58,0.18);
  --transition:  0.18s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--cream);
  color: var(--text-dark);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Top Navigation ──────────────────────────────────────────────────────── */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 24px;
  background: var(--navy);
  border-bottom: 2px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-emblem {
  font-size: 24px;
  color: var(--gold);
  line-height: 1;
  text-shadow: 0 0 12px rgba(201,168,76,0.5);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--white);
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.brand-sub {
  font-size: 10px;
  color: var(--gold-light);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 400;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-user {
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
}

.btn-nav-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  background: var(--gold);
  color: var(--navy);
  border: none;
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition);
}

.btn-nav-action:hover { background: var(--gold-light); color: var(--navy); }
.btn-nav-action.secondary { background: rgba(255,255,255,0.1); color: var(--white); }
.btn-nav-action.secondary:hover { background: rgba(255,255,255,0.2); color: var(--white); }

/* ── App Layout ──────────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  height: calc(100vh - 60px);
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: 256px;
  min-width: 256px;
  background: var(--white);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.sidebar.collapsed {
  width: 0;
  min-width: 0;
  overflow: hidden;
  border-right: none;
}

.sidebar-inner {
  padding: 18px 14px;
  min-width: 228px;
}

.btn-add-event {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  background: var(--navy);
  color: var(--white);
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.btn-add-event:hover {
  background: var(--navy-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-add-event i { font-size: 16px; }

.sidebar-section { margin-bottom: 22px; }

.section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-light);
  margin-bottom: 8px;
  padding: 0 2px;
}

/* View Pills */
.view-pills {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.view-pill {
  padding: 7px 6px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-mid);
  font-size: 12px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all var(--transition);
}

.view-pill:hover { background: var(--cream); border-color: var(--border-dark); }

.view-pill.active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

/* Room Filters */
.filter-toggle-all {
  font-size: 10px;
  color: var(--gold);
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.06em;
}

.filter-toggle-all:hover { color: var(--navy); }

.room-filter-list { display: flex; flex-direction: column; gap: 2px; }

.room-filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  user-select: none;
}

.room-filter-item:hover { background: var(--cream); }

.room-filter-item input[type="checkbox"] { display: none; }

.room-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: opacity var(--transition);
}

.room-checkbox:not(:checked) + .room-dot { opacity: 0.3; }

.room-filter-name {
  flex: 1;
  font-size: 12.5px;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-capacity {
  font-size: 10px;
  color: var(--text-light);
  background: var(--cream-mid);
  padding: 1px 5px;
  border-radius: 10px;
}

/* Status Legend */
.status-legend { display: flex; flex-direction: column; gap: 5px; }

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-mid);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.legend-dot.confirmed { background: var(--green); }
.legend-dot.pending { background: var(--amber); border: 2px dashed var(--amber); background: transparent; }

/* ── Calendar Main ───────────────────────────────────────────────────────── */
.calendar-main {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--cream);
}

.calendar-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  gap: 16px;
  flex-shrink: 0;
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cal-nav-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dark);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.cal-nav-btn:hover { background: var(--navy); color: var(--white); border-color: var(--navy); }

.cal-today-btn {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dark);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.cal-today-btn:hover { background: var(--navy); color: var(--white); border-color: var(--navy); }

.cal-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: 0.01em;
  flex: 1;
  text-align: center;
}

.cal-header-right { display: flex; gap: 8px; }

.cal-icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-mid);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.cal-icon-btn:hover { background: var(--cream-mid); color: var(--navy); }

/* ── FullCalendar Overrides ───────────────────────────────────────────────── */
#calendar {
  flex: 1;
  padding: 16px;
  overflow: hidden;
}

.fc {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
}

/* Column headers */
.fc .fc-col-header-cell-cushion {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-mid);
  padding: 8px 4px;
  text-decoration: none;
}

/* Time labels */
.fc .fc-timegrid-slot-label-cushion {
  font-size: 11px;
  color: var(--text-light);
}

/* Today highlight */
.fc .fc-day-today { background: rgba(201,168,76,0.06) !important; }
.fc .fc-day-today .fc-col-header-cell-cushion { color: var(--gold) !important; }

/* Scrollbar */
.fc .fc-scroller::-webkit-scrollbar { width: 5px; height: 5px; }
.fc .fc-scroller::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 10px; }
.fc .fc-scroller::-webkit-scrollbar-track { background: transparent; }

/* Now indicator */
.fc .fc-timegrid-now-indicator-line { border-color: var(--gold) !important; }
.fc .fc-timegrid-now-indicator-arrow { border-top-color: var(--gold) !important; }

/* Event styles */
.fc .fc-timegrid-event { border-radius: 6px !important; border: none !important; box-shadow: 0 2px 6px rgba(0,0,0,0.15) !important; }
.fc .fc-timegrid-event .fc-event-main { padding: 0 !important; }
.fc .fc-daygrid-event { border-radius: 4px !important; border: none !important; }

/* Custom event content */
.fc-event-inner {
  padding: 4px 7px;
  height: 100%;
  overflow: hidden;
  cursor: pointer;
}

.fc-event-inner.is-pending {
  opacity: 0.75;
  border-left: 3px solid rgba(255,255,255,0.5) !important;
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 4px,
    rgba(255,255,255,0.08) 4px,
    rgba(255,255,255,0.08) 8px
  );
}

.fc-event-time-label {
  font-size: 10px;
  opacity: 0.8;
  font-weight: 500;
  line-height: 1.2;
}

.fc-event-title-label {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
  line-height: 1.3;
}

.fc-event-room-label {
  font-size: 10px;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(255,255,255,0.85);
}

.fc-event-org-label {
  font-size: 10px;
  opacity: 0.7;
  color: rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  gap: 3px;
}

/* Month view event */
.fc-month-event {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: 3px;
  color: #fff;
  font-size: 11.5px;
  font-weight: 500;
  overflow: hidden;
}

.fc-event-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.7);
  flex-shrink: 0;
}

.fc-event-title-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* List view */
.fc-list-event-custom {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fc-list-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.fc-list-room {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-light);
  background: var(--cream-mid);
  padding: 1px 6px;
  border-radius: 10px;
}

/* Select / highlight */
.fc .fc-highlight { background: rgba(201,168,76,0.12) !important; }
.fc .fc-timegrid-event-harness .fc-event:focus { box-shadow: 0 0 0 3px rgba(201,168,76,0.4) !important; }

/* ── Event Modal ─────────────────────────────────────────────────────────── */
.modal-styled {
  border: none;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.modal-header-styled {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  background: var(--navy);
  border-bottom: 2px solid var(--gold);
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-icon {
  width: 36px;
  height: 36px;
  background: rgba(201,168,76,0.2);
  border: 1px solid var(--gold);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  font-size: 16px;
}

.modal-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--white);
  letter-spacing: 0.01em;
  margin: 0;
}

.modal-close-btn {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  background: transparent;
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.modal-close-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }

.modal-body-styled {
  padding: 22px 24px;
  background: var(--white);
  max-height: 65vh;
  overflow-y: auto;
}

.modal-footer-styled {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--cream);
  border-top: 1px solid var(--border);
}

.footer-right { display: flex; gap: 10px; }

/* Form elements */
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.form-group-styled {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.form-label-styled {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  display: flex;
  align-items: center;
  gap: 5px;
}

.form-label-styled i { color: var(--gold); font-size: 12px; }

.req { color: var(--red); font-style: normal; }

.form-input-styled,
.form-select-styled,
.form-textarea-styled {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--cream);
  color: var(--text-dark);
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-input-styled:focus,
.form-select-styled:focus,
.form-textarea-styled:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.15);
  background: var(--white);
}

.form-textarea-styled { resize: vertical; min-height: 60px; }

.field-error {
  font-size: 11px;
  color: var(--red);
  min-height: 14px;
}

.form-section-divider {
  position: relative;
  text-align: center;
  margin: 18px 0 14px;
}

.form-section-divider::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 1px;
  background: var(--border);
}

.form-section-divider span {
  position: relative;
  background: var(--white);
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-light);
}

/* Room Select Grid */
.room-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 6px;
  margin-bottom: 4px;
}

.room-select-card {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}

.room-select-card:hover { border-color: var(--gold); background: var(--gold-pale); }

.room-radio { display: none; }

.room-radio:checked + .room-card-dot + .room-card-name + .room-card-cap,
.room-radio:checked ~ * { }

.room-select-card:has(.room-radio:checked) {
  border-color: var(--navy);
  background: var(--navy);
}

.room-select-card:has(.room-radio:checked) .room-card-name,
.room-select-card:has(.room-radio:checked) .room-card-cap {
  color: var(--white);
}

.room-card-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.room-card-name {
  font-size: 12px;
  font-weight: 500;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-card-cap {
  font-size: 10px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Availability Check */
.availability-check {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.availability-check.available {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: var(--green);
}

.availability-check.conflict {
  background: #fff0f0;
  border: 1px solid #fecaca;
  color: var(--red);
}

/* Alert */
.alert-error {
  padding: 10px 14px;
  background: #fff0f0;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 13px;
  margin-top: 10px;
}

/* Buttons */
.btn-save-styled {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}

.btn-save-styled:hover { background: var(--navy-light); }
.btn-save-styled:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-cancel-styled {
  padding: 9px 16px;
  background: transparent;
  color: var(--text-mid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-cancel-styled:hover { background: var(--cream-mid); border-color: var(--border-dark); }

.btn-danger-styled {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  background: transparent;
  color: var(--red);
  border: 1px solid #fca5a5;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-danger-styled:hover { background: #fff0f0; border-color: var(--red); }

/* ── Event Popover ────────────────────────────────────────────────────────── */
.event-popover {
  position: fixed;
  width: 290px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  overflow: hidden;
}

.popover-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1999;
}

.popover-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 14px 10px;
  background: var(--navy);
}

.popover-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--white);
  padding-left: 8px;
  line-height: 1.3;
  flex: 1;
}

.popover-close {
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all var(--transition);
  flex-shrink: 0;
}

.popover-close:hover { background: rgba(255,255,255,0.1); color: #fff; }

.popover-body {
  padding: 12px 14px;
}

.popover-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dark);
  margin-bottom: 7px;
  line-height: 1.4;
}

.popover-row i { color: var(--gold); font-size: 13px; flex-shrink: 0; margin-top: 1px; }

.popover-status { margin-top: 8px; }

.popover-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.popover-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--cream);
}

.popover-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: background var(--transition);
}

.popover-edit-btn:hover { background: var(--navy-light); }

/* ── Scrollbars ───────────────────────────────────────────────────────────── */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 10px; }

.modal-body-styled::-webkit-scrollbar { width: 4px; }
.modal-body-styled::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 10px; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: 0; min-width: 0; overflow: hidden; }
  .sidebar.mobile-open { width: 256px; min-width: 256px; position: fixed; top: 60px; left: 0; bottom: 0; z-index: 900; box-shadow: var(--shadow-lg); }

  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
  .room-select-grid { grid-template-columns: 1fr 1fr; }

  .cal-title { font-size: 16px; }
  .brand-sub { display: none; }
}

@media (max-width: 480px) {
  .top-nav { padding: 0 14px; }
  .calendar-header-bar { padding: 10px 12px; }
}

/* ── Mini Calendar placeholder styling ───────────────────────────────────── */
#miniCal .fc { font-size: 11px; }
