/* ===================================================================
 * Workmate4u — Mobile UX Enhancement Layer
 * Loaded AFTER styles.css. Purely additive: introduces design tokens,
 * refined card system, skeletons, mobile sheets, dark-mode polish,
 * larger tap targets, AA contrast fixes, and pull-to-refresh visuals.
 *
 * Nothing here removes existing styles — it only adds opt-in classes
 * and tightens a handful of specific selectors that previously caused
 * cramped/over-padded mobile rendering.
 * =================================================================== */

/* ----------- 1. DESIGN TOKENS (8-pt scale, color, card, motion) ---- */
:root {
  /* Spacing scale (8-pt) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-7: 28px; --s-8: 32px;
  --s-10: 40px; --s-12: 48px;

  /* Radius scale */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px; --r-pill: 999px;

  /* Brand scale */
  --brand-50:#eef4ff;  --brand-100:#dbe6ff; --brand-200:#b9cdff;
  --brand-500:#3b6dff; --brand-600:#2952e8; --brand-700:#1f3fbf;

  /* Semantic */
  --c-success:#16a34a; --c-warn:#f59e0b; --c-danger:#dc2626; --c-info:#0ea5e9;

  /* Surfaces */
  --bg:           #ffffff;
  --bg-soft:      #f7f8fb;
  --surface:      #ffffff;
  --surface-alt:  #f1f3f8;
  --border:       #e6e8ec;
  --border-soft:  #eef0f3;

  /* Text (AA-compliant on white) */
  --text:         #0f172a;
  --text-muted:   #475569;
  --text-faint:   #64748b;

  /* Card system */
  --card-pad:     14px;
  --card-radius:  var(--r-lg);
  --card-shadow:  0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --card-shadow-hover: 0 6px 20px rgba(15,23,42,.08), 0 2px 6px rgba(15,23,42,.05);
  --card-border:  1px solid var(--border-soft);

  /* Motion */
  --t-fast: 150ms cubic-bezier(.2,.8,.2,1);
  --t-base: 220ms cubic-bezier(.2,.8,.2,1);
  --t-slow: 360ms cubic-bezier(.2,.8,.2,1);

  /* Z-index */
  --z-tabbar: 999;
  --z-sticky: 50;
  --z-modal: 1000;
  --z-toast: 1100;
}

/* Dark-mode token overrides */
[data-theme="dark"] {
  --bg:          #0b1020;
  --bg-soft:     #0f1530;
  --surface:     #141a33;
  --surface-alt: #1a2140;
  --border:      #23284a;
  --border-soft: #1d2342;

  --text:        #e7eaf2;
  --text-muted:  #b3bccf;
  --text-faint:  #8a93ad;

  --card-shadow: 0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --card-shadow-hover: 0 8px 24px rgba(0,0,0,.5), 0 2px 8px rgba(0,0,0,.35);
  --card-border: 1px solid var(--border);
}

/* ----------- 2. GLOBAL POLISH (safe, non-destructive) -------------- */
* { -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, video, svg { max-width: 100%; height: auto; }
button, [role="button"], a.btn { touch-action: manipulation; }

/* iOS overscroll bounce on body fixes — but allow within scroll containers */
html, body { overscroll-behavior-y: contain; }

/* Modal backdrop: glassy blur (premium feel) */
.modal.active {
  -webkit-backdrop-filter: blur(6px) saturate(140%);
          backdrop-filter: blur(6px) saturate(140%);
  background: rgba(15, 23, 42, 0.4);
}
[data-theme="dark"] .modal.active {
  background: rgba(0, 0, 0, 0.6);
}

/* Make scrollbars subtle on desktop */
@media (min-width: 769px) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
  ::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }
}

/* ----------- 3. CARD SYSTEM (use .uicard for new cards) ------------ */
.uicard {
  background: var(--surface);
  border-radius: var(--card-radius);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: var(--card-pad);
  transition: box-shadow var(--t-base), transform var(--t-base);
}
.uicard:active { transform: scale(.99); }
.uicard.is-tappable:hover { box-shadow: var(--card-shadow-hover); }

/* Tighten existing cards on small screens to fix over-padding */
@media (max-width: 480px) {
  .task-card, .my-task-card, .feature-card, .testimonial-card,
  .profile-card, .wallet-card, .stat-card, .dashboard-nav-card {
    padding: 14px !important;
    border-radius: var(--r-lg) !important;
  }
  .container { padding-left: 16px; padding-right: 16px; }
  /* Tighten section vertical padding on phones */
  section, .section { padding-top: 28px !important; padding-bottom: 28px !important; }
}

