/* نافذة تفاصيل الطبيب — نطاق معزول بالكامل */
#doctor-details-dialog {
  --doctor-teal: #0BB4AA;
  --doctor-navy: #092A43;
  --doctor-gold: #d9a842;
  --doctor-ink: #173d53;
  --doctor-muted: #607b88;
  --doctor-line: #d9ece9;
  --doctor-pale: #eefafa;
  position: fixed;
  inset: 50% auto auto 50%;
  width: min(840px, calc(100vw - 24px));
  max-height: min(820px, calc(100dvh - 24px));
  margin: 0;
  padding: 0;
  overflow: auto;
  border: 1px solid rgba(11, 180, 170, .19);
  border-radius: 28px;
  background: #fff;
  color: var(--doctor-ink);
  box-shadow: 0 32px 90px rgba(9, 42, 67, .34);
  direction: rtl;
  scrollbar-width: thin;
  scrollbar-color: rgba(11, 180, 170, .68) transparent;
  transform: translate(-50%, -50%);
  isolation: isolate;
}

#doctor-details-dialog::backdrop {
  background: rgba(9, 42, 67, .68);
  backdrop-filter: blur(8px);
}

#doctor-details-dialog:not([open]) {
  display: none;
}

#doctor-details-dialog > .close-button {
  position: sticky;
  top: 14px;
  z-index: 5;
  float: left;
  display: grid;
  width: 42px;
  height: 42px;
  margin: 14px 14px 0 10px;
  padding: 0;
  border: 1px solid rgba(9, 42, 67, .12);
  border-radius: 50%;
  cursor: pointer;
  background: rgba(255, 255, 255, .96);
  color: var(--doctor-navy);
  box-shadow: 0 8px 20px rgba(9, 42, 67, .14);
  font-family: Arial, sans-serif;
  font-size: 28px;
  line-height: 1;
  place-items: center;
  transition: background-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}

#doctor-details-dialog > .close-button:hover {
  background: var(--doctor-navy);
  color: #fff;
  box-shadow: 0 11px 24px rgba(9, 42, 67, .22);
  transform: rotate(4deg);
}

#doctor-details-dialog > .close-button:focus-visible,
#doctor-details-dialog .doctor-profile-book:focus-visible {
  outline: 3px solid rgba(217, 168, 66, .9);
  outline-offset: 3px;
}

#doctor-details-dialog #doctor-details-content {
  clear: both;
  min-width: 0;
}

#doctor-details-dialog .doctor-profile-hero {
  position: relative;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: center;
  gap: 22px;
  min-width: 0;
  padding: 25px clamp(24px, 4vw, 38px) 27px;
  overflow: hidden;
  border-bottom: 1px solid var(--doctor-line);
  background:
    radial-gradient(circle at 10% 14%, rgba(217, 168, 66, .18), transparent 22%),
    radial-gradient(circle at 84% 90%, rgba(11, 180, 170, .16), transparent 35%),
    linear-gradient(135deg, #fff 0%, #f4fcfc 100%);
}

#doctor-details-dialog .doctor-profile-hero::after {
  position: absolute;
  inset: auto -37px -64px auto;
  width: 180px;
  height: 180px;
  border: 1px solid rgba(217, 168, 66, .45);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

#doctor-details-dialog .doctor-profile-avatar {
  position: relative;
  z-index: 1;
  display: grid;
  width: 112px;
  height: 112px;
  overflow: hidden;
  border: 4px solid #fff;
  border-radius: 50%;
  background: linear-gradient(135deg, #d8f2ef, #75cbc5);
  color: var(--doctor-navy);
  box-shadow: 0 0 0 1px rgba(11, 180, 170, .24), 0 13px 29px rgba(9, 42, 67, .16);
  font-size: 38px;
  font-weight: 900;
  line-height: 1;
  place-items: center;
}

/* يتجاوز قاعدة #doctor-details-content img القديمة ويحافظ على صورة مربعة صغيرة. */
#doctor-details-dialog #doctor-details-content .doctor-profile-avatar > img {
  display: block;
  width: 112px;
  height: 112px;
  max-width: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center top;
}

#doctor-details-dialog .doctor-profile-intro {
  position: relative;
  z-index: 1;
  display: grid;
  min-width: 0;
  gap: 3px;
}

#doctor-details-dialog .doctor-profile-eyebrow,
#doctor-details-dialog .doctor-profile-brand {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.5;
}

#doctor-details-dialog .doctor-profile-eyebrow {
  margin-bottom: 4px;
  padding: 5px 10px;
  border: 1px solid rgba(217, 168, 66, .55);
  background: #fff7e7;
  color: var(--doctor-navy);
}

#doctor-details-dialog .doctor-profile-intro h2 {
  overflow-wrap: anywhere;
  color: var(--doctor-navy);
  font-size: clamp(23px, 3.2vw, 31px);
  font-weight: 900;
  line-height: 1.38;
  letter-spacing: -.02em;
}

#doctor-details-dialog .doctor-profile-intro > p {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--doctor-teal);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.7;
}

#doctor-details-dialog .doctor-profile-brand {
  margin-top: 5px;
  color: var(--doctor-muted);
  font-size: 10px;
}

#doctor-details-dialog .doctor-profile-brand::before {
  width: 15px;
  height: 2px;
  margin-inline-end: 6px;
  border-radius: 2px;
  background: var(--doctor-gold);
  content: "";
}

