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

:root {
  --primary: #1a2f4e;
  --primary-light: #2d4a72;
  --accent: #c8a84b;
  --accent-light: #e8c867;
  --success: #27ae60;
  --danger: #e74c3c;
  --warning: #f39c12;
  --info: #2980b9;
  --bg: #f0f2f5;
  --card: #ffffff;
  --text: #2d3436;
  --text-muted: #636e72;
  --border: #dfe6e9;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 2px 20px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 32px rgba(0,0,0,0.14);
}

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

html { font-size: 16px; }

body {
  font-family: 'Heebo', sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
  line-height: 1.6;
}

/* ── CLIENT PAGE ── */
.client-page { background: linear-gradient(160deg, #0f1f3d 0%, #1a2f4e 50%, #0f1f3d 100%); }

.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  padding: 48px 24px 64px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c8a84b' fill-opacity='0.06'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-icon { font-size: 3.5rem; display: block; margin-bottom: 12px; }

.hero h1 {
  color: #fff;
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
  position: relative;
}

.hero-subtitle {
  color: var(--accent-light);
  font-size: 1rem;
  font-weight: 400;
  position: relative;
}

.booking-container {
  max-width: 560px;
  margin: -32px auto 40px;
  padding: 0 16px;
  position: relative;
  z-index: 10;
}

.booking-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px 24px;
  box-shadow: var(--shadow-md);
}

.booking-card h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 24px;
  text-align: center;
}

/* Form */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group label .required { color: var(--danger); margin-right: 2px; }

.form-control {
  width: 100%;
  padding: 12px 14px;
  font-family: 'Heebo', sans-serif;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  direction: rtl;
  transition: border-color 0.2s;
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
}

.form-control:disabled { background: #f8f9fa; color: var(--text-muted); cursor: not-allowed; }

/* Slots grid */
.slots-section { margin-top: 4px; }
.slots-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  display: block;
}

