/* Rehab Smart — Global styles (Royal Care branding) */
:root {
  /* Royal Care palette */
  --rc-green: #4ea24a;
  --rc-green-dark: #2d6a2a;
  --rc-orange: #ee8a3c;
  --rc-blue: #1f4d6e;
  --rc-blue-dark: #0d2c44;
  --rc-teal: #1f8089;

  /* Mapped tokens */
  --primary: var(--rc-green);
  --primary-dark: var(--rc-green-dark);
  --accent: var(--rc-blue-dark);
  --highlight: var(--rc-orange);
  --bg: #f4f7fb;
  --surface: #ffffff;
  --text: #1c2733;
  --muted: #5a6a7a;
  --border: #e1e7ee;
  --danger: #dc3545;
  --shadow: 0 4px 16px rgba(13,44,68,.08), 0 2px 6px rgba(13,44,68,.05);
  --shadow-lg: 0 14px 40px rgba(13,44,68,.12);
  --radius: 12px;
  --nav-h: 64px;
}

/* ========== Dark mode ========== */
[data-theme="dark"] {
  --bg: #0d1b2a;
  --surface: #18324a;
  --text: #e8edf2;
  --muted: #9bafc4;
  --border: rgba(255,255,255,.10);
  --shadow: 0 4px 16px rgba(0,0,0,.45);
  --shadow-lg: 0 14px 40px rgba(0,0,0,.55);
  --primary: #5fb35a;
  --primary-dark: #4ea24a;
  --accent: #2c5d85;
}

/* Smooth theme transition */
body, .navbar, .center-card, .detail-card, .home-stats, .feature-box,
.hours-table, .testimonial, .stat-box, .auth-card, .dashboard-card,
.register-card, .register-section {
  transition: background-color .25s ease, color .25s ease, border-color .25s ease;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Cairo", "Almarai", "Segoe UI", "Tahoma", sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  line-height: 1.7;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* Navbar */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.navbar .brand {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.navbar .brand .logo-dot {
  width: 10px; height: 10px;
  background: var(--highlight);
  border-radius: 50%;
  display: inline-block;
}
.nav-links {
  display: flex;
  gap: 16px;
  align-items: center;
}
.nav-links a {
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  padding: 6px 4px;
  position: relative;
  text-decoration: none;
}
.nav-links a:not(.btn-login):not(.icon-btn):hover {
  color: var(--primary);
}
.nav-links .btn-login {
  background: var(--primary);
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
}
.nav-links .btn-login:hover { background: var(--primary-dark); color: #fff; }

/* Icon buttons (theme/lang toggle) */
.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 0;
  transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }

/* Hamburger (mobile only) */
.nav-toggle {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  font-family: inherit;
}
.nav-toggle .bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  margin: 5px 0;
  border-radius: 1px;
  transition: transform .2s, opacity .2s;
}
.nav-toggle.open .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open .bar:nth-child(2) { opacity: 0; }
.nav-toggle.open .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile navbar */
@media (max-width: 800px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: fixed;
    top: var(--nav-h);
    inset-inline-start: 0;
    inset-inline-end: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
    gap: 8px;
    box-shadow: var(--shadow-lg);
    transform: translateY(-120%);
    transition: transform .25s ease;
    max-height: calc(100vh - var(--nav-h));
    overflow-y: auto;
  }
  .nav-links.open { transform: translateY(0); }
  .nav-links a { padding: 12px 8px; border-bottom: 1px solid var(--border); }
  .nav-links a:last-of-type, .nav-links .btn-login { border-bottom: none; }
  .nav-links .btn-login { text-align: center; }
  .nav-links .nav-icons {
    display: flex;
    gap: 10px;
    justify-content: center;
    padding-top: 10px;
  }
}
.nav-icons { display: flex; gap: 8px; align-items: center; }

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--rc-blue-dark) 0%, var(--rc-blue) 50%, var(--rc-teal) 100%);
  color: #fff;
  padding: 80px 24px 100px;
  text-align: center;
  position: relative;
}
.hero::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0; right: 0;
  height: 40px;
  background: var(--bg);
  clip-path: ellipse(75% 100% at 50% 100%);
}
.hero h1 { font-size: clamp(2rem, 1.2rem + 3vw, 3rem); margin: 0 0 14px; font-weight: 800; }
.hero p { font-size: clamp(1rem, .9rem + .5vw, 1.2rem); opacity: .92; max-width: 720px; margin: 0 auto; line-height: 1.8; }

