/* ========================================
   פייבוריט - Tasks App
   צבעי המותג ישירות מהפיגמה
   ======================================== */

@font-face {
  font-family: "Discordia";
  src: url("/fonts/Discordia-Regular.woff2") format("woff2"), url("/fonts/Discordia-Regular.woff") format("woff");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Discordia";
  src: url("/fonts/Discordia-Italic.woff2") format("woff2"), url("/fonts/Discordia-Italic.woff") format("woff");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Discordia";
  src: url("/fonts/Discordia-Bold.woff2") format("woff2"), url("/fonts/Discordia-Bold.woff") format("woff");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Discordia";
  src: url("/fonts/Discordia-BoldItalic.woff2") format("woff2"), url("/fonts/Discordia-BoldItalic.woff") format("woff");
  font-weight: 700; font-style: italic; font-display: swap;
}

:root {
  --black: #1e1e1c;
  --black-soft: #1e1e1c;
  --black-2: #2a2a28;
  --white: #ffffff;
  --orange: #ff614f;
  --pink: #ed5dbd;
  --yellow: #ffc824;
  --cyan: #1ed1ef;
  --gradient: linear-gradient(90deg, #ff614f 0%, #ed5dbd 100%);
  --gradient-warm: linear-gradient(90deg, #ffc824 0%, #ed5dbd 100%);
  --gradient-cool: linear-gradient(90deg, #1ed1ef 0%, #ed5dbd 100%);
  --text-muted: rgba(255,255,255,0.55);
  --border: rgba(255,255,255,0.08);
  --font-display: "Discordia", "Frank Ruhl Libre", Georgia, serif;
  --font-body: "Discordia", "Heebo", "Assistant", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

html, body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

body {
  background: var(--black);
  color: var(--white);
  font-family: var(--font-body);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

* { max-width: 100%; }

.grain { display: none; }

.app {
  position: relative; z-index: 2;
  max-width: 560px; margin: 0 auto;
  padding: 28px 22px 100px;
  min-height: 100dvh;
}

/* ============ HEADER ============ */
.header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-logo {
  height: 128px; width: auto;
  display: block;
}

.brand-divider { width: 1px; height: 18px; background: var(--border); }
.brand-tag { font-size: 13px; color: var(--text-muted); font-weight: 400; }

.header-actions { display: flex; align-items: center; gap: 10px; }

.avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  background: var(--gradient);
  padding: 3px;
}

.avatar::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  background: var(--gradient);
  z-index: 0;
}

.avatar img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  position: relative;
  z-index: 1;
  border: 2px solid var(--black);
  display: block;
}

.icon-btn {
  width: 40px; height: 40px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 50%; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s ease;
}

.icon-btn:hover { color: var(--white); border-color: rgba(255,97,79,0.5); }

.date {
  font-size: 12px; color: var(--text-muted);
  letter-spacing: 0.5px; text-transform: uppercase;
}

.date-nav {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; margin: 16px 0 24px;
}

.nav-arrow {
  width: 36px; height: 36px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 50%; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s ease;
  flex-shrink: 0;
}

.nav-arrow:hover { color: var(--white); border-color: rgba(255,97,79,0.5); }
.nav-arrow:disabled { opacity: 0.3; cursor: not-allowed; }

.date-label {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; min-width: 200px;
}

.today-btn {
  background: transparent; border: none;
  color: var(--orange); font-size: 11px;
  font-family: var(--font-body); font-weight: 500;
  cursor: pointer; padding: 0;
}

.today-btn:hover { color: var(--pink); }

.quote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 18px;
  max-width: 90%;
}

.quote::before { content: "« "; opacity: 0.5; }
.quote::after { content: " »"; opacity: 0.5; }

/* ============ HERO ============ */
.hero { margin: 24px 0 36px; }

.hero-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(48px, 13vw, 96px);
  line-height: 0.85;
  letter-spacing: -1px;
  word-break: break-word;
  overflow-wrap: break-word;
}

.line { display: block; }

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.hero-sub {
  margin-top: 16px; font-size: 15px;
  color: var(--text-muted); font-weight: 300;
}

/* ============ ADD FORM ============ */
.add { margin-bottom: 18px; }

/* ============ CATEGORY PICKER ============ */
.cat-picker {
  display: flex; gap: 8px;
  margin-bottom: 12px;
  justify-content: flex-start;
  flex-wrap: wrap;
  max-height: 0; overflow: hidden;
  opacity: 0;
  transition: max-height 0.25s ease, opacity 0.2s ease, margin 0.25s ease;
  margin-bottom: 0;
}

