/* ==========================================================================
   فهرست کارها — تم شیشه‌ای (Glassmorphism)
   ========================================================================== */

@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-Variable-font-face.css');

:root {
  /* ---- پالت پایه (روشن) ---- */
  --bg-1: #eef1fb;
  --bg-2: #dbe6ff;
  --bg-3: #f1e6ff;
  --accent-a: #7c5cff;   /* بنفش */
  --accent-b: #38d6d6;   /* فیروزه‌ای */
  --accent-c: #ff7ab8;   /* صورتی، برای هشدار/اولویت */
  --ink: #1c1f37;
  --ink-soft: #565b7d;
  --glass-bg: rgba(255, 255, 255, 0.45);
  --glass-bg-strong: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(255, 255, 255, 0.6);
  --glass-shadow: 0 8px 32px rgba(76, 68, 140, 0.16);
  --star-on: #ffb545;
  --star-off: rgba(28, 31, 55, 0.18);
  --danger: #ff5c7a;
  --success: #2fd18f;
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font-display: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
}

[data-theme='dark'] {
  --bg-1: #0d0e1c;
  --bg-2: #171a35;
  --bg-3: #1c1440;
  --accent-a: #9b8cff;
  --accent-b: #3fe8e8;
  --accent-c: #ff8ac2;
  --ink: #eef0ff;
  --ink-soft: #a7acd6;
  --glass-bg: rgba(30, 32, 60, 0.45);
  --glass-bg-strong: rgba(35, 38, 70, 0.65);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --star-on: #ffc369;
  --star-off: rgba(238, 240, 255, 0.16);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-display);
  color: var(--ink);
  direction: rtl;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 10%, var(--bg-3) 0%, transparent 45%),
    radial-gradient(circle at 85% 0%, var(--bg-2) 0%, transparent 50%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2) 60%, var(--bg-3));
  background-attachment: fixed;
  transition: background 0.4s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* بلوب‌های نور پس‌زمینه برای عمق شیشه‌ای */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  z-index: 0;
  pointer-events: none;
  animation: float 18s ease-in-out infinite;
}
.orb-1 { width: 340px; height: 340px; background: var(--accent-a); top: -80px; right: -60px; }
.orb-2 { width: 280px; height: 280px; background: var(--accent-b); bottom: -60px; left: -60px; animation-delay: -6s; }
.orb-3 { width: 220px; height: 220px; background: var(--accent-c); top: 40%; left: 30%; animation-delay: -12s; opacity: 0.3; }

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(20px, -30px) scale(1.08); }
}

/* ---------- کارت شیشه‌ای پایه ---------- */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
}

/* ==========================================================================
   صفحه احراز هویت
   ========================================================================== */
.auth-screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 34px 28px;
  text-align: center;
}

.auth-logo {
  width: 62px;
  height: 62px;
  margin: 0 auto 14px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(124, 92, 255, 0.35);
}
.auth-logo svg { width: 30px; height: 30px; }

.auth-card h1 { font-size: 22px; margin: 0 0 4px; }
.auth-card p.sub { color: var(--ink-soft); font-size: 13.5px; margin: 0 0 24px; }

.tabs {
  display: flex;
  background: rgba(120, 120, 160, 0.12);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 22px;
}
.tabs button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 6px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: 0.25s;
}
.tabs button.active {
  background: var(--glass-bg-strong);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.auth-panel { display: none; text-align: right; }
.auth-panel.active { display: block; animation: fadeUp 0.3s ease; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.method-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.method-chip {
  flex: 1;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.15);
  color: var(--ink-soft);
  font-size: 12.5px;
  cursor: pointer;
  text-align: center;
}
.method-chip.active {
  border-color: var(--accent-a);
  color: var(--accent-a);
  background: rgba(124, 92, 255, 0.12);
  font-weight: 600;
}

.field-label {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-bottom: 6px;
  display: block;
}

input[type="text"], input[type="password"], input[type="number"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.35);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: 0.2s;
}
[data-theme='dark'] input[type="text"],
[data-theme='dark'] input[type="password"],
[data-theme='dark'] input[type="number"] {
  background: rgba(255,255,255,0.06);
}
input:focus { border-color: var(--accent-a); box-shadow: 0 0 0 3px rgba(124,92,255,0.18); }

