/* ============================================================
   CATERING PLANNER — style.css
   ============================================================ */

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

:root {
  /* Palette */
  --cream:        #faf8f4;
  --cream-dark:   #f0ebe2;
  --ink:          #1a1714;
  --ink-light:    #3d3730;
  --warm:         #8b6f47;
  --warm-light:   #c4a97a;
  --accent:       #c4622d;
  --accent-dark:  #a8511f;
  --accent-light: #fef6f2;
  --soft:         #e2dbd0;
  --soft-dark:    #cfc8bc;
  --card:         #ffffff;
  --muted:        #7a7168;
  --muted-light:  #a09891;
  --green:        #3a6b4a;
  --green-bg:     #ecf4ef;
  --red:          #b83a2e;
  --red-bg:       #fdf0ef;

  /* Typography */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;

  /* Spacing */
  --gap-xs:  4px;
  --gap-sm:  8px;
  --gap-md:  16px;
  --gap-lg:  24px;
  --gap-xl:  40px;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(26, 23, 20, 0.06), 0 1px 2px rgba(26, 23, 20, 0.04);
  --shadow-md:  0 4px 12px rgba(26, 23, 20, 0.08), 0 2px 4px rgba(26, 23, 20, 0.05);
  --shadow-lg:  0 16px 48px rgba(26, 23, 20, 0.14), 0 4px 12px rgba(26, 23, 20, 0.08);

  /* Transitions */
  --transition: 150ms ease;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-body);
  background-color: var(--cream);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── Typography ───────────────────────────────────────────── */
h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.2;
  font-weight: 500;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-xs);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition),
              color var(--transition), transform var(--transition),
              box-shadow var(--transition);
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  box-shadow: 0 4px 12px rgba(196, 98, 45, 0.3);
}

.btn-outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--soft-dark);
}

.btn-outline:hover {
  background: var(--soft);
  border-color: var(--warm-light);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--cream-dark);
  color: var(--ink);
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: #e8b4b0;
  font-size: 13px;
  padding: 6px 12px;
}

.btn-danger:hover {
  background: var(--red-bg);
}

.btn-sm {
  font-size: 13px;
  padding: 6px 13px;
}

/* ── Header ───────────────────────────────────────────────── */
.site-header {
  background: var(--card);
  border-bottom: 1.5px solid var(--soft);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

.brand-icon {
  font-size: 18px;
  color: var(--accent);
  line-height: 1;
}

.brand h1 {
  font-size: 22px;
  letter-spacing: -0.4px;
  color: var(--ink);
}

.brand h1 span {
  color: var(--accent);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
  max-width: 1040px;
  margin: 0 auto;
  padding: 2rem 2rem 4rem;
}

/* ── Section Header ───────────────────────────────────────── */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.75rem;
}

.section-header h2 {
  font-size: 26px;
  color: var(--ink);
  margin-bottom: 4px;
}

.section-subtitle {
  font-size: 14px;
  color: var(--muted);
}

/* ── Calendar ─────────────────────────────────────────────── */
.calendar-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.calendar-nav h2 {
  font-size: 24px;
  flex: 1;
  text-align: center;
  color: var(--ink);
  letter-spacing: -0.3px;
}

.nav-btn {
  background: var(--card);
  border: 1.5px solid var(--soft);
  border-radius: var(--radius-md);
  width: 38px;
  height: 38px;
  cursor: pointer;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-light);
  transition: background var(--transition), border-color var(--transition);
  flex-shrink: 0;
}

.nav-btn:hover {
  background: var(--cream-dark);
  border-color: var(--warm-light);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.cal-header {
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted-light);
  padding: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.cal-day {
  min-height: 84px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--soft);
  background: var(--card);
  padding: 8px;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition),
              background var(--transition);
  position: relative;
  overflow: hidden;
}

.cal-day:hover {
  border-color: var(--warm-light);
  box-shadow: var(--shadow-md);
  z-index: 1;
}

.cal-day.empty {
  background: transparent;
  border-color: transparent;
  cursor: default;
  box-shadow: none;
}

