/* ----- Design tokens (Sajda system) ----- */
:root {
  color-scheme: light;
  --bg: #f3f1ed;                   /* warm cream page background */
  --surface: #ffffff;
  --surface-muted: #eeeae3;
  --surface-subtle: #e8e2d8;
  --text: #222222;                 /* app-raisin-black */
  --text-dim: #4a4f52;
  --text-mute: #6f777a;            /* app-sonic-silver */
  --separator: #ecebe8;
  --separator-strong: #d6d2c9;
  --accent: #11a575;               /* app-green */
  --accent-soft: rgba(17, 165, 117, 0.12);
  --accent-press: #0f9569;         /* app-green-pressed */
  --info: #166dc5;                 /* app-navi-blue */
  --danger: #e0443c;
  --shadow-card: 0 1px 2px rgba(20, 20, 20, 0.025), 0 12px 28px rgba(20, 20, 20, 0.04);
  --shadow-soft: 0 1px 2px rgba(20, 20, 20, 0.04);
  --radius-xl: 20px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ----- Reset / base ----- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

ul, li, h1, h2, h3, p { margin: 0; padding: 0; }
ul { list-style: none; }

/* ----- Layout ----- */
.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 20px calc(48px + var(--safe-bottom));
}

/* ----- Header ----- */
.header {
  padding: 4px 2px 0;
}

.header__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.header__title {
  font-size: clamp(26px, 5vw, 32px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header__subtitle {
  margin-top: 4px;
  font-size: 15px;
  color: var(--text-mute);
}

/* Header right-side actions */
.header__actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Share button (pill, matches .lang__btn) */
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 34px;
  background: var(--surface);
  border: 1px solid var(--separator);
  border-radius: 999px;
  color: var(--text);
  box-shadow: var(--shadow-soft);
  transition: transform 0.1s ease, background 0.15s ease;
}
.share-btn:hover { background: var(--surface-muted); }
.share-btn:active { transform: scale(0.97); }
.share-btn svg { display: block; }

/* Language picker */
.lang { position: relative; }

.lang__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  background: var(--surface);
  border: 1px solid var(--separator);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  box-shadow: var(--shadow-soft);
  transition: transform 0.1s ease, background 0.15s ease;
}
.lang__btn:hover { background: var(--surface-muted); }
.lang__btn:active { transform: scale(0.97); }
.lang__flag { font-size: 16px; line-height: 1; }
.lang__caret { color: var(--text-mute); }

.lang__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--separator);
  border-radius: var(--radius-lg);
  padding: 6px;
  min-width: 168px;
  box-shadow: var(--shadow-card);
  z-index: 30;
}
.lang__menu li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease;
}
.lang__menu li:hover { background: var(--surface-muted); }
.lang__menu li.is-active { color: var(--accent-press); font-weight: 700; }
.lang__menu li.is-active::after {
  content: "✓";
  margin-left: auto;
  font-weight: 700;
}

/* Phases (segmented) */
.phases {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 6px;
  gap: 4px;
}
@media (min-width: 600px) {
  .phases { grid-template-columns: repeat(4, 1fr); }
}

.phases__btn {
  min-height: 40px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-mute);
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.phases__btn:hover { background: var(--surface-muted); }
.phases__btn.is-active {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(17, 165, 117, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.08);
}
.phases__btn.is-active:hover { background: var(--accent); }

/* Progress */
.progress {
  margin-top: 14px;
  background: var(--surface);
  padding: 14px 16px;
  border-radius: 16px;
  box-shadow: var(--shadow-card);
}
.progress__bar {
  height: 6px;
  background: var(--surface-muted);
  border-radius: 999px;
  overflow: hidden;
}
.progress__fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.progress__text {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-mute);
}

/* Chips */
.chips {
  margin: 14px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 0;
}

.chip {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--separator);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  box-shadow: var(--shadow-soft);
  transition: transform 0.1s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.chip:hover { background: var(--surface-muted); }
.chip:active { transform: scale(0.97); }
.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(17, 165, 117, 0.25);
}

/* List */
.list {
  margin-top: 14px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--separator);
  transition: background 0.15s ease;
  cursor: pointer;
  user-select: none;
}
.item:last-child { border-bottom: none; }
.item:hover { background: var(--surface-muted); }
.item:active { background: var(--surface-subtle); }