.cat-picker.visible {
  max-height: 60px;
  opacity: 1;
  margin-bottom: 12px;
}

.cat-chip {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 13px; font-weight: 400;
  padding: 8px 16px; border-radius: 100px;
  cursor: pointer; transition: all 0.2s ease;
}

.cat-chip:hover { color: var(--white); }

.cat-chip.active {
  color: var(--white);
  border-color: transparent;
}

.cat-chip.active.cat-עסקי { background: var(--gradient); }
.cat-chip.active.cat-אישי { background: var(--gradient-warm); }
.cat-chip.active.cat-לימודים { background: var(--gradient-cool); }

/* חלומות - בולט תמיד, עם הילה */
.cat-chip.cat-חלומות {
  background: linear-gradient(135deg, #1ed1ef 0%, #ed5dbd 50%, #ffc824 100%);
  color: var(--white);
  border-color: transparent;
  font-weight: 500;
  box-shadow: 0 0 0 0 rgba(237,93,189,0.4);
  animation: dreamPulse 2.5s ease-in-out infinite;
}

.cat-chip.cat-חלומות.active {
  box-shadow: 0 0 24px rgba(237,93,189,0.5), 0 0 0 2px rgba(255,255,255,0.15);
  transform: scale(1.05);
}

@keyframes dreamPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(237,93,189,0.4); }
  50% { box-shadow: 0 0 16px 0 rgba(237,93,189,0.5); }
}

/* ============ FILTER TABS ============ */
.filter-tabs {
  display: flex; gap: 6px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.filter-tab {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 13px; font-weight: 400;
  padding: 8px 14px; border-radius: 100px;
  cursor: pointer; transition: all 0.2s ease;
  white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
}

.filter-tab:hover { color: var(--white); }

.filter-tab.active {
  color: var(--white);
  border-color: rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.04);
}

.count {
  background: rgba(255,255,255,0.1);
  font-size: 11px; padding: 2px 8px;
  border-radius: 100px; min-width: 22px;
  text-align: center;
}

.filter-tab.active .count {
  background: var(--gradient);
}
.filter-tab.active[data-filter="אישי"] .count { background: var(--gradient-warm); }
.filter-tab.active[data-filter="לימודים"] .count { background: var(--gradient-cool); }

/* שורת חלומות נפרדת - תמיד למטה אחרי המשימות */
.dream-row {
  display: flex; justify-content: center;
  margin: 32px 0 18px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.dream-tab {
  background: linear-gradient(135deg, rgba(30,209,239,0.18), rgba(237,93,189,0.18), rgba(255,200,36,0.18)) !important;
  border: 1px solid rgba(237,93,189,0.45) !important;
  color: var(--white) !important;
  padding: 12px 28px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  letter-spacing: 0.5px;
}

.dream-tab.active {
  background: linear-gradient(135deg, #1ed1ef, #ed5dbd, #ffc824) !important;
  border-color: transparent !important;
  box-shadow: 0 4px 24px rgba(237,93,189,0.4);
}

.dream-tab .count {
  background: rgba(0,0,0,0.3) !important;
}

/* ============ TASK CATEGORY BADGE ============ */
.task-badge {
  font-size: 12px; font-weight: 500;
  padding: 6px 14px; border-radius: 100px;
  letter-spacing: 0.3px;
  flex-shrink: 0;
  cursor: pointer;
  font-family: var(--font-body);
  transition: transform 0.15s ease, opacity 0.15s ease;
  border: 1px solid transparent;
}

.task-badge:hover { transform: scale(1.05); opacity: 0.9; }
.task-badge:active { transform: scale(0.95); }

/* פופאפ בחירת קטגוריה */
.cat-popup-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(8px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease;
}

.cat-popup {
  background: var(--black);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px 22px;
  max-width: 380px; width: calc(100% - 40px);
  display: flex; flex-direction: column; gap: 12px;
  animation: slideUp 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}

.cat-popup-title {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700;
  margin-bottom: 4px;
  background: var(--gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.cat-popup-task {
  font-size: 14px; color: var(--text-muted);
  margin-bottom: 12px;
  word-break: break-word;
}

.cat-popup-options {
  display: flex; flex-direction: column; gap: 8px;
}

.cat-popup-option {
  background: var(--black-2);
  border: 1px solid var(--border);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 15px; font-weight: 500;
  padding: 14px 18px; border-radius: 14px;
  cursor: pointer; transition: all 0.2s ease;
  text-align: right;
  display: flex; justify-content: space-between; align-items: center;
}

.cat-popup-option:hover { border-color: rgba(255,255,255,0.2); transform: translateX(-2px); }

.cat-popup-option.cat-עסקי::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: var(--gradient);
}
.cat-popup-option.cat-אישי::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: var(--gradient-warm);
}
.cat-popup-option.cat-לימודים::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: var(--gradient-cool);
}
.cat-popup-option.cat-חלומות::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg, #1ed1ef, #ed5dbd, #ffc824);
}