.cal-day.today {
  border-color: var(--accent);
  background: var(--accent-light);
}

.cal-day.today:hover {
  border-color: var(--accent-dark);
}

.cal-day.has-bookings {
  background: var(--green-bg);
  border-color: #b8d8c4;
}

.cal-day.has-bookings:hover {
  border-color: var(--green);
}

.cal-day.past {
  opacity: 0.4;
  cursor: default;
}

.cal-day.past:hover {
  border-color: var(--soft);
  box-shadow: none;
}

.day-num {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1;
}

.cal-day.today .day-num {
  color: var(--accent);
  font-weight: 600;
}

.cal-day.has-bookings .day-num {
  color: var(--green);
}

.booking-dot {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 5px;
  font-size: 10px;
  color: var(--green);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.booking-dot::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
  flex-shrink: 0;
}

.calendar-legend {
  display: flex;
  gap: var(--gap-md);
  margin-top: var(--gap-md);
  padding-top: var(--gap-md);
  border-top: 1px solid var(--soft);
}

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

.legend-item::before {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-today::before {
  background: var(--accent-light);
  border: 1.5px solid var(--accent);
}

.legend-booked::before {
  background: var(--green-bg);
  border: 1.5px solid #b8d8c4;
}

/* ── Overlay & Modal ──────────────────────────────────────── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 12, 0.55);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fadeOverlay 0.2s ease;
}

@keyframes fadeOverlay {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.overlay.is-open {
  display: flex;
}

.modal {
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: 2rem;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: slideModal 0.22s ease;
}

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

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-header h2 {
  font-size: 22px;
  color: var(--ink);
  line-height: 1.2;
  padding-right: 1rem;
}

.modal-close {
  background: var(--cream-dark);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 13px;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
  line-height: 1;
}

.modal-close:hover {
  background: var(--soft);
  color: var(--ink);
}

.modal-divider {
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  margin: 1.5rem 0 1.25rem;
}

.modal-divider::before,
.modal-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--soft);
}

.modal-divider span {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  white-space: nowrap;
}

.modal-footer {
  display: flex;
  gap: var(--gap-sm);
  justify-content: flex-end;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--soft);
}

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

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

.form-group label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.form-group input,
.form-group select {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--cream);
  border: 1.5px solid var(--soft);
  border-radius: var(--radius-md);
  padding: 10px 13px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.form-group input:hover,
.form-group select:hover {
  border-color: var(--soft-dark);
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--warm);
  box-shadow: 0 0 0 3px rgba(139, 111, 71, 0.12);
}

/* ── Existing Bookings List ───────────────────────────────── */
.bookings-section-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
}

.booking-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 14px;
  background: var(--cream);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--soft);
  margin-bottom: 7px;
  gap: var(--gap-md);
}

.booking-info strong {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

.booking-info span {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
  display: block;
}

/* ── Menu Choice Selector ─────────────────────────────────── */
.choice-section {
  margin-top: 16px;
  padding: 16px;
  background: var(--cream);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--soft);
}

.choice-section-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 14px;
}

.choice-group {
  margin-bottom: 14px;
}

.choice-group:last-child {
  margin-bottom: 0;
}

.choice-course-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-light);
  margin-bottom: 8px;
}

.choice-options {
  display: flex;
  gap: var(--gap-sm);
  flex-wrap: wrap;
}

.choice-btn {
  flex: 1;
  min-width: 110px;
  padding: 10px 12px;
  border: 1.5px solid var(--soft);
  border-radius: var(--radius-md);
  background: var(--card);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink);
  transition: border-color var(--transition), background var(--transition),
              color var(--transition), box-shadow var(--transition);
  text-align: center;
  line-height: 1.4;
}

.choice-btn:hover {
  border-color: var(--warm-light);
  background: var(--cream-dark);
}

.choice-btn.selected {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent-dark);
  font-weight: 500;
  box-shadow: 0 0 0 3px rgba(196, 98, 45, 0.1);
}

/* ── Menus List (manage view) ─────────────────────────────── */
.menu-card {
  background: var(--card);
  border: 1.5px solid var(--soft);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 12px;
  transition: box-shadow var(--transition), border-color var(--transition);
}