/* Container */
.container {
  max-width: 1200px;
  margin: 32px auto;
  padding: 0 20px;
}

.section-title {
  font-size: 26px;
  margin: 0 0 20px;
  font-weight: 700;
}

/* Search bar */
.search-bar {
  background: var(--surface);
  padding: 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 28px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.search-bar input,
.search-bar select {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
}
.search-bar input:focus,
.search-bar select:focus {
  outline: 2px solid var(--primary);
  border-color: transparent;
}

/* Centers grid */
.centers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.center-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
}
.center-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
}
.center-card .card-img {
  height: 160px;
  background: linear-gradient(135deg, #c5d8ff, #e0eaff);
  background-size: cover;
  background-position: center;
  position: relative;
}
.center-card .verified-badge {
  position: absolute;
  top: 10px;
  inset-inline-start: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 600;
}
.center-card .card-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.center-card h3 { margin: 0 0 6px; font-size: 18px; }
.center-card .city { color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.center-card .desc { font-size: 14px; color: #4b5563; flex: 1; line-height: 1.5; }
.center-card .tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.center-card .tag {
  background: rgba(78,162,74,.10);
  color: var(--primary-dark);
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
}
.center-card .footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}
.center-card .rating {
  color: #f59e0b;
  font-weight: 600;
  font-size: 14px;
}
.center-card .btn-view {
  background: var(--primary);
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  border: none;
  cursor: pointer;
}
.center-card .btn-view:hover { background: var(--primary-dark); }

/* Auth pages */
.auth-wrapper {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0,0,0,.08);
  width: 100%;
  max-width: 420px;
  padding: 32px;
}
.auth-card h2 { margin: 0 0 8px; font-size: 24px; }
.auth-card .subtitle { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.form-group input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
}
.form-group input:focus { outline: 2px solid var(--primary); border-color: transparent; }
.btn-primary {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.auth-footer {
  text-align: center;
  margin-top: 18px;
  font-size: 14px;
  color: var(--muted);
}

.alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 14px;
}
.alert-error { background: #fdecea; color: var(--danger); border: 1px solid #f5c2c0; }
.alert-success { background: #e6f4ea; color: var(--accent); border: 1px solid #b7dfc2; }

/* Center detail page */
.detail-hero {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 24px;
}
.detail-hero .cover {
  height: 240px;
  background: linear-gradient(135deg, var(--primary), #4f8df8);
  background-size: cover;
  background-position: center;
}
.detail-hero .info {
  padding: 24px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.detail-hero h1 { margin: 0 0 6px; font-size: 28px; }
.detail-hero .meta { color: var(--muted); }
.detail-hero .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-action {
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-action.whatsapp { background: #25d366; color: #fff; }
.btn-action.whatsapp:hover { background: #1ea854; color: #fff; }
.btn-action.call { background: var(--primary); color: #fff; }
.btn-action.call:hover { background: var(--primary-dark); color: #fff; }

.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}
@media (max-width: 800px) {
  .detail-grid { grid-template-columns: 1fr; }
}
.detail-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.detail-card h3 { margin: 0 0 14px; font-size: 18px; }
.detail-card ul { margin: 0; padding-inline-start: 22px; line-height: 1.9; }

/* Dashboard */
.dashboard-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 16px;
}

/* Footer */
.footer {
  background: #1f2937;
  color: #9ca3af;
  padding: 24px;
  text-align: center;
  font-size: 14px;
  margin-top: 40px;
}

/* Loading state */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--muted);
}

/* ============== Center detail — extended sections ============== */

/* Stats bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.stat-box {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  text-align: center;
}
.stat-box .num {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  display: block;
}
.stat-box .label {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
}

/* Section heading inside detail */
.detail-section {
  margin: 32px 0;
}
.detail-section h2 {
  font-size: 24px;
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary);
  display: inline-block;
}

/* Departments / services grid */
.dept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.dept-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  border-inline-start: 4px solid var(--primary);
}
.dept-card h4 { margin: 0 0 8px; font-size: 16px; color: var(--primary-dark); }
.dept-card p { margin: 0; color: #4b5563; font-size: 14px; line-height: 1.6; }

/* Team grid */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.team-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  text-align: center;
}
.team-card .avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto 12px;
  background: linear-gradient(135deg, var(--primary), #4f8df8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  background-size: cover;
  background-position: center;
}
.team-card h4 { margin: 0 0 4px; font-size: 16px; }
.team-card .role { color: var(--primary); font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.team-card .bio { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 0; }

/* Working hours */
.hours-table {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hours-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}
.hours-row:last-child { border-bottom: none; }
.hours-row .day { font-weight: 600; }
.hours-row .time { color: var(--muted); }

/* Insurance pills */
.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pill {
  background: rgba(78,162,74,.10);
  color: var(--primary-dark);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
}

/* Testimonials */
.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.testimonial {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  position: relative;
}
.testimonial::before {
  content: "\201C";
  position: absolute;
  top: 6px;
  inset-inline-start: 14px;
  font-size: 48px;
  color: var(--primary);
  opacity: .25;
  line-height: 1;
}
.testimonial p { margin: 0 0 12px; line-height: 1.7; padding-top: 18px; }
.testimonial .author { color: var(--muted); font-size: 13px; font-weight: 600; }

/* Gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.gallery-grid .gallery-item {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #c5d8ff, #e0eaff);
  background-size: cover;
  background-position: center;
}

/* ============== Homepage extras ============== */

/* Hero buttons */
.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
  flex-wrap: wrap;
}
.hero-btn {
  padding: 12px 28px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform .15s, box-shadow .15s;
}
.hero-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.15); }
.hero-btn.primary { background: #fff; color: var(--primary); }
.hero-btn.primary:hover { color: var(--primary-dark); }
.hero-btn.outline {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255,255,255,.7);
}
.hero-btn.outline:hover { background: rgba(255,255,255,.12); color: #fff; }

/* Homepage stats bar */
.home-stats {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin: -40px auto 32px;
  max-width: 1100px;
  position: relative;
  z-index: 5;
}
.home-stats .stat {
  padding: 22px 16px;
  text-align: center;
  border-inline-end: 1px solid var(--border);
}
.home-stats .stat:last-child { border-inline-end: none; }
.home-stats .num {
  display: block;
  font-size: 30px;
  font-weight: 700;
  color: var(--primary);
}
.home-stats .label { color: var(--muted); font-size: 14px; margin-top: 4px; display: block; }

/* About platform section */
.about-section { padding: 30px 0; }
.about-lead {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 32px;
  color: #4b5563;
  font-size: 16px;
  line-height: 1.8;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}
.feature-box {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  text-align: center;
}
.feature-box .icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rc-green) 0%, var(--rc-teal) 100%);
  color: #fff;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}
.feature-box h4 { margin: 0 0 8px; font-size: 16px; }
.feature-box p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }

/* Register form */
.register-section {
  background: linear-gradient(135deg, rgba(78,162,74,.08) 0%, rgba(31,77,110,.05) 100%);
  padding: 50px 20px;
  margin-top: 40px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.register-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  max-width: 720px;
  margin: 0 auto;
}
.register-card h2 { margin: 0 0 8px; font-size: 24px; text-align: center; }
.register-card .subtitle { color: var(--muted); text-align: center; margin: 0 0 24px; }
.register-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.register-grid .full { grid-column: 1 / -1; }
@media (max-width: 600px) {
  .register-grid { grid-template-columns: 1fr; }
}
.register-grid textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  min-height: 80px;
  resize: vertical;
}
.register-grid textarea:focus { outline: 2px solid var(--primary); border-color: transparent; }

/* WhatsApp icon button on cards */
.center-card .btn-wa {
  background: #25d366;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  text-decoration: none;
  margin-inline-end: 8px;
  transition: background .15s;
}
.center-card .btn-wa:hover { background: #1ea854; color: #fff; }
.center-card .actions-row { display: flex; align-items: center; }

/* Coming soon overlay on cards */
.center-card.coming-soon { position: relative; opacity: .9; }
.center-card.coming-soon .card-img {
  background: linear-gradient(135deg, #d1d5db, #f3f4f6) !important;
}
.center-card .coming-badge {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  background: #f59e0b;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: .3px;
}
.center-card.coming-soon .btn-view {
  background: #9ca3af;
  cursor: not-allowed;
  pointer-events: none;
}

/* Section nav (sticky tabs) */
.section-nav {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
  margin-bottom: 24px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  position: sticky;
  top: 70px;
  z-index: 10;
}
.section-nav a {
  padding: 8px 16px;
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s;
}
.section-nav a:hover { background: var(--bg); }