.slots-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.slot-btn {
  padding: 10px 6px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-family: 'Heebo', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.slot-btn:hover { border-color: var(--primary); color: var(--primary); background: #f0f4ff; }
.slot-btn.selected { background: var(--primary); color: #fff; border-color: var(--primary); }

.slots-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 20px;
  background: #f8f9fa;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.slots-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 16px;
}

.btn-primary {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Heebo', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: transform 0.15s, box-shadow 0.15s;
  letter-spacing: 0.3px;
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(26,47,78,0.3); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Success Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
  background: var(--card);
  border-radius: var(--radius);
  padding: 36px 28px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.3s;
}

.modal-overlay.active .modal { transform: scale(1); }

.modal-icon { font-size: 4rem; margin-bottom: 16px; display: block; }
.modal h2 { color: var(--success); font-size: 1.5rem; margin-bottom: 12px; }
.modal p { color: var(--text-muted); margin-bottom: 8px; }
.modal .details { background: #f8f9fa; border-radius: var(--radius-sm); padding: 16px; margin: 16px 0; text-align: right; }
.modal .detail-row { display: flex; justify-content: space-between; margin-bottom: 6px; }
.modal .detail-row:last-child { margin-bottom: 0; }
.modal .detail-label { color: var(--text-muted); font-size: 0.875rem; }
.modal .detail-value { font-weight: 600; font-size: 0.875rem; }

/* Alert */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.9rem;
  display: none;
}
.alert.error { background: #fdecea; color: var(--danger); border: 1px solid #f5c6cb; display: block; }
.alert.success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; display: block; }

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-left: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── ADMIN PAGE ── */
.admin-page { background: var(--bg); min-height: 100vh; }

/* Login */
.login-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.login-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.login-card h1 { font-size: 1.6rem; color: var(--primary); margin-bottom: 6px; }
.login-card p { color: var(--text-muted); margin-bottom: 28px; font-size: 0.9rem; }

/* Dashboard layout */
.dashboard { display: flex; flex-direction: column; min-height: 100vh; }

.top-bar {
  background: var(--primary);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.top-bar h1 { font-size: 1.1rem; font-weight: 700; }
.top-bar .subtitle { font-size: 0.75rem; color: rgba(255,255,255,0.7); margin-top: 1px; }

.btn-logout {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 7px 14px;
  border-radius: 20px;
  font-family: 'Heebo', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.25); }

.content-area {
  flex: 1;
  padding: 20px 16px 100px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 4px 8px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.7rem;
  border: none;
  background: none;
  font-family: 'Heebo', sans-serif;
  transition: color 0.2s;
  gap: 3px;
}

.nav-item .nav-icon { font-size: 1.4rem; }
.nav-item.active { color: var(--primary); font-weight: 600; }

/* Tab panels */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Date navigator */
.date-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  background: var(--card);
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.date-nav input[type="date"] {
  flex: 1;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Heebo', sans-serif;
  font-size: 0.95rem;
  direction: ltr;
  background: #fff;
}

.date-nav input[type="date"]:focus { outline: none; border-color: var(--primary); }

.btn-nav {
  width: 38px; height: 38px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.15s;
  flex-shrink: 0;
}
.btn-nav:hover { border-color: var(--primary); color: var(--primary); }

/* Appointment cards */
.appt-list { display: flex; flex-direction: column; gap: 10px; }

.appt-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  border-right: 4px solid var(--primary);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.appt-card.cancelled { border-right-color: var(--danger); opacity: 0.6; }
.appt-card.completed { border-right-color: var(--success); }
.appt-card.no-show { border-right-color: var(--warning); }

.appt-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }

.appt-time {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.appt-info { flex: 1; }
.appt-name { font-weight: 700; font-size: 1rem; margin-bottom: 2px; }
.appt-service { color: var(--text-muted); font-size: 0.875rem; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-confirmed { background: #cce5ff; color: #004085; }
.badge-completed { background: #d4edda; color: #155724; }
.badge-cancelled { background: #f8d7da; color: #721c24; }
.badge-noshow { background: #fff3cd; color: #856404; }

.appt-phone a {
  color: var(--info);
  text-decoration: none;
  font-size: 0.875rem;
}
.appt-phone a:hover { text-decoration: underline; }

.appt-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-sm {
  padding: 6px 12px;
  border-radius: 20px;
  font-family: 'Heebo', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s;
}
.btn-sm:hover { opacity: 0.85; }
.btn-success { background: #d4edda; color: #155724; }
.btn-danger { background: #f8d7da; color: #721c24; }
.btn-warning { background: #fff3cd; color: #856404; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; display: block; margin-bottom: 12px; }
.empty-state p { font-size: 0.95rem; }

/* Section header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title { font-size: 1.1rem; font-weight: 700; color: var(--primary); }

/* Btn add */
.btn-add {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 20px;
  font-family: 'Heebo', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background 0.2s;
}
.btn-add:hover { background: var(--primary-light); }

/* Service table */
.services-table {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.service-row {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.service-row:last-child { border-bottom: none; }
.service-row.inactive { opacity: 0.5; }

.service-info { flex: 1; }
.service-name { font-weight: 600; }
.service-details { color: var(--text-muted); font-size: 0.8rem; margin-top: 2px; }
.service-price { font-weight: 700; color: var(--primary); font-size: 1rem; min-width: 56px; text-align: left; }

.service-actions { display: flex; gap: 6px; }
.btn-icon {
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all 0.15s;
}
.btn-icon:hover { background: var(--bg); }
.btn-icon.delete:hover { background: #fdecea; border-color: var(--danger); }

/* Inline form */
.inline-form {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  border: 2px solid var(--primary);
  display: none;
}
.inline-form.open { display: block; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.form-group-sm { margin-bottom: 12px; }
.form-group-sm label { font-size: 0.8rem; font-weight: 600; margin-bottom: 4px; display: block; }
.form-group-sm .form-control { padding: 9px 12px; font-size: 0.9rem; }

.btn-secondary {
  padding: 10px 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  font-family: 'Heebo', sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }

/* Weekly view */
.week-day-group { margin-bottom: 16px; }
.week-day-header {
  background: var(--primary);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-weight: 700;
  font-size: 0.9rem;
}
.week-day-content {
  background: var(--card);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.week-appt-row {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.week-appt-row:last-child { border-bottom: none; }
.week-time { font-weight: 700; color: var(--primary); min-width: 48px; }
.week-info { flex: 1; font-size: 0.9rem; }
.week-client { font-weight: 600; }
.week-service { color: var(--text-muted); font-size: 0.8rem; }

/* Block slots */
.block-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.block-item {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  border-right: 3px solid var(--warning);
}
.block-info { font-size: 0.9rem; }
.block-info strong { display: block; }
.block-time { color: var(--text-muted); font-size: 0.8rem; }

/* Settings */
.settings-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.settings-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 16px; color: var(--primary); }

.days-checkboxes { display: flex; flex-wrap: wrap; gap: 8px; }
.day-checkbox { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.day-checkbox input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.day-checkbox span { font-size: 0.9rem; }

.btn-save {
  background: var(--success);
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-family: 'Heebo', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: opacity 0.15s;
}
.btn-save:hover { opacity: 0.9; }

/* Misc */
.whatsapp-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.wa-connected { background: #d4edda; color: #155724; }
.wa-disconnected { background: #f8d7da; color: #721c24; }

hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }

@media (min-width: 600px) {
  .slots-grid { grid-template-columns: repeat(5, 1fr); }
  .booking-card { padding: 40px 36px; }
  .hero h1 { font-size: 2.4rem; }
}
