/* ─────────────────────────────────────────────────────────────────────────────
   shell.css — app chrome for the restructured IA: the bottom navigation, the
   «اليوم» home view, and the «الخطة» hub segment toggle. Reuses the design tokens
   in style.css (light/dark + Thmanyah type come for free). RTL, mobile-first.
   ───────────────────────────────────────────────────────────────────────────── */

:root {
  --bottomnav-h: 60px;
}

/* Every routed view clears the fixed bottom bar so its last row stays tappable. */
#app {
  padding-bottom: calc(
    var(--bottomnav-h) + 14px + env(safe-area-inset-bottom, 0px)
  );
}

/* ── Bottom navigation ───────────────────────────────────────────────────────*/
.bottomnav {
  position: fixed;
  inset-inline: 0;
  inset-block-end: 0;
  z-index: 70;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  gap: 2px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-top: 1px solid var(--line);
}
.bottomnav-link {
  flex: 1 1 0;
  min-width: 0;
  min-height: var(--bottomnav-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  transition: color 0.15s;
}
.bottomnav-ico {
  display: inline-flex;
  width: 24px;
  height: 24px;
}
.bottomnav-ico svg {
  width: 100%;
  height: 100%;
}
.bottomnav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.bottomnav-link:hover {
  color: var(--ink-2);
}
.bottomnav-link.is-active {
  color: var(--brand);
}
.bottomnav-link.is-active .bottomnav-ico {
  transform: translateY(-1px);
}

/* ── App-level «+ صرفنا» FAB (Phase 3) ───────────────────────────────────────
   The single floating add-expense affordance, present on every route. Pinned
   above the fixed bottom nav (below it in z so they never visually collide) at
   the inline-end corner. Opens a general (no-place) expense (wired in app.js). */
.app-fab {
  position: fixed;
  inset-block-end: calc(
    var(--bottomnav-h) + 16px + env(safe-area-inset-bottom, 0px)
  );
  inset-inline-end: 18px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 13px 18px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  color: #fff;
  background: var(--brand);
  border: none;
  border-radius: 999px;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--brand) 40%, transparent);
  cursor: pointer;
  transition: transform 0.12s;
}
.app-fab:active {
  transform: scale(0.95);
}
.app-fab-ico {
  display: inline-flex;
  width: 18px;
  height: 18px;
}
.app-fab-ico svg {
  width: 100%;
  height: 100%;
}

/* ── «اليوم» home view ───────────────────────────────────────────────────────*/
.view-today {
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: 16px 16px 8px;
}

/* ── «خيط الرحلة» signature thread ───────────────────────────────────────────
   The trip's ordered days as a quiet path, lit up to today. Travelled = teal,
   today = amber (شمس) with a soft halo, ahead = faint. Horizontally scrollable
   so it never forces the page to scroll sideways. */
.thread {
  margin: 2px 0 14px;
  padding: 4px 2px 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.thread::-webkit-scrollbar {
  display: none;
}
.thread-rail {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  min-width: min-content;
}
.thread-city {
  display: grid;
  justify-items: center;
  gap: 6px;
}
.thread-dots {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 2px;
}
/* The connecting thread runs behind the day-dots. */
.thread-dots::before {
  content: "";
  position: absolute;
  inset-inline: 2px;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
  background: var(--line-strong);
  border-radius: 2px;
  z-index: 0;
}
.thread-dot {
  position: relative;
  z-index: 1;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background 0.2s;
}
.thread-dot.is-past {
  background: var(--brand);
}
.thread-dot.is-now {
  width: 12px;
  height: 12px;
  background: var(--sun);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sun) 26%, transparent);
}
.thread-dot.is-future {
  background: color-mix(in srgb, var(--line-strong) 70%, transparent);
}
.thread-city-label {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--muted);
  white-space: nowrap;
}

/* Today's-spend line — a quiet card with an inline «＋ سجّل» quick-log. */
.td-spend {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0 4px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.td-spend-ico {
  display: inline-flex;
  width: 26px;
  height: 26px;
  color: var(--brand);
  flex: none;
}
.td-spend-ico svg {
  width: 100%;
  height: 100%;
}
.td-spend-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-inline-end: auto;
}
.td-spend-total {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
}
.td-spend-sub {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}
.td-spend-log {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  padding: 9px 15px;
  font-size: 0.9rem;
  font-weight: 800;
  color: #fff;
  background: var(--brand);
  border: none;
  border-radius: 999px;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 34%, transparent);
  transition: transform 0.12s;
}
.td-spend-log:active {
  transform: scale(0.95);
}
.td-spend-log-ico {
  display: inline-flex;
  width: 16px;
  height: 16px;
}
.td-spend-log-ico svg {
  width: 100%;
  height: 100%;
}

/* Contextual guide link on the home screen (the guide is also a nav tab). */
.td-guide {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 700;
  color: var(--ink-2);
  transition:
    border-color 0.15s,
    color 0.15s;
}
.td-guide:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}
.td-guide-ico {
  display: inline-flex;
  width: 22px;
  height: 22px;
  color: var(--brand);
  flex: none;
}
.td-guide-ico svg {
  width: 100%;
  height: 100%;
}

/* ── «الخطة» hub segment toggle (Phase 2) ────────────────────────────────────*/
.view-plan {
  max-width: var(--container);
  margin: 0 auto;
}
.plan-seg {
  position: sticky;
  top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  z-index: 30;
  display: flex;
  gap: 6px;
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
}
.plan-seg-btn {
  flex: 1 1 0;
  padding: 11px 12px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition:
    color 0.15s,
    background 0.15s,
    border-color 0.15s;
}
.plan-seg-btn.is-active {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

/* The hub's inner library/calendar drop their own outer max-width so the segment
   toggle owns the page width consistently. */
.view-plan .view-places,
.view-plan .view-plans {
  padding-top: 4px;
}

/* ── «أضِف للمكان ليوم» day picker (library→calendar binding, Phase 2) ────────*/
.pl-addday-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  text-align: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.pl-addday-row:hover {
  border-color: var(--brand);
}
.pl-addday-row.is-added {
  opacity: 0.55;
}
.pl-addday-day {
  font-weight: 800;
  color: var(--ink);
}
.pl-addday-sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin-inline-start: auto;
}
.pl-addday-new {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px dashed var(--line-strong);
}
.pl-addday-new input[type="date"] {
  flex: 1 1 auto;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.pl-addday-new-btn {
  padding: 10px 16px;
  font-weight: 800;
  color: #fff;
  background: var(--brand);
  border: none;
  border-radius: 999px;
}

/* «أضيفي ليوم» button on a place card (sits with the card's foot actions). */
.pl-addday {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand) 28%, transparent);
  border-radius: 999px;
}
.pl-addday-ico {
  display: inline-flex;
  width: 15px;
  height: 15px;
}
.pl-addday-ico svg {
  width: 100%;
  height: 100%;
}
