/* ============================================
   Dentalak Design System — Arabic-first RTL
   ============================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --mint: #00D4AA;
  --mint-dark: #00B894;
  --mint-soft: #E8FBF5;
  --navy: #0A1628;
  --slate: #334155;
  --ghost: #94A3B8;
  --cream: #FAFBFC;
  --card: #FFFFFF;
  --border: #E2E8F0;
  --danger: #EF4444;
  --danger-soft: #FEF2F2;
  --warning: #F59E0B;
  --warning-soft: #FFFBEB;
  --success: #10B981;
  --success-soft: #ECFDF5;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(10, 22, 40, 0.06), 0 1px 2px rgba(10, 22, 40, 0.04);
  --shadow-lg: 0 10px 25px rgba(10, 22, 40, 0.08);
}

body {
  font-family: 'IBM Plex Sans Arabic', -apple-system, sans-serif;
  color: var(--navy);
  background: var(--cream);
  overflow-x: hidden;
  line-height: 1.7;
  direction: rtl;
}

.space { font-family: 'Space Grotesk', sans-serif; }

/* ========== NAV ========== */
nav {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 100;
  background: rgba(250, 251, 252, 0.88);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 22px;
  color: var(--navy);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.logo-icon {
  width: 34px;
  height: 34px;
  background: var(--mint);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}
.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--slate);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}
.nav-link:hover { background: var(--mint-soft); color: var(--mint-dark); }
.nav-link.active { background: var(--mint-soft); color: var(--mint); font-weight: 600; }

#enterAppBtn { margin-right: auto; }

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary { background: var(--mint); color: white; }
.btn-primary:hover { background: var(--mint-dark); transform: translateY(-1px); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--slate); }
.btn-outline:hover { border-color: var(--mint); color: var(--mint); }
.btn-ghost { background: transparent; color: var(--ghost); }
.btn-ghost:hover { color: var(--navy); background: var(--cream); }
.btn-danger-outline { background: transparent; border: 1.5px solid var(--danger); color: var(--danger); }
.btn-danger-outline:hover { background: var(--danger-soft); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }

/* ========== CONTAINER ========== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ========== LANDING ========== */
.hero {
  padding: 140px 0 80px;
  text-align: center;
}
.hero-badge {
  display: inline-block;
  padding: 8px 18px;
  background: var(--mint-soft);
  color: var(--mint);
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 28px;
}
.hero h1 {
  font-size: clamp(42px, 8vw, 72px);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 20px;
  letter-spacing: -1px;
}
.mint { color: var(--mint); }
.hero-sub {
  font-size: 18px;
  color: var(--ghost);
  max-width: 480px;
  margin: 0 auto 36px;
  line-height: 1.8;
}
.hero-actions { margin-bottom: 60px; }
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
  flex-wrap: wrap;
}
.stat { text-align: center; }
.stat-num {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--navy);
}
.stat-label {
  font-size: 13px;
  color: var(--ghost);
}

.features {
  padding: 80px 0 100px;
}
.features h2 {
  text-align: center;
  font-size: 32px;
  margin-bottom: 48px;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}
.feature-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  transition: all 0.2s;
}
.feature-card:hover {
  border-color: var(--mint);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.feature-icon {
  font-size: 36px;
  margin-bottom: 16px;
}
.feature-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
}
.feature-card p {
  color: var(--ghost);
  font-size: 14px;
  line-height: 1.8;
}

/* ========== APP PAGES ========== */
main {
  padding-top: 80px;
  min-height: 100vh;
}
.page { padding: 24px 0 60px; }
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 { font-size: 28px; }
.page-header-actions { display: flex; gap: 8px; }
.text-ghost { color: var(--ghost); }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 36px 0 16px;
}
.section-header h2 { font-size: 20px; }

/* ========== STATS GRID ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 8px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-card-icon { font-size: 28px; margin-bottom: 4px; }
.stat-card-num { font-size: 32px; font-weight: 700; color: var(--navy); }
.stat-card-label { font-size: 13px; color: var(--ghost); }

/* ========== SEARCH ========== */
.search-bar {
  margin-bottom: 20px;
}
.search-bar input {
  width: 100%;
  padding: 12px 18px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 15px;
  background: var(--card);
  transition: border-color 0.15s;
  direction: rtl;
}
.search-bar input:focus {
  outline: none;
  border-color: var(--mint);
}

/* ========== PATIENTS GRID ========== */
.patients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.patient-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.patient-card:hover {
  border-color: var(--mint);
  box-shadow: var(--shadow);
}
.patient-card-name {
  font-size: 16px;
  font-weight: 600;
}
.patient-card-meta {
  display: flex;
  gap: 16px;
  color: var(--ghost);
  font-size: 13px;
}
.patient-card-stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--ghost);
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 4px;
}