.secret-box {
  background: rgba(124, 92, 255, 0.1);
  border: 1px dashed var(--accent-a);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 13px;
  line-height: 2;
  word-break: break-all;
  margin: 10px 0 16px;
  position: relative;
}
.word-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 10px 0 16px;
}
.word-chip {
  background: rgba(56, 214, 214, 0.12);
  border: 1px solid rgba(56, 214, 214, 0.35);
  border-radius: 8px;
  padding: 6px 4px;
  font-size: 12px;
  text-align: center;
}
.word-chip b { color: var(--accent-b); margin-left: 4px; font-weight: 700; }

.warn-box {
  font-size: 11.5px;
  color: var(--danger);
  background: rgba(255, 92, 122, 0.1);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 14px;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  width: 100%;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  box-shadow: 0 8px 22px rgba(124, 92, 255, 0.35);
}
.btn-ghost {
  background: rgba(120,120,160,0.12);
  color: var(--ink);
  width: 100%;
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--ink);
}
.btn-danger { background: rgba(255,92,122,0.15); color: var(--danger); }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn-icon { padding: 9px; border-radius: 12px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.auth-switch { margin-top: 16px; font-size: 12.5px; color: var(--ink-soft); }
.auth-switch a { color: var(--accent-a); cursor: pointer; font-weight: 600; }

.theme-fab {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 5;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--glass-shadow);
}
.theme-fab svg { width: 20px; height: 20px; }

/* ==========================================================================
   اپ اصلی
   ========================================================================== */
.app-shell { position: relative; z-index: 1; max-width: 900px; margin: 0 auto; padding: 16px 16px 100px; min-height: 100vh; }
.hidden { display: none !important; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  margin-bottom: 16px;
}
.topbar .greeting { font-size: 13px; color: var(--ink-soft); margin: 0 0 2px; }
.topbar .date-shamsi { font-size: 19px; font-weight: 700; margin: 0; }
.topbar .date-shamsi span { color: var(--accent-a); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.avatar-btn {
  width: 40px; height: 40px; border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-a), var(--accent-c));
  border: none; cursor: pointer; color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn {
  width: 40px; height: 40px; border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.2);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
[data-theme='dark'] .icon-btn { background: rgba(255,255,255,0.05); }
.icon-btn svg { width: 18px; height: 18px; }

/* روزهای هفته */
.week-strip { display: flex; gap: 8px; overflow-x: auto; padding: 6px 2px 16px; margin-bottom: 6px; scrollbar-width: none; }
.week-strip::-webkit-scrollbar { display: none; }
.day-pill {
  flex: 0 0 auto;
  width: 76px;
  padding: 12px 8px;
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  transition: 0.2s;
  position: relative;
}
.day-pill .dname { font-size: 12px; color: var(--ink-soft); display: block; margin-bottom: 6px; }
.day-pill .dnum { font-size: 16px; font-weight: 700; display: block; margin-bottom: 8px; }
.day-pill.active { border-color: var(--accent-a); box-shadow: 0 8px 20px rgba(124,92,255,0.25); }
.day-pill.active .dname { color: var(--accent-a); font-weight: 600; }
.day-pill.today { outline: 2px solid var(--accent-b); outline-offset: 2px; }
.ring-wrap { position: relative; width: 34px; height: 34px; margin: 0 auto; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-wrap .ring-bg { fill: none; stroke: var(--star-off); stroke-width: 3.5; }
.ring-wrap .ring-fg { fill: none; stroke-width: 3.5; stroke-linecap: round; transition: stroke-dashoffset 0.5s ease; }
.ring-wrap .ring-txt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; }

