/* Dorpus — home-screen dashboard (Apps & extensions) */

/* ---- page rhythm when widgets are shown ---- */
.view-chat.is-empty {
  overflow-y: auto;
  justify-content: safe center;
}

.view-chat.is-empty:has(.home-widgets:not([hidden])) {
  justify-content: flex-start;
  padding-top: clamp(28px, 8vh, 88px);
  padding-bottom: 48px;
}

.view-chat.is-empty:has(.home-widgets:not([hidden])) .chat-empty-greeting {
  font-size: clamp(1.4rem, 2.4vw, 1.75rem);
  letter-spacing: -0.02em;
}

.view-chat.is-empty:has(.home-widgets:not([hidden])) .chat-footer {
  padding-top: 1.25rem;
}

.view-chat.is-empty .composer-suggestions {
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.view-chat.is-empty .suggestion-chip {
  padding: 0.38rem 0.8rem;
  font-size: 0.8rem;
  background: #fff;
  color: #3a3a37;
}

/* ---- dashboard section ---- */
.home-widgets {
  max-width: var(--chat-max, 48rem);
  width: 100%;
  margin: 2.25rem auto 0;
  padding: 0 var(--space-4, 1rem);
}

.home-widgets[hidden],
.view-chat:not(.is-empty) .home-widgets {
  display: none;
}

.wg-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 0.15rem 0.75rem;
  margin-bottom: 0.9rem;
  border-bottom: 1px solid var(--border, #e5e5e5);
}

.wg-section-head h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.wg-section-head div > span {
  font-size: 0.8rem;
  color: var(--ink-muted, #6b6b6b);
}

.wg-customize {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 999px;
  background: #fff;
  color: #3a3a37;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.wg-customize:hover {
  background: #f6f6f4;
}

.wg-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1rem;
  align-items: stretch;
}

.wg-empty {
  width: 100%;
  display: grid;
  gap: 0.25rem;
  justify-items: center;
  padding: 1.6rem 1rem;
  border: 1.5px dashed #d8d8d3;
  border-radius: 16px;
  background: #fcfcfb;
  color: var(--ink, #0d0d0d);
  font: inherit;
  cursor: pointer;
}

.wg-empty span {
  font-size: 0.86rem;
  color: var(--ink-muted, #6b6b6b);
}

.wg-empty:hover {
  border-color: #b9b9b4;
}

/* ---- cards ---- */
.wg-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 1rem 1.1rem 1rem;
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.wg-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.wg-head h3 {
  flex: 1;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--ink-muted, #6b6b6b);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.wg-head h3[lang="ur"] {
  text-transform: none;
  font-size: 0.9rem;
}

.wg-icon {
  display: grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 8px;
  background: #f2f2f0;
  color: #3b3a36;
  flex: none;
}

.wg-icon.lg {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 10px;
}

.wg-prayer_times .wg-icon {
  background: #e8f3ee;
  color: #0f6e5b;
}

.wg-today_queue .wg-icon,
.wg-online_requests .wg-icon {
  background: #eef4ff;
  color: #1d4ed8;
}

.wg-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.9rem;
  min-width: 0;
}

.wg-body p {
  margin: 0;
}

.wg-big {
  font-size: 1.2rem;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.wg-eyebrow {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink-muted, #6b6b6b);
}

.wg-muted {
  color: var(--ink-muted, #6b6b6b);
  font-size: 0.82rem;
}

.wg-foot {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: auto !important;
  padding-top: 0.2rem;
  color: var(--ink-muted, #6b6b6b);
  font-size: 0.72rem;
}

.wg-pill {
  flex: none;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: #e8f3ee;
  color: #0f6e5b;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

/* card menu */
.wg-menu-wrap {
  position: relative;
}

.wg-icon-btn {
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-muted, #6b6b6b);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s;
}

.wg-card:hover .wg-icon-btn,
.wg-icon-btn:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  .wg-icon-btn {
    opacity: 1;
  }
}

.wg-icon-btn:hover {
  background: #f2f2f0;
}

.wg-menu {
  position: absolute;
  right: 0;
  top: 1.9rem;
  z-index: 30;
  min-width: 11rem;
  padding: 0.3rem;
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.wg-menu[hidden] {
  display: none;
}

.wg-menu button {
  display: block;
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font: inherit;
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
}

.wg-menu button:hover {
  background: #f2f2f0;
}

/* ---- Weather ---- */
.wg-weather .wg-icon {
  background: #fff4dc;
  color: #b7791f;
}

.wg-weather-now {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.wg-weather-temp {
  font-size: 2.6em;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

.wg-weather-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  line-height: 1.35;
  font-size: 0.9em;
}

.wg-weather-summary,
.wg-weather-city {
  display: block;
}

.wg-weather-meta strong {
  font-size: 1.05em;
}

.wg-wx-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: #b7791f;
}

.wg-wx-icon.lg {
  width: 3rem;
  height: 3rem;
  border-radius: 0.85rem;
  background: #fff6e6;
}

.wg-wx-icon.is-rain,
.wg-wx-icon.is-storm {
  color: #3d6ea8;
}

.wg-wx-icon.is-rain.lg,
.wg-wx-icon.is-storm.lg {
  background: #eef5fb;
}

.wg-wx-icon.is-snow,
.wg-wx-icon.is-fog {
  color: #6b7c90;
}

.wg-wx-icon.is-cloud {
  color: #64748b;
}

.wg-weather-days {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.2rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line, #ececea);
  overflow-x: auto;
  scrollbar-width: thin;
}

.wg-weather-day {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  gap: 0.28rem;
  min-width: 3.6rem;
  padding: 0.2rem 0.15rem;
  font-size: 0.78em;
  text-align: center;
}

.wg-weather-day-name {
  font-weight: 650;
  letter-spacing: 0.01em;
}

.wg-weather-high {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.wg-weather-low {
  color: var(--muted, #6b6b67);
  font-variant-numeric: tabular-nums;
}

.wg-weather-range {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---- Prayer times ---- */
.wg-prayer-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.wg-prayer-next {
  display: grid;
  gap: 0.2rem;
}

.wg-prayer-strip {
  list-style: none;
  margin: 0.1rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.35rem;
}

.wg-prayer-strip li {
  display: grid;
  gap: 0.1rem;
  padding: 0.45rem 0.35rem;
  border-radius: 10px;
  background: #f7f7f5;
  text-align: center;
}

.wg-prayer-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-muted, #6b6b6b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wg-prayer-strip .wg-time {
  font-size: 0.86rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.wg-prayer-strip li.next {
  background: #0f6e5b;
}

.wg-prayer-strip li.next .wg-prayer-name,
.wg-prayer-strip li.next .wg-time {
  color: #fff;
}

.wg-prayer-strip li.muted .wg-time {
  color: var(--ink-muted, #6b6b6b);
  font-weight: 500;
}

/* ---- Hadith / Ayah ---- */
.wg-read-wrap {
  display: grid;
  gap: 0.25rem;
}

.wg-read {
  display: grid;
  gap: 0.5rem;
}

.wg-ar {
  font-family: "Amiri", "Scheherazade New", "Traditional Arabic", "Noto Naskh Arabic", serif;
  font-size: 1.1rem;
  line-height: 1.95;
  text-align: right;
  color: #1d2b26;
}

.wg-quran {
  font-size: 1.3rem;
}

.wg-text {
  line-height: 1.6;
  color: #2b2b28;
}

.wg-read .wg-ar {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.wg-read .wg-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
}

.wg-read.open .wg-ar,
.wg-read.open .wg-text {
  -webkit-line-clamp: unset;
  display: block;
}

.wg-more {
  justify-self: start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-muted, #6b6b6b);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.wg-more:hover {
  color: var(--ink, #0d0d0d);
}

.wg-more[hidden] {
  display: none;
}

.wg-card-foot {
  margin-top: auto;
  padding-top: 0.65rem;
  border-top: 1px solid #f0f0ee;
}

.wg-ref {
  font-size: 0.78rem;
  font-weight: 600;
  color: #4a4a46;
}

.wg-ur,
.wg-ur-small {
  font-family: "Dorpus Nastaliq", "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", serif;
  line-height: 2.1;
}

.wg-ur-small {
  font-size: 0.85rem;
  color: var(--ink-muted, #6b6b6b);
}

.wg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.wg-row.end {
  justify-content: flex-end;
  margin-top: auto;
}

.wg-link {
  border: 0;
  padding: 0;
  background: none;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 650;
  color: #0f6e5b;
  cursor: pointer;
  white-space: nowrap;
}

.wg-link:hover {
  text-decoration: underline;
}

/* ---- clinic widgets ---- */
.wg-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
}

.wg-stats div {
  display: grid;
  padding: 0.45rem 0.5rem;
  border-radius: 10px;
  background: #f7f7f5;
}

.wg-stats strong {
  font-size: 1.15rem;
}

.wg-stats span {
  font-size: 0.7rem;
  color: var(--ink-muted, #6b6b6b);
}

.wg-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.25rem;
}

.wg-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.86rem;
}

.wg-grow {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wg-token {
  min-width: 2.2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---- narrower screens ---- */
@media (max-width: 760px) {
  .view-chat.is-empty:has(.home-widgets:not([hidden])) {
    padding-top: 20px;
  }
  .home-widgets {
    margin-top: 1.5rem;
  }
  .topk-inline span {
    display: none;
  }
  .wg-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .wg-grid > .wg-card {
    grid-column: auto !important;
  }
  .wg-prayer-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Gallery */
.apps-sub {
  margin: 0.15rem 0 0;
}

.apps-body {
  max-height: min(70vh, 44rem);
  overflow-y: auto;
}

.apps-cat {
  margin: 0.4rem 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted, #6b6b6b);
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.apps-tile {
  display: flex;
  flex-direction: column;
  padding: 0.95rem;
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 14px;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.apps-tile:hover {
  border-color: var(--border-strong, #d4d4d4);
}

.apps-tile.on {
  border-color: #b9dccf;
  background: #fbfefd;
}

.apps-tile.focus {
  box-shadow: 0 0 0 2px #0f6e5b;
}

.apps-tile-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.apps-tile-title {
  flex: 1;
  display: grid;
  min-width: 0;
}

.apps-desc {
  flex: 1;
  margin: 0.55rem 0 0.8rem;
  font-size: 0.86rem;
  color: var(--ink-muted, #6b6b6b);
  line-height: 1.5;
}

.apps-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border, #ececec);
}

.apps-actions-gap {
  flex: 1;
}

.apps-added {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #0f6e5b;
}

.apps-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.8rem;
  border: 1px solid var(--border-strong, #d4d4d4);
  border-radius: 999px;
  background: #fff;
  color: var(--ink, #111);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.apps-btn:hover {
  background: var(--accent-soft, #efefef);
}

.apps-btn:focus-visible {
  outline: 2px solid #0f6e5b;
  outline-offset: 2px;
}

.apps-btn-add {
  border-color: #111;
  background: #111;
  color: #fff;
}

.apps-btn-add:hover {
  background: #2a2a2a;
}

.apps-btn-quiet {
  border-color: transparent;
  color: var(--ink-muted, #6b6b6b);
}

.apps-btn-quiet:hover {
  color: #b42318;
  background: #fdf0ef;
}

/* Widget settings window */
.wg-settings-modal {
  z-index: 110; /* above the Apps and extensions window it can open from */
}

.wg-settings-card {
  width: min(30rem, 100%);
}

.wg-settings-head {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  min-width: 0;
}

.wg-settings-head h3 {
  margin: 0;
}

.wg-settings-head .hint {
  margin: 0.2rem 0 0;
  font-size: 0.84rem;
  line-height: 1.45;
}

.wg-settings-modal .wg-settings {
  margin: 0;
  padding: 0;
  border: 0;
  gap: 0.85rem;
}

.wg-settings-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border, #ececec);
}

.wg-settings-foot .hint {
  margin: 0;
  font-size: 0.8rem;
}

.wg-settings {
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border, #e5e5e5);
  display: grid;
  gap: 0.55rem;
}

.wg-settings-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: end;
}

.wg-settings .field {
  display: grid;
  gap: 0.25rem;
  font-size: 0.82rem;
}

.wg-settings select {
  width: 100%;
}

.wg-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.86rem;
}

.wg-settings-modal .wg-settings .hint {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
}

/* Width picker */
.wg-width-field {
  display: grid;
  gap: 0.4rem;
}

.wg-width {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.4rem;
}

.wg-width-opt {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.3rem 0.45rem;
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 10px;
  background: #fff;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink-muted, #6b6b6b);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.wg-width-opt:hover {
  border-color: var(--border-strong, #d4d4d4);
}

.wg-width-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.wg-width-opt:has(input:checked) {
  border-color: #0f6e5b;
  background: #f1f8f5;
  color: #0f6e5b;
}

.wg-width-opt:has(input:focus-visible) {
  outline: 2px solid #0f6e5b;
  outline-offset: 2px;
}

.wg-width-preview {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 2px;
  width: 100%;
  max-width: 3.4rem;
  height: 0.75rem;
}

.wg-width-preview i {
  border-radius: 2px;
  background: #e7e7e7;
}

.wg-width-preview i.on,
.wg-width-preview.is-auto i:nth-child(-n + 3) {
  background: currentColor;
}

.wg-width-preview.is-auto i:nth-child(n + 4) {
  background: repeating-linear-gradient(90deg, currentColor 0 2px, transparent 2px 4px);
  opacity: 0.45;
}

.wg-width-field .hint {
  margin: 0;
  font-size: 0.78rem;
}

@media (max-width: 420px) {
  .wg-width {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Widget contents follow the width the widget was given */
.wg-card {
  container-type: inline-size;
}

@container (max-width: 380px) {
  .wg-prayer-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@container (max-width: 240px) {
  .wg-prayer-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Text size picker */
.wg-font {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.wg-font-sample {
  display: grid;
  place-items: end center;
  height: 1.6rem;
  font-family: var(--font-display, Georgia, serif);
  font-weight: 700;
  line-height: 1;
  color: var(--ink, #111);
}

.wg-width-opt:has(input:checked) .wg-font-sample {
  color: #0f6e5b;
}

@media (max-width: 420px) {
  .wg-font {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