/* ----------- 4. TYPOGRAPHY (AA contrast + tighter mobile sizes) ---- */
@media (max-width: 480px) {
  h1 { font-size: 26px; line-height: 1.2; }
  h2 { font-size: 22px; line-height: 1.25; }
  h3 { font-size: 18px; line-height: 1.3; }
  body, p { font-size: 15px; line-height: 1.5; }
  .small, small, .caption { font-size: 13px; }
}
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }

/* ----------- 5. SKELETON LOADERS ----------------------------------- */
.skel {
  display: block;
  background: linear-gradient(90deg,
    var(--surface-alt) 25%, var(--border-soft) 37%, var(--surface-alt) 63%);
  background-size: 400% 100%;
  animation: skel-shimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
  height: 14px;
}
.skel.skel-line  { height: 12px; margin: 6px 0; }
.skel.skel-title { height: 18px; width: 60%; margin: 8px 0; }
.skel.skel-block { height: 80px; }
.skel.skel-circle{ width: 44px; height: 44px; border-radius: 50%; }
.skel-row { display:flex; gap: 12px; align-items:center; }
.skel-card {
  padding: var(--card-pad);
  background: var(--surface);
  border: var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
}
@keyframes skel-shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; }
}

/* ----------- 6. EMPTY STATES --------------------------------------- */
.empty-state-v2 {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state-v2 .empty-icon {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--surface-alt);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.empty-state-v2 .empty-icon i {
  font-size: 32px; color: var(--text-faint);
}
.empty-state-v2 h3 { margin: 0 0 6px; font-size: 18px; color: var(--text); }
.empty-state-v2 p  { margin: 0 0 16px; font-size: 14px; }
.empty-state-v2 .btn { min-height: 44px; }

/* ----------- 7. MOBILE SHEET (full-screen modal pattern) ----------- */
@media (max-width: 768px) {
  .modal.modal-sheet > .modal-content,
  .modal.modal-fullscreen > .modal-content {
    position: fixed;
    inset: 0;
    width: 100% !important;
    max-width: 100% !important;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0 !important;
    border-radius: 0 !important;
    transform: translateY(0) !important;
    overflow-y: auto;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
  /* Sticky sheet header */
  .modal-sheet .sheet-header,
  .modal-fullscreen .sheet-header {
    position: sticky; top: 0; z-index: 5;
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border-soft);
  }
  .sheet-header .sheet-back {
    width: 40px; height: 40px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface-alt); border: 0; color: var(--text);
    font-size: 16px;
  }
  .sheet-header .sheet-title { font-size: 17px; font-weight: 600; flex: 1; margin: 0; }
  /* Sticky sheet bottom CTA */
  .sheet-cta {
    position: sticky; bottom: 0; z-index: 4;
    padding: 12px 16px max(12px, env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--border-soft);
  }
  .sheet-cta .btn { width: 100%; min-height: 48px; font-size: 16px; }
}

/* ----------- 8. STICKY HEADER + BACK BUTTON (per-page) ------------- */
.app-header {
  position: sticky; top: 0; z-index: var(--z-sticky);
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
          backdrop-filter: blur(10px) saturate(140%);
}
.app-header .app-back {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-alt); color: var(--text);
  text-decoration: none; border: 0; font-size: 16px; cursor: pointer;
}
.app-header .app-back:active { transform: scale(.92); }
.app-header h1, .app-header .app-title {
  font-size: 17px; font-weight: 600; margin: 0; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-header .app-action {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--text); border: 0;
}

/* ----------- 9. TOUCH TARGETS (≥44px) ------------------------------ */
@media (max-width: 768px) {
  .btn, .btn-sm, button.btn-icon, .icon-btn,
  .nav-links a, .bottom-tab-bar a {
    min-height: 44px;
  }
  .btn-icon, .icon-btn {
    min-width: 44px;
  }
  /* Form fields easier to tap */
  input[type="text"], input[type="email"], input[type="tel"],
  input[type="number"], input[type="password"], select, textarea {
    min-height: 44px;
    font-size: 16px; /* prevents iOS zoom */
  }
}

/* ----------- 10. PULL-TO-REFRESH visuals --------------------------- */
.ptr-spinner {
  position: fixed;
  top: 0; left: 50%;
  transform: translate(-50%, -120%);
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(15,23,42,.18);
  display: flex; align-items: center; justify-content: center;
  color: var(--brand-500);
  z-index: var(--z-toast);
  transition: transform var(--t-base);
}
.ptr-spinner.is-pulling { transform: translate(-50%, 12px); }
.ptr-spinner.is-refreshing { transform: translate(-50%, 12px); }
.ptr-spinner.is-refreshing i { animation: ptr-spin 0.8s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }

/* ----------- 11. BOTTOM TAB BAR (refinements) ---------------------- */
[data-theme="dark"] .bottom-tab-bar {
  background: rgba(20, 26, 51, 0.92);
  box-shadow: 0 -1px 20px rgba(0,0,0,.3), 0 -1px 0 rgba(255,255,255,.05);
}
.bottom-tab-bar a span {
  font-weight: 600; letter-spacing: .02em;
}
@media (max-width: 360px) {
  .bottom-tab-bar a { padding: 4px 8px; font-size: 9.5px; }
  .bottom-tab-bar a i { font-size: 18px; }
}
/* Press feedback on tab items */
.bottom-tab-bar a:active:not(.tab-post-btn) { transform: scale(.94); }

/* ----------- 12. THEME TOGGLE WIDGET ------------------------------- */
.theme-toggle {
  display: inline-flex;
  background: var(--surface-alt);
  border-radius: var(--r-pill);
  padding: 4px;
  gap: 2px;
}
.theme-toggle button {
  border: 0; background: transparent; cursor: pointer;
  padding: 8px 14px; border-radius: var(--r-pill);
  color: var(--text-muted); font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px;
}
.theme-toggle button.is-active {
  background: var(--surface); color: var(--text);
  box-shadow: 0 1px 3px rgba(15,23,42,.08);
}
[data-theme="dark"] .theme-toggle button.is-active {
  background: var(--brand-600); color: #fff;
}

/* ----------- 13. QUICK-ACTION PILLS (Zomato-style row) ------------- */
.quick-actions {
  display: flex; gap: 10px;
  overflow-x: auto;
  padding: 4px 16px 12px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.quick-actions::-webkit-scrollbar { display: none; }
.quick-actions a {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-pill);
  color: var(--text);
  text-decoration: none;
  font-size: 13px; font-weight: 600;
  scroll-snap-align: start;
  min-height: 40px;
  box-shadow: var(--card-shadow);
}
.quick-actions a i { color: var(--brand-500); font-size: 14px; }
.quick-actions a:active { transform: scale(.97); }

/* ----------- 14. GREETING STRIP ------------------------------------ */
.greeting-strip {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: var(--surface);
}
.greeting-strip .hi {
  display: flex; flex-direction: column; gap: 2px;
}
.greeting-strip .hi b { font-size: 16px; color: var(--text); }
.greeting-strip .hi small { color: var(--text-muted); font-size: 12px; }
.greeting-strip .wallet-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: var(--brand-50);
  color: var(--brand-700);
  border-radius: var(--r-pill);
  font-weight: 700;
  text-decoration: none;
  font-size: 14px;
  min-height: 40px;
}
[data-theme="dark"] .greeting-strip .wallet-pill {
  background: rgba(59,109,255,.12); color: var(--brand-200);
}

/* ----------- 15. HORIZONTAL SCROLL CARD ROW ------------------------ */
.h-scroll {
  display: flex; gap: 12px;
  overflow-x: auto; padding: 4px 16px 16px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.h-scroll::-webkit-scrollbar { display: none; }
.h-scroll > * {
  flex: 0 0 78%;
  scroll-snap-align: start;
}
@media (min-width: 480px) {
  .h-scroll > * { flex: 0 0 60%; }
}
@media (min-width: 768px) {
  .h-scroll > * { flex: 0 0 40%; }
}

/* ----------- 16. SAFE-AREA HELPERS --------------------------------- */
.safe-top    { padding-top:    max(12px, env(safe-area-inset-top)); }
.safe-bottom { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.safe-x      { padding-left: max(16px, env(safe-area-inset-left));
               padding-right:max(16px, env(safe-area-inset-right)); }

/* ----------- 17. UTILITY CLASSES (lightweight) --------------------- */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--s-1); }  .gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }  .gap-4 { gap: var(--s-4); }
.mt-1 { margin-top: var(--s-1); }   .mt-2 { margin-top: var(--s-2); }
.mt-3 { margin-top: var(--s-3); }   .mt-4 { margin-top: var(--s-4); }
.mb-1 { margin-bottom: var(--s-1); }.mb-2 { margin-bottom: var(--s-2); }
.mb-3 { margin-bottom: var(--s-3); }.mb-4 { margin-bottom: var(--s-4); }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.hide-on-mobile { }
@media (max-width: 768px) { .hide-on-mobile { display: none !important; } }
.show-on-mobile { display: none !important; }
@media (max-width: 768px) { .show-on-mobile { display: initial !important; } }

/* ----------- 18. FORM INTERACTION POLISH --------------------------- */
input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}
input:invalid:not(:placeholder-shown) {
  border-color: var(--c-danger) !important;
}

/* ----------- 19. PERFORMANCE: reduce motion respect ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ----------- 20. FAB Z-FIX over tab bar ---------------------------- */
.bottom-tab-bar { z-index: var(--z-tabbar); }