.item__check {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 1.6px solid var(--separator-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  transition: background 0.15s ease, border-color 0.15s ease;
  background: transparent;
}
.item__check svg { opacity: 0; transition: opacity 0.15s ease; }

.item.is-done .item__check {
  background: var(--accent);
  border-color: var(--accent);
}
.item.is-done:hover .item__check { background: var(--accent-press); border-color: var(--accent-press); }
.item.is-done .item__check svg { opacity: 1; }

.item__body { flex: 1 1 auto; min-width: 0; }
.item__task {
  font-size: 15px;
  line-height: 1.4;
  font-weight: 500;
  color: var(--text);
  word-wrap: break-word;
  transition: color 0.2s ease;
}
.item__emoji {
  display: inline-block;
  margin-left: 6px;
  font-size: 16px;
  line-height: 1;
  vertical-align: -2px;
}
.item.is-done .item__task {
  color: var(--text-mute);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  text-decoration-color: var(--text-mute);
}
.item.is-done .item__emoji {
  filter: grayscale(1);
  opacity: 0.55;
}

.item__meta {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--text-dim);
  border: 1px solid var(--separator);
}
.tag--cat {
  background: var(--accent-soft);
  color: var(--accent-press);
  border-color: transparent;
}
.tag--ccy {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--surface-muted);
  color: var(--text-mute);
  border-color: transparent;
}

.item__info {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-mute);
  background: var(--surface-muted);
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease;
}
.item__info:hover {
  background: var(--accent);
  color: #fff;
}
.item__info svg { width: 16px; height: 16px; }

.empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
}

/* Inline notice (e.g. on-Hajj schedule disclaimer) */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 18px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--separator);
  color: var(--accent-press);
}
.notice__icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}
.notice__text {
  font-size: 13px;
  line-height: 1.45;
  font-weight: 500;
  color: var(--accent-press);
}

/* Reset button */
.reset {
  margin: 22px auto 0;
  display: block;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--separator);
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
  box-shadow: var(--shadow-card);
  transition: transform 0.1s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.reset:hover { border-color: var(--danger); }
.reset:active {
  transform: scale(0.97);
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

/* Footer */
.footer {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--separator);
  text-align: center;
}
.footer__caption {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-mute);
  margin-bottom: 14px;
}
.footer__logos {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  color: var(--text);
}
.footer__logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  transition: opacity 0.15s ease;
}
.footer__logo:hover { opacity: 0.75; }
.footer__logo img { width: 42px; height: 42px; display: block; }
.footer__logo--noor img {
  width: 90px;
  height: 44px;
  object-fit: contain;
  object-position: center;
}
.footer__logo--noor span { display: none; }
.footer__sep {
  color: var(--text-mute);
  font-size: 14px;
  font-weight: 400;
}

/* ----- Modal ----- */
.modal[hidden] { display: none; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease;
}
.modal__sheet {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  padding: 14px 22px calc(26px + var(--safe-bottom));
  animation: slideUp 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@media (min-width: 600px) {
  .modal { align-items: center; }
  .modal__sheet {
    border: 1px solid var(--separator);
    border-radius: var(--radius-xl);
    margin: 16px;
    animation: scaleIn 0.2s cubic-bezier(0.2, 0.7, 0.2, 1);
  }
}
.modal__handle {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--separator);
  margin: 0 auto 14px;
}
@media (min-width: 600px) { .modal__handle { display: none; } }

.modal__title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 10px;
}
.modal__body {
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-dim);
}
.modal__close {
  margin-top: 20px;
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-lg);
  font-weight: 600;
  font-size: 15px;
  transition: background 0.15s ease, transform 0.1s ease;
}
.modal__close:hover { background: var(--accent-press); }
.modal__close:active {
  background: var(--accent-press);
  transform: scale(0.99);
}

/* Share modal actions */
.share-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}
.share-action {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: var(--surface-muted);
  border: 1px solid var(--separator);
  border-radius: var(--radius-lg);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  transition: background 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
}
.share-action:hover { background: var(--surface-subtle); }
.share-action:active { transform: scale(0.99); }
.share-action__icon {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}
.share-action--whatsapp .share-action__icon { color: #25d366; }
.share-action--telegram .share-action__icon { color: #2aabee; }
.share-action--copy .share-action__icon { color: var(--text-mute); }
.share-action.is-copied {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-press);
}
.share-action.is-copied .share-action__icon { color: var(--accent-press); }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes scaleIn {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@media (max-width: 380px) {
  .page { padding: 16px 14px calc(40px + var(--safe-bottom)); }
  .header__title { font-size: 24px; }
  .item { padding: 14px 16px; }
  .item__task { font-size: 15px; }
}