#doctor-details-dialog .doctor-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: clamp(18px, 3.2vw, 30px) clamp(18px, 4vw, 38px);
  background: #fff;
}

#doctor-details-dialog .doctor-profile-section {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--doctor-line);
  border-radius: 18px;
  background: linear-gradient(145deg, #fff, #fbfefe);
  box-shadow: 0 9px 24px rgba(9, 66, 82, .055);
}

#doctor-details-dialog .doctor-profile-section[data-profile-section="experience"] {
  grid-column: 1 / -1;
}

#doctor-details-dialog .doctor-profile-section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-bottom: 12px;
}

#doctor-details-dialog .doctor-profile-icon {
  display: grid;
  flex: 0 0 39px;
  width: 39px;
  height: 39px;
  border-radius: 12px;
  background: var(--doctor-pale);
  color: var(--doctor-teal);
  place-items: center;
}

#doctor-details-dialog .doctor-profile-icon svg {
  display: block;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

#doctor-details-dialog .doctor-profile-section h3 {
  min-width: 0;
  color: var(--doctor-navy);
  font-size: 16px;
  font-weight: 900;
  line-height: 1.55;
}

#doctor-details-dialog .doctor-profile-section h4 {
  margin: 15px 0 7px;
  color: var(--doctor-navy);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.7;
}

#doctor-details-dialog .doctor-profile-section h4:first-of-type {
  margin-top: 0;
}

#doctor-details-dialog .doctor-profile-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

#doctor-details-dialog .doctor-profile-list + .doctor-profile-list {
  margin-top: 8px;
}

#doctor-details-dialog .doctor-profile-list li {
  position: relative;
  min-width: 0;
  padding-inline-start: 19px;
  color: #426372;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

#doctor-details-dialog .doctor-profile-list li::before {
  position: absolute;
  top: .79em;
  inset-inline-start: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--doctor-gold);
  box-shadow: 0 0 0 3px rgba(217, 168, 66, .14);
  content: "";
}

#doctor-details-dialog .doctor-profile-empty {
  margin: 0;
  padding: 11px 12px;
  border-inline-start: 3px solid var(--doctor-gold);
  border-radius: 9px;
  background: #fffaf0;
  color: var(--doctor-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.8;
}

#doctor-details-dialog .doctor-profile-footer {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 23px clamp(18px, 4vw, 38px) 27px;
  border-top: 1px solid var(--doctor-line);
  background: linear-gradient(135deg, #f5fcfc, #fff);
  text-align: center;
}

#doctor-details-dialog .doctor-profile-book {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 520px);
  min-width: 0;
  min-height: 51px;
  gap: 9px;
  padding: 12px 21px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--doctor-teal), var(--doctor-navy));
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.55;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  box-shadow: 0 12px 25px rgba(9, 82, 91, .22);
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}

#doctor-details-dialog .doctor-profile-book:hover {
  color: #fff;
  filter: saturate(1.08);
  box-shadow: 0 17px 31px rgba(9, 66, 82, .28);
  transform: translateY(-2px);
}

#doctor-details-dialog .doctor-profile-book svg {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

#doctor-details-dialog .doctor-profile-footer > p {
  max-width: 590px;
  margin: 0;
  color: var(--doctor-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.8;
}

#doctor-details-dialog::-webkit-scrollbar {
  width: 9px;
}

#doctor-details-dialog::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(11, 180, 170, .58);
  background-clip: padding-box;
}

@media (max-width: 560px) {
  #doctor-details-dialog {
    max-height: calc(100dvh - 24px);
    border-radius: 22px;
  }

  #doctor-details-dialog > .close-button {
    top: 10px;
    width: 38px;
    height: 38px;
    margin: 10px 10px 0 8px;
    font-size: 25px;
  }

  #doctor-details-dialog .doctor-profile-hero {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 14px;
    padding: 19px 18px 21px;
  }

  #doctor-details-dialog .doctor-profile-avatar,
  #doctor-details-dialog #doctor-details-content .doctor-profile-avatar > img {
    width: 88px;
    height: 88px;
  }

  #doctor-details-dialog .doctor-profile-avatar {
    font-size: 31px;
  }

  #doctor-details-dialog .doctor-profile-eyebrow {
    padding: 4px 8px;
    font-size: 10px;
  }

  #doctor-details-dialog .doctor-profile-intro h2 {
    font-size: 21px;
  }

  #doctor-details-dialog .doctor-profile-intro > p {
    font-size: 13px;
  }

  #doctor-details-dialog .doctor-profile-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 16px;
  }

  #doctor-details-dialog .doctor-profile-section,
  #doctor-details-dialog .doctor-profile-section[data-profile-section="experience"] {
    grid-column: auto;
  }

  #doctor-details-dialog .doctor-profile-section {
    padding: 15px;
    border-radius: 15px;
  }

  #doctor-details-dialog .doctor-profile-footer {
    padding: 18px 16px 21px;
  }

  #doctor-details-dialog .doctor-profile-book {
    min-height: 52px;
    padding: 11px 16px;
    font-size: 13px;
  }
}

@media (max-width: 340px) {
  #doctor-details-dialog .doctor-profile-hero {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  #doctor-details-dialog .doctor-profile-intro {
    justify-items: center;
  }

  #doctor-details-dialog .doctor-profile-book {
    border-radius: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #doctor-details-dialog,
  #doctor-details-dialog *,
  #doctor-details-dialog *::before,
  #doctor-details-dialog *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