/* ----------- 21. NOTIFICATION DRAWER POLISH ------------------------ */
@media (max-width: 768px) {
  .notification-list .notification-item {
    border-radius: var(--r-md);
    padding: 14px;
  }
}

/* ----------- 22. RIPPLE-LIKE PRESS ON BUTTONS ---------------------- */
.btn:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ===================================================================
 * 23. FIND-TASKS-NEAR-YOU SECTION  (index.html)
 *
 * Existing layout breaks on mobile: filter sidebar has 25px padding,
 * stacks above a 400px-tall map, budget inputs use invisible
 * --light border, map controls clip into Leaflet attribution.
 * Restyles to a clean, mobile-first card layout.
 * =================================================================== */

/* --- Section background respects theme --- */
.find-tasks { background: var(--bg); }
[data-theme="dark"] .find-tasks { background: var(--bg); }

/* --- Wrapper: better proportions desktop, stack cleanly on mobile --- */
.tasks-wrapper {
  gap: 24px;
}
@media (min-width: 769px) {
  .tasks-wrapper {
    grid-template-columns: 320px 1fr;
    height: 560px;
  }
}

/* --- Filter card: refined surface, theme-aware --- */
.tasks-filter {
  background: var(--surface);
  padding: 20px;
  border-radius: var(--card-radius);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
}
[data-theme="dark"] .tasks-filter {
  background: var(--surface);
  border: 1px solid var(--border);
}

.filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-soft);
}
.filter-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.filter-header h3 i { color: var(--brand-500); margin-right: 8px; }

.clear-filters {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-600);
  padding: 6px 10px;
  border-radius: var(--r-pill);
  transition: background var(--t-fast);
  min-height: 32px;
}
.clear-filters:hover { background: var(--brand-50); }
[data-theme="dark"] .clear-filters:hover { background: rgba(59,109,255,.12); }

.filter-group { margin-bottom: 16px; }
.filter-group:last-of-type { margin-bottom: 18px; }
.filter-group > label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .01em;
}

.filter-group select {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 14px;
  min-height: 44px;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.filter-group select:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(59,109,255,.18);
  outline: none;
}

/* Range slider — bigger thumb, branded fill */
.filter-group input[type="range"] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, var(--brand-500) 0%, var(--brand-500) 50%, var(--border) 50%, var(--border) 100%);
  border-radius: 999px;
  cursor: pointer;
  margin: 6px 0 4px;
}
.filter-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px; height: 22px;
  background: #fff;
  border: 3px solid var(--brand-500);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.filter-group input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px;
  background: #fff;
  border: 3px solid var(--brand-500);
  border-radius: 50%;
  cursor: pointer;
}

.range-value {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 10px;
  background: var(--brand-50);
  color: var(--brand-700);
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
}
[data-theme="dark"] .range-value {
  background: rgba(59,109,255,.14);
  color: var(--brand-200);
}

/* Budget inputs — visible borders, proper alignment */
.budget-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}
.budget-inputs input {
  flex: 1; min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  min-height: 44px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.budget-inputs input:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(59,109,255,.18);
  outline: none;
}
.budget-inputs span {
  color: var(--text-faint);
  font-weight: 600;
  flex-shrink: 0;
}