.cat-popup-option.selected {
  border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.04);
}

.cat-popup-cancel {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 14px; padding: 12px;
  border-radius: 100px;
  cursor: pointer; transition: all 0.2s ease;
  margin-top: 6px;
}

.cat-popup-cancel:hover { color: var(--white); }

.task-badge.cat-עסקי {
  background: linear-gradient(90deg, rgba(255,97,79,0.15), rgba(237,93,189,0.15));
  color: var(--orange);
  border: 1px solid rgba(255,97,79,0.25);
}

.task-badge.cat-אישי {
  background: linear-gradient(90deg, rgba(255,200,36,0.15), rgba(237,93,189,0.15));
  color: var(--yellow);
  border: 1px solid rgba(255,200,36,0.3);
}

.task-badge.cat-לימודים {
  background: linear-gradient(90deg, rgba(30,209,239,0.15), rgba(237,93,189,0.15));
  color: var(--cyan);
  border: 1px solid rgba(30,209,239,0.3);
}

.task-badge.cat-חלומות {
  background: linear-gradient(135deg, rgba(30,209,239,0.2), rgba(237,93,189,0.2), rgba(255,200,36,0.2));
  color: var(--white);
  border: 1px solid rgba(237,93,189,0.4);
  font-weight: 500;
}

.add-form {
  display: flex; align-items: center; gap: 10px;
  background: var(--black-soft);
  border: 1px solid var(--border);
  border-radius: 100px; padding: 6px;
  transition: all 0.25s ease;
}

.add-form:focus-within {
  border-color: rgba(255,97,79,0.5);
  box-shadow: 0 0 0 3px rgba(255,97,79,0.1);
}

.task-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--white); font-family: var(--font-body);
  font-size: 16px; font-weight: 400; padding: 14px 18px;
}

.task-input::placeholder { color: var(--text-muted); }

.add-btn {
  width: 46px; height: 46px; border-radius: 50%;
  border: none; background: var(--gradient); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s ease; flex-shrink: 0;
}

.add-btn:hover { transform: scale(1.05); box-shadow: 0 6px 24px rgba(255,97,79,0.4); }
.add-btn:active { transform: scale(0.95); }

/* ============ TASK LIST ============ */
.task-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }

.task {
  display: flex; align-items: center; gap: 14px;
  background: var(--black-soft);
  border: 1px solid var(--border);
  border-radius: 18px; padding: 16px 18px;
  transition: all 0.25s ease; position: relative; overflow: hidden;
}

.task:hover { border-color: rgba(255,255,255,0.18); transform: translateX(-2px); }
.task.done { opacity: 0.45; background: transparent; }
.task.done .task-text { text-decoration: line-through; color: var(--text-muted); }

.check {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: all 0.2s ease; background: transparent;
}

.check:hover { border-color: var(--white); }
.check.checked { background: var(--gradient); border-color: transparent; }
.check svg { opacity: 0; transform: scale(0.5); transition: all 0.2s ease; }
.check.checked svg { opacity: 1; transform: scale(1); }

.task-text {
  flex: 1; font-size: 16px; font-weight: 400; color: var(--white);
  word-break: break-word; cursor: pointer; user-select: none;
}

.task-text[contenteditable="true"] {
  outline: none;
  border-bottom: 1px dashed rgba(255,97,79,0.5);
  cursor: text;
}

.delete-btn {
  background: transparent; border: none; color: var(--text-muted);
  cursor: pointer; padding: 6px; border-radius: 8px;
  opacity: 0; transition: all 0.2s ease; flex-shrink: 0;
}

.task:hover .delete-btn { opacity: 1; }
.delete-btn:hover { color: var(--orange); background: rgba(255,97,79,0.1); }

/* ============ EMPTY ============ */
.empty { text-align: center; padding: 60px 20px 40px; color: var(--text-muted); }

