/* macOS/iOS-like (Glassmorphism) RTL theme + Sidebar layout */
:root{
  --sidebarW: 292px;
  --text: rgba(17, 24, 39, 0.92);
  --muted: rgba(17, 24, 39, 0.58);
  --hairline: rgba(15, 23, 42, 0.10);
  --glass: rgba(240, 248, 255, .60);         /* more blue */
  --glass-strong: rgba(240, 248, 255, .76);
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.14);
  --shadow2: 0 10px 28px rgba(15, 23, 42, 0.10);
  --accent: #0a84ff;   /* iOS blue */
  --accent2: #34c759;  /* iOS green */
  --danger: #ff3b30;
  --radius: 22px;
  --radius2: 16px;
}

html, body { height: 100%; }
body{
  font-family: system-ui, -apple-system, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 800px at 15% 10%, rgba(10,132,255,.22), transparent 62%),
    radial-gradient(900px 650px at 85% 18%, rgba(52,199,89,.18), transparent 60%),
    radial-gradient(900px 650px at 35% 92%, rgba(175, 82, 222,.12), transparent 62%),
    #f6f7fb;
}

/* Brand (4-letter glass badge) */
.brand{ padding: 12px 12px 8px; }
.brand-link{
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}
.brand-badge{
  width: 54px; height: 54px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 950;
  letter-spacing: .08em;
  font-size: .92rem;
  color: rgba(10, 24, 55, .86);
  background: linear-gradient(135deg, rgba(255,255,255,.78), rgba(240,248,255,.56));
  border: 1px solid rgba(255,255,255,.60);
  box-shadow: 0 18px 40px rgba(15,23,42,.12);
  position: relative;
  overflow: hidden;
  transform: translateZ(0);
  animation: badgeFloat 3.8s ease-in-out infinite;
}
.brand-badge::after{
  content: "";
  position: absolute;
  inset: -40% -60%;
  background: linear-gradient(90deg, transparent, rgba(10,132,255,.18), transparent);
  transform: rotate(18deg) translateX(-60%);
  animation: badgeShimmer 4.2s ease-in-out infinite;
}
.brand-link:hover .brand-badge{
  animation-duration: 2.8s;
  box-shadow: 0 22px 55px rgba(10,132,255,.16), 0 18px 40px rgba(15,23,42,.10);
}
.brand-text{ display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brand-title{
  font-weight: 950;
  font-size: 1.02rem;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-subtitle{
  font-size: .78rem;
  color: var(--muted);
  letter-spacing: .02em;
}
@keyframes badgeFloat{
  0%, 100%{ transform: translateY(0); }
  50%{ transform: translateY(-2px); }
}
@keyframes badgeShimmer{
  0%{ transform: rotate(18deg) translateX(-70%); opacity: .0; }
  20%{ opacity: .9; }
  55%{ opacity: .35; }
  100%{ transform: rotate(18deg) translateX(75%); opacity: .0; }
}

/* Tiles (Dashboard squares) */
.tile-grid{
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}
.tile{
  grid-column: span 4;
  text-align: right;
  border: 1px solid rgba(255,255,255,.55);
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(190%);
  -webkit-backdrop-filter: blur(22px) saturate(190%);
  box-shadow: var(--shadow2);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.tile:hover{
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  background: rgba(235, 246, 255, .68);
}
.tile:active{ transform: translateY(0); }
.tile-head{
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.tile-kicker{
  font-size: .78rem;
  color: var(--muted);
}
.tile-name{
  font-weight: 950;
  font-size: 1.05rem;
  line-height: 1.2;
}
.tile-icon{
  width: 44px; height: 44px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(10,132,255,.12);
  border: 1px solid rgba(10,132,255,.18);
  color: var(--accent);
}
.tile-metrics{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.metric{
  padding: 10px;
  border-radius: 18px;
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(15,23,42,.06);
}
.metric-label{
  font-size: .75rem;
  color: var(--muted);
}
.metric-value{
  font-weight: 950;
  margin-top: 2px;
}
.tile-subtitle{
  margin-top: 12px;
  font-size: .8rem;
  color: var(--muted);
}
.tile-chips{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.chip{
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(10,132,255,.10);
  border: 1px solid rgba(10,132,255,.16);
  color: rgba(17,24,39,.82);
  font-size: .8rem;
}
.chip.muted{
  background: rgba(148,163,184,.18);
  border-color: rgba(148,163,184,.20);
  color: rgba(17,24,39,.65);
}
.tile-footer{
  margin-top: 10px;
  font-size: .78rem;
  color: rgba(10,132,255,.80);
}

/* WhatsApp modal list rows */
.wa-row{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255,255,255,.62);
  border: 1px solid rgba(15,23,42,.08);
}

/* Booking (appointment form) enhancements */
.booking-section{
  border: 1px solid rgba(255,255,255,.55);
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-radius: var(--radius2);
  padding: 12px 14px;
  box-shadow: var(--shadow2);
}
.segmented{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.seg-btn{
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(255,255,255,.55);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: .85rem;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.seg-btn:hover{ transform: translateY(-1px); box-shadow: 0 10px 20px rgba(15,23,42,.08); }
.seg-btn.active{
  background: rgba(10,132,255,.14);
  border-color: rgba(10,132,255,.22);
  color: rgba(10, 24, 55, .92);
}
.patient-search-bar{
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.patient-search-bar input{ flex: 1; min-width: 220px; }
.search-results{
  margin-top: 8px;
  border-radius: 16px;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(255,255,255,.72);
  overflow: hidden;
  box-shadow: var(--shadow2);
}
.search-item{
  display: block;
  width: 100%;
  text-align: right;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(15,23,42,.08);
}
.search-item:last-child{ border-bottom: 0; }
.search-item:hover{ background: rgba(10,132,255,.08); }
.search-item.muted{ cursor: default; color: rgba(17,24,39,.65); }
.patient-selected{ margin-top: 8px; }
.patient-pill{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(10,132,255,.08);
  border: 1px solid rgba(10,132,255,.16);
}

/* Patient card timeline (modal) */
.timeline{ position: relative; padding: 4px 0 4px 8px; }
.timeline::before{
  content: "";
  position: absolute;
  top: 6px; bottom: 6px;
  right: 12px;
  width: 2px;
  background: rgba(10,132,255,.14);
}
.timeline-item{
  position: relative;
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  padding: 8px 0;
}
.timeline-dot{
  width: 12px; height: 12px;
  border-radius: 999px;
  background: rgba(10,132,255,.90);
  border: 3px solid rgba(240,248,255,.95);
  margin-right: 8px;
  margin-top: 6px;
}
.timeline-card{
  border-radius: 16px;
  border: 1px solid rgba(15,23,42,.08);
  background: rgba(255,255,255,.78);
  padding: 10px 12px;
}
.timeline-notes{ white-space: pre-wrap; }
.anim-in{
  animation: slideFade .22s ease both;
}
@keyframes slideFade{
  from{ opacity: 0; transform: translateY(4px); }
  to{ opacity: 1; transform: translateY(0); }
}

@media (max-width: 1199.98px){
  .tile{ grid-column: span 6; }
}
@media (max-width: 767.98px){
  .tile{ grid-column: span 12; }
  .tile-metrics{ grid-template-columns: 1fr; }
}

.app-shell{
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebarW) 1fr;
}

.app-sidebar{
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 16px 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.55), rgba(255,255,255,.35));
  border-inline-end: 1px solid var(--hairline);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  box-shadow: 14px 0 60px rgba(0,0,0,.06);
}

.brand{ padding: 6px 10px 14px; }
.brand-link{
  display: flex; gap: 10px; align-items: center;
  color: var(--text); text-decoration: none;
}
.brand-mark{
  width: 44px; height: 44px; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(10,132,255,.14);
  border: 1px solid rgba(10,132,255,.18);
}
.brand-mark i{ font-size: 1.18rem; color: var(--accent); }
.brand-text{ font-weight: 900; letter-spacing: .2px; line-height: 1.1; }

.sidebar-actions{ padding: 0 10px 12px; }

.sidebar-nav{
  display: grid;
  gap: 6px;
  padding: 6px 8px;
}
.sidebar-nav .nav-item{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  color: rgba(17,24,39,.78);
  text-decoration: none;
  transition: transform .14s ease, background .14s ease, box-shadow .14s ease;
}
.sidebar-nav .nav-item i{ font-size: 1.05rem; opacity: .9; }
.sidebar-nav .nav-item:hover{
  background: rgba(255,255,255,.55);
  box-shadow: 0 10px 22px rgba(15,23,42,.06);
  transform: translateX(-2px);
}
.sidebar-nav .nav-item.active{
  background: rgba(10,132,255,.14);
  border: 1px solid rgba(10,132,255,.18);
  box-shadow: 0 12px 26px rgba(10,132,255,.12);
}

.sidebar-footer{
  position: absolute;
  inset-inline: 14px;
  bottom: 14px;
}

.app-main{
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-topbar{
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,255,255,.55);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid var(--hairline);
}

.app-content{
  padding: 18px 18px 30px;
  animation: fadeIn .22s ease-out;
}
@keyframes fadeIn { from { opacity: .72; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* iOS-like cards + inputs */
.card{
  border: 1px solid rgba(255,255,255,.50);
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover{ transform: translateY(-2px); box-shadow: 0 26px 80px rgba(15,23,42,.16); }

.btn, .form-control, .form-select, .alert, .table{
  border-radius: 16px;
}
.btn{
  border-width: 1px;
  box-shadow: 0 10px 24px rgba(15,23,42,.08);
}
.btn-primary{
  background: var(--accent);
  border-color: rgba(10,132,255,.35);
}
.btn-outline-primary{
  border-color: rgba(10,132,255,.35);
  color: var(--accent);
}
.btn-danger{
  background: var(--danger);
  border-color: rgba(255,59,48,.35);
}
.form-control, .form-select{
  border: 1px solid rgba(15,23,42,.12);
  background: rgba(255,255,255,.72);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.65);
}
.form-control:focus, .form-select:focus{
  border-color: rgba(10,132,255,.45);
  box-shadow: 0 0 0 .22rem rgba(10,132,255,.18);
}

/* iOS-like tables (list style) */
.table{
  --bs-table-bg: transparent;
}
.table thead.table-light{
  --bs-table-bg: rgba(255,255,255,.55);
}
.table > :not(caption) > * > *{
  border-bottom-color: rgba(15,23,42,.10);
}
.table-hover > tbody > tr:hover > *{
  background: rgba(10,132,255,.06);
}

.badge{
  font-weight: 800;
  letter-spacing: .1px;
  border-radius: 999px;
  padding: .45em .7em;
}

.stat-card .icon{
  width: 46px; height: 46px;
  border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(10,132,255,.12);
  color: var(--accent);
}
.stat-card .value{ font-size: 1.55rem; font-weight: 950; }
.stat-card .label{ color: rgba(17,24,39,.60); }

@media (max-width: 991.98px){
  .app-shell{ grid-template-columns: 1fr; }
  .app-sidebar{ display: none; }
  .sidebar-footer{ position: static; }
}

/* Guest pages (login/install) */
.auth-shell{
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.auth-header{
  padding: 14px 16px;
  background: rgba(255,255,255,.55);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid var(--hairline);
}
.auth-content{
  padding: 22px 16px 30px;
  flex: 1;
}