/* Apply button: full width, branded, large */
.tasks-filter .btn-block {
  width: 100%;
  min-height: 48px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--r-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* --- Map card --- */
.tasks-map {
  border-radius: var(--card-radius);
  overflow: hidden;
  position: relative;
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  background: var(--surface-alt);
  min-height: 320px;
}

/* Map control buttons — refined, themed */
.map-controls {
  position: absolute;
  right: 12px;
  bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
}
.map-btn {
  width: 42px; height: 42px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15,23,42,.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: transform var(--t-fast), background var(--t-fast), color var(--t-fast);
}
.map-btn:hover { background: var(--brand-500); color: #fff; border-color: var(--brand-500); }
.map-btn:active { transform: scale(.92); }
.map-btn.active { background: var(--c-success); color: #fff; border-color: var(--c-success); }

/* Tracking status pill */
.tracking-status {
  position: absolute;
  top: 12px; left: 12px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  padding: 8px 14px;
  border-radius: var(--r-pill);
  box-shadow: 0 2px 8px rgba(15,23,42,.1);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  z-index: 1000;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}
.tracking-status strong { color: var(--text); font-weight: 700; }

/* Task list grid below */
.tasks-list-fullwidth {
  display: grid;
  gap: 14px;
  margin-top: 24px;
  padding: 0;
  grid-template-columns: 1fr;
}
@media (min-width: 480px) {
  .tasks-list-fullwidth {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 768px) {
  .tasks-list-fullwidth {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

/* Distance info chip near map */
.distance-info {
  position: absolute;
  bottom: 12px; left: 12px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  padding: 6px 12px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(15,23,42,.1);
  z-index: 1000;
}
.distance-info:empty { display: none; }

/* --- MOBILE TIGHTENING --- */
@media (max-width: 768px) {
  .tasks-wrapper {
    grid-template-columns: 1fr;
    gap: 16px;
    height: auto;
  }
  .tasks-filter { padding: 16px; }
  .filter-header { margin-bottom: 14px; padding-bottom: 12px; }
  .filter-group { margin-bottom: 14px; }
  /* Map: viewport-relative, never too tall */
  .tasks-map {
    height: clamp(280px, 50vh, 420px);
  }
  /* Tracking pill compact on phone */
  .tracking-status {
    top: 10px; left: 10px; right: 10px;
    padding: 6px 10px;
    font-size: 11px;
    justify-content: center;
  }
  .map-controls {
    right: 10px;
    bottom: 32px;
  }
  .map-btn { width: 40px; height: 40px; border-radius: 10px; }
  .tasks-list-fullwidth { gap: 12px; margin-top: 20px; }
}

/* Section header polish */
.find-tasks .section-header { margin-bottom: 28px; }
.find-tasks .section-header h2 {
  font-size: clamp(24px, 4vw, 36px);
  margin-bottom: 8px;
}
.find-tasks .section-header p {
  color: var(--text-muted);
  font-size: 15px;
  margin: 0;
}

/* Empty list state for #tasksList when no nearby tasks */
.tasks-list-fullwidth:empty::before {
  content: 'Loading nearby tasks...';
  display: block;
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-faint);
  font-size: 14px;
}



/* ===================================================================
 * 24. WATCH TUTORIAL CTA (replaces old How It Works section)
 * =================================================================== */
.watch-tutorial { padding: clamp(48px, 8vw, 80px) 0; }
.tutorial-cta {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 20px;
  padding: clamp(28px, 5vw, 48px) clamp(20px, 4vw, 40px);
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.06);
  position: relative;
  overflow: hidden;
}
.tutorial-cta::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at top right, rgba(108, 92, 231, .08), transparent 60%);
  pointer-events: none;
}
.tutorial-cta-icon {
  width: 72px; height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  box-shadow: 0 12px 28px rgba(108, 92, 231, 0.35);
}
.tutorial-cta .section-badge { display: inline-block; margin-bottom: 12px; }
.tutorial-cta h2 { font-size: clamp(1.5rem, 4vw, 2rem); margin-bottom: 12px; }
.tutorial-cta p {
  color: var(--text-muted, #64748b);
  max-width: 460px; margin: 0 auto 24px;
  font-size: clamp(0.95rem, 2.2vw, 1.05rem);
  line-height: 1.6;
}
.tutorial-cta-btn {
  display: inline-flex !important; align-items: center; gap: 10px;
  padding: 14px 32px !important;
  font-size: 1rem !important;
  border-radius: 12px !important;
}
.tutorial-cta-btn i { font-size: 0.9em; }
@media (max-width: 480px) {
  .tutorial-cta { padding: 28px 18px; border-radius: 16px; }
  .tutorial-cta-icon { width: 60px; height: 60px; font-size: 26px; }
}

/* ===================================================================
 * 25. POPULAR CATEGORIES • collapsible toggle
 * =================================================================== */
.categories-toggle-wrap {
  display: flex;
  justify-content: center;
  margin: 24px 0 8px;
}
.categories-toggle-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 12px;
  padding: 14px 28px !important;
  font-size: 1rem !important;
  border-radius: 12px !important;
  min-height: 48px;
}
.categories-toggle-btn .toggle-chevron {
  transition: transform 0.25s ease;
  font-size: 0.85em;
}
.categories-toggle-btn.open .toggle-chevron {
  transform: rotate(180deg);
}
.categories-grid.collapsed {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}
.categories-grid {
  transition: opacity 0.35s ease, transform 0.35s ease;
  margin-top: 24px;
}
/* Make category-card behave like a link without underline */
.categories-grid a.category-card {
  text-decoration: none;
  color: inherit;
  display: block;
  cursor: pointer;
}
.categories-grid a.category-card:hover {
  text-decoration: none;
}
@media (max-width: 480px) {
  .categories-toggle-btn { width: 100%; justify-content: center; }
}

/* ===================================================================
 * 26. CATEGORIES CTA BUTTON (replaces in-page toggle)
 * =================================================================== */
.categories-cta-wrap {
  display: flex;
  justify-content: center;
  margin: 32px 0 8px;
}
.categories-cta-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 12px;
  padding: 16px 32px !important;
  font-size: 1.05rem !important;
  border-radius: 14px !important;
  min-height: 52px;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(99, 102, 241, 0.28);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.categories-cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.38);
}
.categories-cta-btn i:last-child { transition: transform 0.2s ease; }
.categories-cta-btn:hover i:last-child { transform: translateX(4px); }
@media (max-width: 480px) {
  .categories-cta-btn { width: 100%; justify-content: center; padding: 14px 20px !important; }
}
/* ===================================================================
 * 27. DESKTOP POLISH - modals, toasts, spacing
 * Loaded after styles.css. Pure visual layer; no JS/structural changes.
 * =================================================================== */

