/* ===== Design System ===== */
:root {
  --bg: #FAFAFA;
  --bg-card: #FFFFFF;
  --primary: #2D7D6F;
  --primary-dark: #245f55;
  --primary-light: #e8f5f2;
  --accent: #F0A500;
  --accent-dark: #d49000;
  --text: #1A1A1A;
  --text-muted: #6B7280;
  --text-light: #9CA3AF;
  --border: #E5E7EB;
  --border-light: #F3F4F6;
  --error: #DC2626;
  --error-light: #FEE2E2;
  --success: #059669;
  --success-light: #D1FAE5;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition: 150ms ease;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); font-size: 1rem; }

/* ===== Layout ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
.hidden { display: none !important; }
#app { display: flex; flex-direction: column; min-height: 100vh; }
#main-content { flex: 1; padding: 1.5rem 0; }

/* ===== Header ===== */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}
.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.5px;
}
.logo span { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 1rem; }
.nav-links a, .nav-links button {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.nav-links a:hover, .nav-links button:hover {
  color: var(--primary);
  background: var(--primary-light);
}

/* ===== Footer ===== */
#site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: auto;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-accent {
  background: var(--accent);
  color: #fff;
}
.btn-accent:hover { background: var(--accent-dark); color: #fff; }
.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }
.btn-danger {
  background: var(--error);
  color: #fff;
}
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.75rem; font-size: 1rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 3rem;
}
.card-body { padding: 1rem 1.25rem; }
.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text);
}
.card-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.card-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.card-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ===== Grid ===== */
.grid {
  display: grid;
  gap: 1.5rem;
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1024px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ===== Forms ===== */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--text);
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  background: var(--bg-card);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(45, 125, 111, 0.15);
}
.form-input.error { border-color: var(--error); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-error {
  color: var(--error);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}
.form-row {
  display: flex;
  gap: 1rem;
}
.form-row > .form-group { flex: 1; }
@media (max-width: 640px) {
  .form-row { flex-direction: column; gap: 0; }
}

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 3rem 0;
  text-align: center;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  margin-bottom: 2rem;
}
.hero h1 {
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.5px;
}
.hero p {
  font-size: 1.1rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto 1.5rem;
}
@media (max-width: 640px) {
  .hero { padding: 2rem 1rem; }
  .hero h1 { font-size: 1.75rem; }
}

/* ===== Search Bar ===== */
.search-container {
  max-width: 700px;
  margin: 0 auto;
}
.search-bar {
  display: flex;
  background: var(--bg-card);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  padding: 0.25rem;
}
.search-bar input {
  flex: 1;
  border: none;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  background: transparent;
  color: var(--text);
}
.search-bar input:focus { outline: none; }
.search-bar button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.9rem;
  transition: background var(--transition);
}
.search-bar button:hover { background: var(--accent-dark); }
@media (max-width: 640px) {
  .search-bar {
    flex-direction: column;
    border-radius: var(--radius);
  }
  .search-bar button { border-radius: var(--radius-sm); margin: 0.25rem; }
}

/* ===== Cuisine Pills ===== */
.cuisine-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1rem;
}
.pill {
  padding: 0.35rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.15);
  color: #fff;
  transition: all var(--transition);
}
.pill:hover, .pill.active {
  background: rgba(255,255,255,0.3);
  border-color: rgba(255,255,255,0.5);
}

/* ===== Section Headings ===== */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
}
.section-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* ===== Restaurant Detail ===== */
.restaurant-hero {
  height: 300px;
  background: linear-gradient(135deg, var(--primary-light), var(--border-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  color: var(--primary);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
}
.restaurant-info { margin-bottom: 2rem; }
.restaurant-info h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.restaurant-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.restaurant-meta span { display: flex; align-items: center; gap: 0.25rem; }
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
}
.badge-accent { background: #FEF3C7; color: #92400E; }
.badge-allergen { background: var(--error-light); color: var(--error); font-size: 0.7rem; }

/* ===== Tabs ===== */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}
.tab {
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: all var(--transition);
}
.tab:hover { color: var(--primary); }
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ===== Menu Display ===== */
.menu-section { margin-bottom: 2rem; }
.menu-section h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-light);
}
.menu-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-light);
}
.menu-item:last-child { border-bottom: none; }
.menu-item-info { flex: 1; margin-right: 1rem; }
.menu-item-name { font-weight: 600; font-size: 0.95rem; }
.menu-item-desc { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.15rem; }
.menu-item-tags { display: flex; gap: 0.3rem; margin-top: 0.3rem; flex-wrap: wrap; }
.menu-item-price { font-weight: 700; color: var(--primary); white-space: nowrap; }

