/* AYUSH speciality picker. 1rem = 10px in this app (html { font-size: 62.5% }). */
:root {
  --cs-primary: var(--bs-primary, #355fd3);
  --cs-primary-rgb: var(--bs-primary-rgb, 53, 95, 211);
  --cs-accent: var(--ayush-orange, #ee9a50);
  --cs-mint-rgb: var(--ayush-mint-rgb, 118, 201, 179);
  --cs-text: var(--bs-black, #161616);       /* app headings */
  --cs-muted: var(--bs-body-color, #525252); /* app body text */
  --cs-border: var(--bs-border-color, #e5e5e5);
  --cs-surface: #fff;
  --cs-soft: var(--bs-light, #ededed);
}

/* ---------- field on the registration form ---------- */
#cs-trigger { padding: 0.4rem 0; }
#cs-trigger:focus-visible { outline: 0.2rem solid var(--cs-primary); outline-offset: 0.4rem; border-radius: 0.6rem; }

.cs-summary {
  border: 0.15rem solid var(--cs-border);
  border-radius: 1rem;
  padding: 1rem 1.2rem 1.2rem;
  text-align: left;
}
.cs-summary__head { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; margin-bottom: 0.8rem; }
.cs-summary__label { font-size: 1.1rem; color: var(--cs-muted); line-height: 1.2; }
.cs-summary__system { font-size: 1.4rem; font-weight: 600; color: var(--cs-text); }
.cs-link {
  background: none; border: 0; padding: 0; cursor: pointer;
  font-size: 1.2rem; font-weight: 500; color: var(--cs-primary);
}
.cs-link:hover { text-decoration: underline; }
.cs-chips { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.cs-chip {
  display: inline-flex; align-items: center; gap: 0.4rem; max-width: 100%;
  background: rgba(var(--cs-primary-rgb), 0.08); color: var(--cs-primary);
  border-radius: 10rem; padding: 0.4rem 0.4rem 0.4rem 1rem; font-size: 1.2rem; line-height: 1.3;
}
.cs-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-chip button {
  flex: none; width: 1.8rem; height: 1.8rem; border: 0; border-radius: 50%; cursor: pointer;
  background: transparent; color: inherit; font-size: 1.4rem; line-height: 1;
}
.cs-chip button { display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.cs-chip button svg { width: 1.2rem; height: 1.2rem; display: block; }
.cs-chip button:hover { background: rgba(var(--cs-primary-rgb), 0.16); }
.cs-chip--add { background: transparent; border: 0.1rem dashed rgba(var(--cs-primary-rgb), 0.5); color: var(--cs-primary); padding: 0.4rem 1rem; cursor: pointer; }

/* ---------- modal ---------- */
.cs-overlay {
  position: fixed; inset: 0; z-index: 1060;
  background: rgba(15, 20, 35, 0.5);
  display: flex; align-items: center; justify-content: center; padding: 1.6rem;
  opacity: 0; transition: opacity 0.18s ease;
}
.cs-overlay.is-open { opacity: 1; }
.cs-dialog {
  width: 100%; max-width: 64rem; max-height: min(72rem, calc(100vh - 3.2rem));
  display: flex; flex-direction: column;
  background: var(--cs-surface); color: var(--cs-text);
  border-radius: 1.6rem; box-shadow: 0 2rem 6rem rgba(0, 0, 0, 0.25);
  transform: translateY(1.2rem); transition: transform 0.18s ease;
  overflow: hidden;
}
.cs-overlay.is-open .cs-dialog { transform: none; }
.cs-system__icon {
  width: 4.4rem; height: 4.4rem; border-radius: 1.2rem; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(var(--cs-mint-rgb), 0.18);
}
.cs-system__icon img { width: 2.6rem; height: 2.6rem; object-fit: contain; }
.cs-system__icon svg { width: 2.4rem; height: 2.4rem; color: var(--cs-accent); }
/* fixed height on step 2 so filtering doesn't make the dialog jump */
.cs-dialog.is-step2 { height: min(72rem, calc(100vh - 3.2rem)); }

.cs-header { padding: 2rem 2.4rem 1.4rem; border-bottom: 0.1rem solid var(--cs-border); }
.cs-header__row { display: flex; align-items: center; gap: 1rem; }
.cs-title { flex: 1; margin: 0; font-size: 1.8rem; font-weight: 600; line-height: 1.3; }
.cs-step { margin: 0.2rem 0 0; font-size: 1.4rem; line-height: 1.4; color: var(--cs-muted); }
.cs-icon-btn {
  flex: none; width: 3.2rem; height: 3.2rem; border-radius: 50%; border: 0; cursor: pointer;
  background: transparent; color: var(--cs-text); font-size: 2rem; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.cs-icon-btn:hover { background: var(--cs-soft); }
.cs-icon-btn svg { width: 1.8rem; height: 1.8rem; display: block; }
.cs-progress { display: flex; gap: 0.6rem; margin-top: 1.4rem; }
.cs-progress i { flex: 1; height: 0.4rem; border-radius: 1rem; background: rgba(var(--cs-mint-rgb), 0.25); }
.cs-progress i.is-on { background: var(--cs-primary); }

.cs-body { padding: 2rem 2.4rem; overflow-y: auto; flex: 1; }

/* step 1: systems */
.cs-systems { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.2rem; }
.cs-system {
  position: relative; text-align: left; cursor: pointer;
  border: 0.15rem solid var(--cs-border); border-radius: 1.2rem; background: var(--cs-surface);
  padding: 1.6rem; min-height: 10rem; display: flex; flex-direction: column; justify-content: space-between; gap: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.cs-system:hover { border-color: rgba(var(--cs-primary-rgb), 0.6); }
.cs-system:focus-visible { outline: none; box-shadow: 0 0 0 0.3rem rgba(var(--cs-primary-rgb), 0.3); }
.cs-system.is-current { border-color: var(--cs-primary); background: rgba(var(--cs-primary-rgb), 0.05); }
.cs-system__name { display: block; font-size: 1.5rem; font-weight: 600; line-height: 1.3; }
.cs-system__meta { display: block; }
.cs-system__meta { font-size: 1.2rem; color: var(--cs-muted); }
.cs-system__badge {
  position: absolute; top: 1rem; right: 1rem; font-size: 1.1rem; font-weight: 600;
  color: #fff; background: var(--cs-primary); border-radius: 10rem; padding: 0.1rem 0.8rem;
}
.cs-note { margin: 1.6rem 0 0; font-size: 1.2rem; color: var(--cs-muted); }

/* step 2: specialities */
.cs-search { position: relative; margin-bottom: 1.6rem; }
.cs-search input {
  width: 100%; font-size: 1.4rem; padding: 1.1rem 1.4rem 1.1rem 4rem;
  border: 0.15rem solid var(--cs-border); border-radius: 1rem; outline: none;
}
.cs-search input:focus { border-color: var(--cs-primary); box-shadow: 0 0 0 0.3rem rgba(var(--cs-primary-rgb), 0.15); }
.cs-search svg { position: absolute; left: 1.4rem; top: 50%; transform: translateY(-50%); width: 1.6rem; height: 1.6rem; color: var(--cs-muted); }

.cs-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.cs-option {
  display: flex; align-items: flex-start; gap: 1rem; cursor: pointer; text-align: left;
  border: 0.15rem solid var(--cs-border); border-radius: 1rem; background: var(--cs-surface);
  padding: 1.2rem 1.4rem; transition: border-color 0.15s, background 0.15s;
}
.cs-option:hover { border-color: rgba(var(--cs-primary-rgb), 0.6); }
.cs-option:focus-visible { outline: none; box-shadow: 0 0 0 0.3rem rgba(var(--cs-primary-rgb), 0.3); }
.cs-option[aria-checked='true'] { border-color: var(--cs-primary); background: rgba(var(--cs-primary-rgb), 0.06); }
.cs-check {
  flex: none; width: 1.8rem; height: 1.8rem; margin-top: 0.1rem; border-radius: 0.5rem;
  border: 0.15rem solid #b9bfcc; display: inline-flex; align-items: center; justify-content: center; color: #fff;
}
.cs-check svg { width: 1.2rem; height: 1.2rem; opacity: 0; }
.cs-option[aria-checked='true'] .cs-check { background: var(--cs-primary); border-color: var(--cs-primary); }
.cs-option[aria-checked='true'] .cs-check svg { opacity: 1; }
.cs-option__text { min-width: 0; }
.cs-option__en { display: block; font-size: 1.4rem; font-weight: 500; line-height: 1.35; color: var(--cs-text); }
.cs-option__rg { display: block; margin-top: 0.2rem; font-size: 1.2rem; font-style: italic; line-height: 1.35; color: var(--cs-muted); }
.cs-option mark { background: rgba(238, 154, 80, 0.3); color: inherit; padding: 0; border-radius: 0.2rem; }

.cs-empty { text-align: center; padding: 3.2rem 1.6rem; color: var(--cs-muted); font-size: 1.4rem; }
.cs-empty strong { display: block; color: var(--cs-text); font-size: 1.5rem; margin-bottom: 0.4rem; }

/* footer
   desktop: one row      [Prev] [count ............] [Clear] [Done]
   phone:   two rows     [count ............ Clear]
                         [Prev] [Done ............]   */
.cs-footer {
  display: flex; align-items: center; gap: 1.2rem; padding: 1.4rem 2.4rem;
  border-top: 0.1rem solid var(--cs-border); background: var(--cs-surface);
  flex: none;
}
.cs-footer__meta, .cs-footer__actions { display: contents; }
.cs-btn--prev { order: 1; }
.cs-footer__count { order: 2; flex: 1; min-width: 0; font-size: 1.3rem; color: var(--cs-muted); white-space: nowrap; }
.cs-footer__count b { color: var(--cs-text); }
.cs-btn--clear { order: 3; }
.cs-btn--done { order: 4; }
.cs-footer--single { justify-content: flex-end; }

.cs-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  white-space: nowrap; flex: none;
  border-radius: 1rem; font-size: 1.4rem; font-weight: 500; line-height: 1.4; padding: 1rem 2.4rem; cursor: pointer;
  border: 0.15rem solid var(--cs-primary); background: var(--cs-primary); color: #fff;
}
.cs-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.cs-btn[hidden] { display: none; }
.cs-btn--ghost { background: transparent; color: var(--cs-primary); }

/* phone: bottom sheet */
@media (max-width: 575.98px) {
  .cs-overlay { align-items: flex-end; padding: 0; }
  .cs-dialog, .cs-dialog.is-step2 { max-width: none; max-height: 92vh; border-radius: 1.6rem 1.6rem 0 0; transform: translateY(100%); }
  .cs-dialog.is-step2 { height: 92vh; }
  .cs-header, .cs-body, .cs-footer { padding-left: 1.6rem; padding-right: 1.6rem; }
  .cs-systems { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cs-options { grid-template-columns: 1fr; }

  /* tighter header on small screens */
  .cs-header { padding-top: 1.6rem; padding-bottom: 1.2rem; }
  .cs-title { font-size: 1.7rem; }
  .cs-progress { margin-top: 1.2rem; }
  .cs-body { padding-top: 1.6rem; padding-bottom: 1.6rem; }
  .cs-system { padding: 1.2rem; min-height: 0; gap: 0.8rem; }

  /* footer stacks into two rows; clears the iPhone home bar */
  .cs-footer {
    flex-direction: column; align-items: stretch; gap: 1rem;
    padding-top: 1.2rem; padding-bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px));
  }
  .cs-footer__meta, .cs-footer__actions { display: flex; align-items: center; gap: 1rem; }
  .cs-footer__count { flex: 1; }
  .cs-btn--clear { border-color: transparent; padding: 0.4rem 0.8rem; font-size: 1.3rem; }
  .cs-btn--prev { padding-left: 1.6rem; padding-right: 1.6rem; }
  .cs-btn--done { flex: 1; }
  .cs-footer--single .cs-footer__actions { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .cs-overlay, .cs-dialog { transition: none; }
}