.menu-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--soft-dark);
}

.menu-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: var(--gap-md);
}

.menu-card-header h3 {
  font-size: 17px;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--ink);
}

.menu-card-actions {
  display: flex;
  gap: var(--gap-xs);
  flex-shrink: 0;
}

.menu-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--cream-dark);
  color: var(--muted);
  margin-left: 8px;
  vertical-align: middle;
  letter-spacing: 0.3px;
}

.course-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-xs);
}

.course-tag {
  display: inline-block;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--cream-dark);
  color: var(--muted);
  border: 1px solid var(--soft);
}

.course-tag strong {
  color: var(--ink-light);
  font-weight: 500;
}

/* ── Menu Editor (modal) ──────────────────────────────────── */
.courses-editor-wrap {
  border: 1.5px solid var(--soft);
  border-radius: var(--radius-md);
  padding: 14px;
  background: var(--cream);
  margin-bottom: 14px;
}

.courses-editor-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 12px;
}

.course-block {
  background: var(--card);
  border: 1.5px solid var(--soft);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 10px;
}

.course-block-header {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  margin-bottom: 10px;
}

.course-name-input {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  background: var(--cream);
  border: 1.5px solid var(--soft);
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  outline: none;
  flex: 1;
  transition: border-color var(--transition);
}

.course-name-input:focus {
  border-color: var(--warm);
}

.choice-pair {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  margin-bottom: 7px;
}

.choice-input {
  flex: 1;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink);
  background: var(--cream);
  border: 1.5px solid var(--soft);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  outline: none;
  transition: border-color var(--transition);
}

.choice-input:focus {
  border-color: var(--warm);
}

.btn-remove {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted-light);
  font-size: 15px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
  line-height: 1;
}

.btn-remove:hover {
  background: var(--red-bg);
  color: var(--red);
}

.btn-add-option {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--accent);
  background: none;
  border: 1px dashed #e8b49a;
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  cursor: pointer;
  transition: background var(--transition);
  margin-top: 2px;
}

.btn-add-option:hover {
  background: var(--accent-light);
}

.btn-add-course {
  display: block;
  width: 100%;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--warm);
  background: none;
  border: 1.5px dashed var(--warm-light);
  border-radius: var(--radius-md);
  padding: 10px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition);
  margin-top: 2px;
  text-align: center;
}

.btn-add-course:hover {
  background: var(--cream-dark);
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}

.empty-state-icon {
  font-size: 40px;
  margin-bottom: 10px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 15px;
}

/* ── Scrollbar ────────────────────────────────────────────── */
.modal::-webkit-scrollbar {
  width: 5px;
}

.modal::-webkit-scrollbar-track {
  background: var(--cream);
}

.modal::-webkit-scrollbar-thumb {
  background: var(--soft-dark);
  border-radius: 10px;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 640px) {
  .header-inner {
    padding: 0 1rem;
  }

  .main-content {
    padding: 1.25rem 1rem 3rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .cal-day {
    min-height: 56px;
    padding: 5px;
  }

  .cal-day .booking-dot {
    display: none;
  }

  .modal {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
  }

  .section-header {
    flex-direction: column;
    gap: var(--gap-md);
  }

  .choice-options {
    flex-direction: column;
  }

  .choice-btn {
    flex: none;
    width: 100%;
  }
}

/* ── User avatar ─────────────────────────────────────────── */
.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--cream-dark);
  border: 1.5px solid var(--soft);
  font-size: 14px;
  font-weight: 500;
  color: var(--warm);
  flex-shrink: 0;
}

/* ── Logout link as button ───────────────────────────────── */
#btn-logout {
  text-decoration: none;
  color: var(--muted);
  border-left: 1px solid var(--soft);
  padding-left: 14px;
  margin-left: 4px;
  border-radius: 0;
}
#btn-logout:hover {
  color: var(--red);
  background: transparent;
}

/* ── Header username display ─────────────────────────────── */
.header-user {
  font-size: 13px;
  color: var(--muted);
  padding: 0 4px;
}