/* نوار ابزار: فیلتر دسته + مرتب سازی */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.chip-scroll { display: flex; gap: 8px; overflow-x: auto; flex: 1; scrollbar-width: none; padding: 2px; }
.chip-scroll::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.cat-chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.cat-chip.active { background: var(--glass-bg-strong); border-color: var(--accent-a); font-weight: 700; color: var(--accent-a); }

.sort-select {
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--ink);
  cursor: pointer;
}

.edit-toggle-row { display: flex; justify-content: flex-end; margin-bottom: 8px; }

/* ---------- کارت وظیفه ---------- */
.day-remaining {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.day-remaining b { color: var(--accent-a); font-size: 15px; }

.task-list { display: flex; flex-direction: column; gap: 12px; }
.category-group { margin-bottom: 22px; }
.category-group-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; color: var(--ink-soft);
  margin: 0 0 10px 0; padding: 0 4px;
}
.category-group-title .dot { width: 9px; height: 9px; border-radius: 50%; }

.task-card {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: default;
  transition: transform 0.18s, box-shadow 0.18s, opacity 0.18s;
}
.task-card.dragging { opacity: 0.4; }
.task-card.drag-over { box-shadow: 0 0 0 2px var(--accent-a) inset; }
.task-card[draggable="true"] { cursor: grab; }
.task-card.done { opacity: 0.55; }
.task-card.done .task-title { text-decoration: line-through; }

.drag-handle { color: var(--ink-soft); padding-top: 4px; cursor: grab; touch-action: none; }
.drag-handle svg { width: 16px; height: 16px; }

.check-btn {
  flex: 0 0 auto;
  width: 26px; height: 26px; border-radius: 9px;
  border: 2px solid var(--glass-border);
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  margin-top: 2px;
  transition: 0.2s;
}
.check-btn.checked { background: linear-gradient(135deg, var(--accent-b), var(--success)); border-color: transparent; }
.check-btn svg { width: 14px; height: 14px; opacity: 0; transition: 0.2s; stroke: #fff; }
.check-btn.checked svg { opacity: 1; }

.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 14.5px; font-weight: 600; margin: 0 0 6px; word-break: break-word; }
.task-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 11.5px; color: var(--ink-soft); }
.meta-pill { display: flex; align-items: center; gap: 4px; background: rgba(120,120,160,0.12); border-radius: 999px; padding: 3px 9px; }
.meta-pill svg { width: 11px; height: 11px; }
.stars-mini { display: flex; gap: 1px; }
.stars-mini svg { width: 11px; height: 11px; }
.days-mini { display: flex; gap: 3px; }
.day-dot { width: 16px; height: 16px; border-radius: 5px; font-size: 8.5px; display: flex; align-items: center; justify-content: center; background: rgba(120,120,160,0.15); color: var(--ink-soft); }
.day-dot.on { background: var(--accent-a); color: #fff; }

.task-actions { display: flex; flex-direction: column; gap: 6px; }
.task-actions button { background: transparent; border: none; cursor: pointer; color: var(--ink-soft); padding: 4px; border-radius: 8px; }
.task-actions button:hover { color: var(--accent-a); background: rgba(124,92,255,0.1); }
.task-actions svg { width: 15px; height: 15px; }

.empty-state { text-align: center; padding: 50px 20px; color: var(--ink-soft); }
.empty-state svg { width: 54px; height: 54px; opacity: 0.4; margin-bottom: 10px; }
.empty-state p { font-size: 13px; margin: 0; }

/* ---------- ناوبری پایین ---------- */
.bottom-nav {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  gap: 4px;
  padding: 8px;
  border-radius: 22px;
  width: min(92%, 420px);
}
.bottom-nav button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 4px;
  border-radius: 16px;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10px;
  font-family: inherit;
}
.bottom-nav button svg { width: 19px; height: 19px; }
.bottom-nav button.active { background: var(--glass-bg-strong); color: var(--accent-a); font-weight: 700; }