/* ---- 27a. Tighten oversized desktop section spacing ---- */
@media (min-width: 769px) {
  section { padding: 64px 0 !important; }
  .hero { padding: 96px 20px 56px !important; min-height: auto !important; }
  .footer { padding: 56px 0 24px !important; }
  /* Reduce gap between consecutive sections */
  section + section { padding-top: 48px !important; }
  /* Section header less bottom margin */
  .section-header { margin-bottom: 36px !important; }
}

/* ---- 27b. Modal polish (desktop) ---- */
@media (min-width: 769px) {
  .modal { padding: 32px !important; }
  .modal-content {
    padding: 32px !important;
    border-radius: 18px !important;
    max-width: 480px;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18), 0 6px 18px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(15, 23, 42, 0.06);
  }
  .modal-large { max-width: 640px !important; }
  .modal-content h2 {
    font-size: 1.5rem !important;
    margin-bottom: 18px !important;
    padding-right: 48px;
  }
  .modal-close {
    top: 14px !important;
    right: 14px !important;
    width: 36px !important;
    height: 36px !important;
    background: rgba(15, 23, 42, 0.06) !important;
    transition: background 160ms ease, transform 160ms ease, color 160ms ease;
  }
  .modal-close:hover {
    background: var(--danger, #dc2626) !important;
    color: #fff !important;
    transform: rotate(90deg);
  }
  .modal-footer {
    margin-top: 20px !important;
    padding-top: 16px !important;
  }
}
/* Dark-mode modal */
[data-theme="dark"] .modal-content {
  background: var(--surface, #141a33) !important;
  border-color: var(--border, #23284a) !important;
  color: var(--text, #e7eaf2);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), 0 6px 18px rgba(0, 0, 0, 0.35) !important;
}
[data-theme="dark"] .modal-close {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text, #e7eaf2) !important;
}

/* ---- 27c. Toast notification polish (all viewports) ---- */
.toast {
  bottom: 24px !important;
  right: 24px !important;
  padding: 14px 22px !important;
  border-radius: 14px !important;
  font-size: 0.95rem !important;
  font-weight: 500;
  max-width: min(420px, calc(100vw - 32px));
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%) !important;
  color: #fff !important;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.28), 0 4px 12px rgba(15, 23, 42, 0.16) !important;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transform: translateX(calc(100% + 32px)) !important;
  transition: transform 280ms cubic-bezier(.2,.8,.2,1), opacity 220ms ease !important;
  opacity: 0;
  line-height: 1.45;
  word-break: break-word;
}
.toast.show {
  transform: translateX(0) !important;
  opacity: 1;
}
.toast i {
  font-size: 1.15rem !important;
  flex-shrink: 0;
  color: #34d399 !important;
}
/* Variant tints (auto-detect via emoji prefix isn't reliable; rely on class if added later) */
.toast.success { background: linear-gradient(135deg, #047857 0%, #10b981 100%) !important; }
.toast.success i { color: #ecfdf5 !important; }
.toast.error,
.toast.danger { background: linear-gradient(135deg, #991b1b 0%, #ef4444 100%) !important; }
.toast.error i,
.toast.danger i { color: #fee2e2 !important; }
.toast.warning { background: linear-gradient(135deg, #92400e 0%, #f59e0b 100%) !important; }
.toast.warning i { color: #fffbeb !important; }
.toast.info { background: linear-gradient(135deg, #075985 0%, #0ea5e9 100%) !important; }
.toast.info i { color: #e0f2fe !important; }
@media (max-width: 480px) {
  .toast {
    bottom: 88px !important; /* clear bottom tab bar */
    right: 12px !important;
    left: 12px !important;
    max-width: none;
    transform: translateY(calc(100% + 100px)) !important;
  }
  .toast.show { transform: translateY(0) !important; }
}

/* ---- 27d. Reduce empty space in CTA / tutorial / categories sections on desktop ---- */
@media (min-width: 769px) {
  .tutorial-cta,
  .categories-cta-wrap {
    margin-top: 8px;
    margin-bottom: 8px;
  }
  .tutorial-cta { padding: 40px 32px !important; }
}

/* ---- 27e. Reduce gap below hero on desktop ---- */
@media (min-width: 769px) {
  .hero + section { padding-top: 56px !important; }
}

/* ---- 27f. Notification dropdown polish (desktop) ---- */
@media (min-width: 769px) {
  .notification-dropdown {
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.08) !important;
    border-radius: 14px !important;
  }
}
/* ===================================================================
 * 28. FIND TASKS - aligned grid next to filter box (home page)
 * =================================================================== */
/* Allow wrapper to size to content (was fixed 500px) when list is inside */
.find-tasks .tasks-wrapper {
  height: auto !important;
  align-items: start;
}
/* The list now sits in the right column of the 350px 1fr grid */
.tasks-list-aligned {
  margin-top: 0 !important;
  align-self: start;
}
@media (min-width: 769px) {
  .tasks-list-aligned {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
  }
  .tasks-list-aligned .task-card { margin-bottom: 0; }
  .tasks-list-aligned .view-all-tasks-wrap {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    margin-top: 8px;
  }
  .tasks-list-aligned .empty-state { grid-column: 1 / -1; }
}
@media (min-width: 1100px) {
  .tasks-list-aligned { grid-template-columns: repeat(3, 1fr) !important; }
}
/* On small screens the sidebar already stacks above; keep single column */
@media (max-width: 768px) {
  .tasks-list-aligned {
    grid-template-columns: 1fr !important;
    margin-top: 16px !important;
  }
}
/* ===================================================================
 * 29. TASK CARD GRID BREATHING ROOM
 * =================================================================== */
.tasks-list-fullwidth { gap: 24px !important; }
.tasks-list-aligned   { gap: 24px !important; }
@media (min-width: 769px) {
  .tasks-list-aligned { gap: 28px !important; row-gap: 32px !important; }
}
@media (max-width: 768px) {
  .tasks-list-fullwidth,
  .tasks-list-aligned { gap: 18px !important; }
}
/* Slight inner padding lift for cards so content doesn't feel cramped */
.tasks-list-fullwidth .task-card,
.tasks-list-aligned   .task-card {
  padding: 20px !important;
}
@media (max-width: 480px) {
  .tasks-list-fullwidth .task-card,
  .tasks-list-aligned   .task-card { padding: 16px !important; }
}
/* ===================================================================
 * 30. HOME FILTER-ONLY LAYOUT (no task list on home)
 * =================================================================== */
.find-tasks-home .home-filter-only {
  display: block !important;
  height: auto !important;
}
.find-tasks-home .home-filter-only > .tasks-sidebar {
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}
.find-tasks-home .tasks-filter {
  padding: 28px !important;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}
.find-tasks-home .home-filter-hint {
  margin: 14px 0 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted, #64748b);
}
@media (max-width: 480px) {
  .find-tasks-home .tasks-filter { padding: 20px !important; }
}

/* ===================================================================
 * 31. AI RECOMMENDED SECTION - mobile-safe responsive
 * =================================================================== */
.ai-recommended-section {
  padding-bottom: 24px;
}
.ai-recommended-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.ai-recommended-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #1e293b;
}
[data-theme="dark"] .ai-recommended-header h3 { color: #e7eaf2; }
.ai-recommended-badge {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  letter-spacing: .5px;
}
.ai-recommended-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 16px;
}
@media (max-width: 768px) {
  .ai-recommended-section { margin-top: 20px; }
  .ai-recommended-grid {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }
}
/* Clear bottom tab bar on mobile so the section is fully visible */
@media (max-width: 768px) {
  .ai-recommended-section { padding-bottom: 96px; }
}
/* ===================================================================
 * 32. ALTERNATING SECTION BACKGROUNDS + GENEROUS SPACING (home page)
 * Subtle stripe pattern so users see when a new section begins.
 * =================================================================== */
/* Pull section spacing tokens; section padding raised slightly */
@media (min-width: 769px) {
  .find-tasks,
  .how-it-works,
  .watch-tutorial,
  .my-tasks,
  .upload-task,
  .categories,
  .testimonials,
  .faq-section,
  .tutorial-cta {
    padding-top: 72px !important;
    padding-bottom: 72px !important;
  }
}
@media (max-width: 768px) {
  .find-tasks,
  .how-it-works,
  .watch-tutorial,
  .my-tasks,
  .upload-task,
  .categories,
  .testimonials,
  .faq-section,
  .tutorial-cta {
    padding-top: 48px !important;
    padding-bottom: 48px !important;
  }
}

/* Default surface for every section (light mode) */
.find-tasks,
.how-it-works,
.watch-tutorial,
.my-tasks,
.upload-task,
.categories,
.testimonials,
.faq-section,
.tutorial-cta {
  background: #ffffff !important;
  position: relative;
}

/* Alternating soft tint - gradient stripes for visual rhythm */
.how-it-works,
.watch-tutorial   { background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%) !important; }

.my-tasks         { background: #ffffff !important; }

.upload-task      { background: linear-gradient(180deg, #eef4ff 0%, #f5f3ff 100%) !important; }

.find-tasks       { background: #ffffff !important; }

.categories       { background: linear-gradient(180deg, #fefce8 0%, #fff7ed 100%) !important; }

.testimonials     { background: #ffffff !important; }

.faq-section      { background: linear-gradient(180deg, #f0f9ff 0%, #ecfeff 100%) !important; }

/* Soft divider between sections - very subtle line */
.find-tasks::before,
.how-it-works::before,
.watch-tutorial::before,
.my-tasks::before,
.upload-task::before,
.categories::before,
.testimonials::before,
.faq-section::before {
  content: "";
  position: absolute;
  top: 0; left: 50%;
  width: 80px; height: 4px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.35), transparent);
  border-radius: 2px;
}
/* Hide top divider on the very first section after hero (clean transition) */
.hero + section::before { display: none; }

/* Dark mode - replace tints with slightly different surface shades */
[data-theme="dark"] .find-tasks,
[data-theme="dark"] .my-tasks,
[data-theme="dark"] .testimonials {
  background: #0b1020 !important;
}
[data-theme="dark"] .how-it-works,
[data-theme="dark"] .watch-tutorial { background: #0f1530 !important; }
[data-theme="dark"] .upload-task    { background: #141a33 !important; }
[data-theme="dark"] .categories     { background: #131a30 !important; }
[data-theme="dark"] .faq-section    { background: #0f1530 !important; }
[data-theme="dark"] .tutorial-cta   { background: var(--surface) !important; border-color: var(--border) !important; }
[data-theme="dark"] .tutorial-cta h2,
[data-theme="dark"] .tutorial-cta h2 *:not(.gradient-text) { color: var(--text) !important; }
[data-theme="dark"] .tutorial-cta p { color: var(--text-muted) !important; }
[data-theme="dark"] .find-tasks::before,
[data-theme="dark"] .how-it-works::before,
[data-theme="dark"] .watch-tutorial::before,
[data-theme="dark"] .my-tasks::before,
[data-theme="dark"] .upload-task::before,
[data-theme="dark"] .categories::before,
[data-theme="dark"] .testimonials::before,
[data-theme="dark"] .faq-section::before {
  background: linear-gradient(90deg, transparent, rgba(139, 134, 245, 0.35), transparent);
}

/* Override the inline padding on the FAQ section (home) */
.faq-section[style] { padding-top: 72px !important; padding-bottom: 72px !important; }
@media (max-width: 768px) {
  .faq-section[style] { padding-top: 48px !important; padding-bottom: 48px !important; }
}
/* ===================================================================
 * 33. REVIEWS - "COMING SOON" LAUNCH CARD (replaces fake testimonials)
 * =================================================================== */
.reviews-launch-card {
  max-width: 720px;
  margin: 0 auto;
  background: #ffffff;
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 20px;
  padding: 48px 40px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.06);
  position: relative;
  overflow: hidden;
}
.reviews-launch-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(600px 200px at 50% -10%, rgba(99,102,241,0.10), transparent 60%);
  pointer-events: none;
}
.reviews-launch-icon {
  width: 72px; height: 72px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  box-shadow: 0 10px 24px rgba(99, 102, 241, 0.30);
}
.reviews-launch-card h3 {
  font-size: 1.5rem;
  margin: 0 0 10px;
  color: #0f172a;
}
.reviews-launch-card > p {
  color: #475569;
  margin: 0 auto 22px;
  max-width: 560px;
  line-height: 1.6;
}
.reviews-launch-list {
  list-style: none;
  padding: 0;
  margin: 0 auto 26px;
  max-width: 520px;
  text-align: left;
  display: grid;
  gap: 10px;
}
.reviews-launch-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #1e293b;
  font-size: 0.97rem;
  line-height: 1.5;
}
.reviews-launch-list i {
  color: #10b981;
  margin-top: 3px;
  flex-shrink: 0;
}
.reviews-launch-cta { margin-top: 8px; }
.reviews-launch-cta .btn { padding: 12px 28px; }

@media (max-width: 600px) {
  .reviews-launch-card { padding: 32px 22px; border-radius: 16px; }
  .reviews-launch-icon { width: 60px; height: 60px; font-size: 24px; }
  .reviews-launch-card h3 { font-size: 1.25rem; }
}

/* Dark mode */
[data-theme="dark"] .reviews-launch-card {
  background: #131a30;
  border-color: rgba(139, 134, 245, 0.25);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
[data-theme="dark"] .reviews-launch-card h3 { color: #f1f5f9; }
[data-theme="dark"] .reviews-launch-card > p { color: #cbd5e1; }
[data-theme="dark"] .reviews-launch-list li { color: #e2e8f0; }