.empty-circle { display: none; }

.empty p { font-size: 15px; }
.hidden { display: none !important; }

/* ============ FOOTER ============ */
.footer {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, var(--black) 65%, transparent);
  padding: 20px 22px max(20px, env(safe-area-inset-bottom));
  display: flex; justify-content: space-between; align-items: center;
  z-index: 10; max-width: 560px; margin: 0 auto;
}

.status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #888; transition: background 0.3s; }
.status.ready .dot { background: #4ade80; box-shadow: 0 0 8px #4ade80; }
.status.connecting .dot { background: #facc15; animation: pulse 1.5s infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.ghost-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); font-family: var(--font-body);
  font-size: 12px; padding: 8px 14px; border-radius: 100px;
  cursor: pointer; transition: all 0.2s ease;
}

.ghost-btn:hover { color: var(--white); border-color: rgba(255,97,79,0.5); }

@keyframes slideIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.task { animation: slideIn 0.25s ease both; }

/* ============ MODAL הגדרות ============ */
.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.7); backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal-content {
  position: relative; z-index: 1;
  width: 100%; max-width: 560px;
  background: var(--black);
  border-top: 1px solid var(--border);
  border-radius: 28px 28px 0 0;
  padding: 24px 22px max(24px, env(safe-area-inset-bottom));
  max-height: 85dvh; overflow-y: auto;
  animation: slideUp 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 36px; font-weight: 900; line-height: 1; letter-spacing: -1px;
}

.modal-body { display: flex; flex-direction: column; gap: 22px; }

.settings-section {
  background: var(--black-soft);
  border: 1px solid var(--border);
  border-radius: 18px; padding: 16px 18px;
}

.section-title { font-size: 15px; font-weight: 500; color: var(--white); margin-bottom: 4px; }
.section-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.hint { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

.text-input, .time-input {
  width: 100%; margin-top: 10px;
  background: var(--black);
  border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px;
  color: var(--white); font-family: var(--font-body);
  font-size: 16px; outline: none;
  transition: border-color 0.2s;
}

.text-input:focus, .time-input:focus { border-color: rgba(255,97,79,0.5); }

.time-input {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700;
  letter-spacing: 1px; text-align: center;
  direction: ltr;
}

/* Switch */
.switch { position: relative; display: inline-block; width: 48px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--black-2); border-radius: 26px;
  transition: 0.3s;
}
.slider::before {
  content: ""; position: absolute;
  height: 20px; width: 20px; right: 3px; bottom: 3px;
  background: white; border-radius: 50%;
  transition: 0.3s;
}
.switch input:checked + .slider { background: var(--gradient); }
.switch input:checked + .slider::before { transform: translateX(-22px); }

.primary-btn {
  background: var(--gradient); color: var(--white);
  border: none; border-radius: 100px;
  padding: 16px 24px; font-family: var(--font-body);
  font-size: 16px; font-weight: 500;
  cursor: pointer; margin-top: 8px;
  transition: all 0.2s ease;
}

.primary-btn:hover { box-shadow: 0 6px 24px rgba(255,97,79,0.4); transform: translateY(-1px); }
.primary-btn:active { transform: translateY(0); }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; }

#qr-canvas-wrap {
  margin-top: 16px;
  background: white; border-radius: 12px;
  padding: 12px; display: flex; justify-content: center;
  min-height: 200px; align-items: center;
}

#qr-image { display: block; max-width: 100%; height: auto; }

/* Mobile - לוגו ממורכז למעלה, הגדרות בפינה */
@media (max-width: 768px) {
  .header {
    flex-direction: column-reverse;
    align-items: stretch;
    position: relative;
    margin-bottom: 16px;
  }

  .header-actions {
    position: absolute;
    top: 0; left: 0;
    z-index: 5;
  }

  .brand {
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    width: 100%;
  }

  .brand-divider { display: none; }

  .brand-logo {
    height: 96px;
    margin: 0 auto;
  }

  .brand-tag {
    text-align: center;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .app { padding: 22px 16px 100px; }
  .hero-title { font-size: 56px; }
  .brand-logo { height: 80px; }
  .footer { padding: 16px 16px max(16px, env(safe-area-inset-bottom)); }
  .filter-tab { font-size: 12px; padding: 7px 12px; }
  .cat-chip { font-size: 12px; padding: 7px 12px; }
}

@media (max-width: 380px) {
  .hero-title { font-size: 48px; }
  .brand-logo { height: 68px; }
}