.fab-add {
  position: fixed;
  bottom: 78px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  width: 56px; height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  box-shadow: 0 10px 26px rgba(124, 92, 255, 0.45);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s;
}
.fab-add:active { transform: translateX(-50%) scale(0.92); }
.fab-add svg { width: 24px; height: 24px; stroke: #fff; }

/* ---------- صفحات دیگر (دسته‌بندی/تنظیمات) ---------- */
.page-section { padding: 4px 4px 20px; }
.section-title { font-size: 16px; font-weight: 700; margin: 6px 4px 14px; }

.cat-manage-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius-md); margin-bottom: 10px;
}
.cat-manage-row .dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.cat-manage-row .name { flex: 1; font-size: 13.5px; font-weight: 600; }
.cat-manage-row .count { font-size: 11px; color: var(--ink-soft); }

.color-swatches { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 16px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.swatch.active { border-color: var(--ink); transform: scale(1.15); }

.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-radius: var(--radius-md); margin-bottom: 10px; }
.settings-row .lbl { font-size: 13.5px; font-weight: 600; }
.settings-row .desc { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }

.switch { position: relative; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: rgba(120,120,160,0.3); border-radius: 999px; cursor: pointer; transition: 0.2s; }
.switch .track::before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: 0.2s; box-shadow: 0 1px 4px rgba(0,0,0,0.3); }
.switch input:checked + .track { background: linear-gradient(135deg, var(--accent-a), var(--accent-b)); }
.switch input:checked + .track::before { transform: translateX(-20px); }

/* ---------- مودال ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(10, 10, 25, 0.45);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-sheet {
  width: 100%; max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 26px 26px 0 0;
  padding: 22px 20px 28px;
  animation: slideUp 0.28s cubic-bezier(.2,.9,.3,1.2);
}
@media (min-width: 560px) {
  .modal-overlay { align-items: center; }
  .modal-sheet { border-radius: 26px; margin-bottom: 40px; }
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-header h3 { margin: 0; font-size: 17px; }
.modal-close { background: rgba(120,120,160,0.15); border: none; width: 30px; height: 30px; border-radius: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.modal-close svg { width: 15px; height: 15px; }

.form-group { margin-bottom: 16px; }
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }

.star-picker { display: flex; gap: 6px; }
.star-picker button { background: none; border: none; cursor: pointer; padding: 2px; }
.star-picker svg { width: 26px; height: 26px; stroke: var(--star-off); fill: none; transition: 0.15s; }
.star-picker button.on svg { fill: var(--star-on); stroke: var(--star-on); }

.day-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.day-toggle {
  flex: 1; min-width: 42px;
  padding: 10px 4px;
  text-align: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.15);
  cursor: pointer;
  font-size: 12px;
  color: var(--ink-soft);
}
.day-toggle.on { background: linear-gradient(135deg, var(--accent-a), var(--accent-b)); color: #fff; border-color: transparent; font-weight: 700; }

.cat-select-row { display: flex; gap: 8px; flex-wrap: wrap; }
.cat-select-chip {
  padding: 8px 12px; border-radius: 999px; border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.15); cursor: pointer; font-size: 12px; display: flex; align-items: center; gap: 6px;
}
.cat-select-chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.cat-select-chip.active { border-color: var(--accent-a); background: rgba(124,92,255,0.14); font-weight: 700; }

.time-input-wrap { display: flex; align-items: center; gap: 8px; }
.time-input-wrap input { text-align: center; }
.time-unit { font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; }

.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn { flex: 1; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 50; padding: 12px 20px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; box-shadow: var(--glass-shadow);
  animation: fadeUp 0.25s ease;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(120,120,160,0.35); border-radius: 3px; }

@media (max-width: 420px) {
  .day-pill { width: 64px; }
}