/* ========== PATIENT DETAIL ========== */
.patient-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.info-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.info-card h3 {
  font-size: 13px;
  color: var(--ghost);
  font-weight: 500;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.info-card p {
  font-size: 15px;
  font-weight: 500;
}
.info-card .notes {
  font-size: 14px;
  color: var(--slate);
  line-height: 1.7;
  white-space: pre-wrap;
}

.treatment-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.treatment-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.treatment-item-info { flex: 1; }
.treatment-item-type {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}
.treatment-item-desc {
  font-size: 13px;
  color: var(--ghost);
}
.treatment-item-meta {
  text-align: left;
  font-size: 13px;
  color: var(--ghost);
  white-space: nowrap;
}
.treatment-item-cost {
  font-weight: 600;
  color: var(--navy);
}

/* ========== APPOINTMENTS LIST ========== */
.appointments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.appointment-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all 0.15s;
}
.appointment-card:hover {
  border-color: var(--mint);
}
.appointment-time {
  font-size: 14px;
  font-weight: 600;
  color: var(--mint);
  min-width: 90px;
  text-align: center;
  direction: ltr;
}
.appointment-info { flex: 1; }
.appointment-patient { font-weight: 600; font-size: 15px; }
.appointment-type { font-size: 13px; color: var(--ghost); }
.appointment-status {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 50px;
}
.status-scheduled { background: var(--mint-soft); color: var(--mint); }
.status-completed { background: var(--success-soft); color: var(--success); }
.status-cancelled { background: var(--danger-soft); color: var(--danger); }
.status-in_progress { background: var(--warning-soft); color: var(--warning); }

/* ========== CALENDAR ========== */
.calendar-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.calendar-title {
  font-size: 18px;
  font-weight: 600;
  flex: 1;
  text-align: center;
}
.calendar-view-toggle {
  display: flex;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.calendar-view-toggle .btn {
  border-radius: 0;
  border: none;
  background: transparent;
  color: var(--ghost);
}
.calendar-view-toggle .btn.active {
  background: var(--mint);
  color: white;
}

.calendar-container { min-height: 400px; }

/* Weekly calendar grid */
.weekly-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
.day-column {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 300px;
}
.day-header {
  padding: 12px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}
.day-header.today {
  background: var(--mint-soft);
  color: var(--mint);
}
.day-header-name { display: block; font-size: 12px; color: var(--ghost); font-weight: 400; }
.day-header-num { display: block; font-size: 20px; font-weight: 700; margin-top: 2px; }
.day-appointments { padding: 8px; display: flex; flex-direction: column; gap: 6px; }

.cal-appt {
  background: var(--mint-soft);
  border-right: 3px solid var(--mint);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.cal-appt:hover { background: var(--mint); color: white; }
.cal-appt-time { font-weight: 600; direction: ltr; display: inline-block; }
.cal-appt-name { display: block; margin-top: 2px; }
.cal-appt.completed { border-color: var(--success); background: var(--success-soft); }
.cal-appt.cancelled { border-color: var(--ghost); background: var(--cream); opacity: 0.6; }

/* Daily calendar */
.daily-grid {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.daily-hour {
  display: flex;
  border-bottom: 1px solid var(--border);
  min-height: 60px;
}
.daily-hour:last-child { border-bottom: none; }
.daily-hour-label {
  width: 80px;
  padding: 12px;
  font-size: 13px;
  color: var(--ghost);
  border-left: 1px solid var(--border);
  text-align: center;
  direction: ltr;
  flex-shrink: 0;
}
.daily-hour-content {
  flex: 1;
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-start;
}

/* ========== MODALS ========== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 22, 40, 0.5);
  backdrop-filter: blur(4px);
}
.modal-content {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-sm { max-width: 440px; }
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 { font-size: 18px; }
.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--ghost);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.modal-close:hover { background: var(--cream); color: var(--navy); }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-start;
  gap: 10px;
}

/* ========== FORMS ========== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 24px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--slate);
}
.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  background: var(--cream);
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--mint);
  background: var(--card);
}
.form-group textarea { resize: vertical; }

/* ========== TOAST ========== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--navy);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: transform 0.3s ease;
  z-index: 300;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ========== EMPTY STATE ========== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--ghost);
  font-size: 15px;
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; display: block; }

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .nav-links { display: none !important; }
  .hero h1 { font-size: 36px; }
  .hero-stats { gap: 24px; }
  .weekly-grid { grid-template-columns: repeat(3, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .patients-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .calendar-controls { justify-content: center; }
  .appointment-card { flex-wrap: wrap; }

  /* Mobile nav bottom bar */
  .mobile-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 8px 0;
    z-index: 100;
  }
  .mobile-nav a {
    flex: 1;
    text-align: center;
    text-decoration: none;
    color: var(--ghost);
    font-size: 11px;
    padding: 6px;
  }
  .mobile-nav a.active { color: var(--mint); }
  .mobile-nav a .icon { font-size: 20px; display: block; }

  main { padding-bottom: 70px; }
}

@media (min-width: 769px) {
  .mobile-nav { display: none !important; }
}