/* ===== Reservation Form ===== */
.reservation-sidebar {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  position: sticky;
  top: 5rem;
}
.reservation-sidebar h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
}
.time-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.time-slot {
  padding: 0.5rem;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--transition);
}
.time-slot:hover { border-color: var(--primary); color: var(--primary); }
.time-slot.selected {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.time-slot.unavailable {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ===== Detail Layout ===== */
.detail-layout {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 768px) {
  .detail-layout { grid-template-columns: 1fr; }
  .reservation-sidebar { position: static; }
}

/* ===== Dashboard ===== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 2rem;
}
.dashboard-nav {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 0;
}
.dashboard-nav a {
  display: block;
  padding: 0.6rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
}
.dashboard-nav a:hover, .dashboard-nav a.active {
  color: var(--primary);
  background: var(--primary-light);
}
.dashboard-content {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}
@media (max-width: 768px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-nav { display: flex; overflow-x: auto; padding: 0.5rem; }
  .dashboard-nav a { white-space: nowrap; }
}

/* ===== Auth Forms ===== */
.auth-container {
  max-width: 440px;
  margin: 2rem auto;
}
.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2rem;
}
.auth-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  text-align: center;
}
.auth-card .subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}
.auth-footer {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ===== Alerts ===== */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.alert-error {
  background: var(--error-light);
  color: var(--error);
  border: 1px solid #FECACA;
}
.alert-success {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid #A7F3D0;
}

/* ===== Loading ===== */
.loading-spinner {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}
.spinner {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Reservation Status ===== */
.status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}
.status-confirmed { background: var(--success-light); color: var(--success); }
.status-pending { background: #FEF3C7; color: #92400E; }
.status-cancelled { background: var(--error-light); color: var(--error); }
/* ===== Refresh Indicator ===== */
.refresh-track {
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  overflow: hidden;
}
.refresh-bar {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 1s linear;
}

.status-preparing { background: #DBEAFE; color: #1E40AF; }
.status-ready { background: #FEF3C7; color: #92400E; }
.status-completed { background: var(--success-light); color: var(--success); }

/* ===== Debug Panel ===== */
.debug-panel {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 400px;
  max-height: 300px;
  background: #1a1a2e;
  color: #0f0;
  font-family: monospace;
  font-size: 0.75rem;
  z-index: 9999;
  border-top-left-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.debug-header {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem;
  background: #16213e;
  border-bottom: 1px solid #333;
}
.debug-header button { background: none; border: none; color: #fff; font-size: 1rem; }
.debug-log {
  padding: 0.5rem;
  overflow-y: auto;
  max-height: 250px;
}
.debug-log .entry { padding: 0.15rem 0; border-bottom: 1px solid #333; }
.debug-log .method { color: #ff6b6b; }
.debug-log .url { color: #48dbfb; }
.debug-log .status { color: #feca57; }
.debug-log .time { color: #0abde3; }

/* ===== Table ===== */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
}
th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 420px;
  animation: slideUp 0.2s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  line-height: 1;
  padding: 0;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 1.25rem; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-light);
}

/* ===== Utility ===== */
/* ===== Week Overview ===== */
.week-overview {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.week-day-card {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}
.week-day-card:hover { border-color: var(--primary); }
.week-day-today { border-color: var(--primary); background: var(--primary-light); }
.week-day-active { border-color: var(--accent); background: #FEF3C7; }
.week-day-name { font-weight: 600; font-size: 0.85rem; color: var(--text); }
.week-day-date { font-size: 0.8rem; color: var(--text-muted); }
.week-day-count { font-size: 1.5rem; font-weight: 700; color: var(--primary); margin: 0.25rem 0; }
.week-day-label { font-size: 0.7rem; color: var(--text-muted); }
@media (max-width: 1024px) {
  .week-overview { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 640px) {
  .week-overview { grid-template-columns: repeat(3, 1fr); }
}

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
