/* ── Tasks Tab ────────────────────────────────────────────────── */

.task-loading {
  text-align: center;
  color: var(--text-muted, #94a3b8);
  padding: 3rem 1rem;
}

/* ── Header row: search + add button ────────────────────────────── */
.task-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 1rem;
}

.task-search-input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 20px;
  font-size: 16px; /* prevents iOS auto-zoom */
  background: var(--bg2, #f8fafc)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 12px center;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.task-search-input:focus {
  border-color: #6C3CE1;
  box-shadow: 0 0 0 3px rgba(108, 60, 225, 0.10);
}

.task-add-btn {
  background: linear-gradient(135deg, #FF5D6C, #e04a58);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s, transform 0.15s;
  flex-shrink: 0;
}
.task-add-btn:hover { opacity: 0.9; transform: translateY(-1px); }

/* ── Sections ─────────────────────────────────────────────────── */
.task-section { margin-bottom: 1rem; }

.task-section-header {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #fff;
  cursor: pointer;
  padding: 0.6rem 1rem;
  user-select: none;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
  margin-bottom: 0;
  border: none;
  width: 100%;
  text-align: left;
}
.task-section-header:hover { filter: brightness(1.05); }

.task-section--collapsed .task-section-body { display: none; }
.task-section-chevron { font-size: 0.85rem; }
.task-section-count {
  margin-left: auto;
  font-size: 0.75rem;
  opacity: 0.85;
  background: rgba(255,255,255,0.22);
  border-radius: 12px;
  padding: 1px 8px;
}
.task-section-body { padding-top: 6px; }

/* ── Task card ────────────────────────────────────────────────── */
.task-card {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.task-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.task-card--done {
  opacity: 0.62;
}
/* Overdue: past due, not completed */
.task-card--overdue {
  border-left: 4px solid #ef4444;
  background: linear-gradient(135deg, rgba(254, 226, 226, 0.35), var(--card-bg, #fff));
}

/* Top row: icon + title + priority badge */
.task-card-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}
.task-card-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 1px;
}
.task-title {
  flex: 1;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text, #0f172a);
  line-height: 1.35;
  word-break: break-word;
}
.task-title--done {
  text-decoration: line-through;
  color: var(--muted, #94a3b8);
}

/* Priority badge */
.task-priority-badge {
  flex-shrink: 0;
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 20px;
  padding: 2px 8px;
  align-self: flex-start;
}
.task-priority--low    { background: rgba(16,185,129,0.12); color: #059669; border: 1px solid rgba(16,185,129,0.3); }
.task-priority--medium { background: rgba(59,130,246,0.12); color: #2563eb; border: 1px solid rgba(59,130,246,0.3); }
.task-priority--high   { background: rgba(245,158,11,0.12); color: #d97706; border: 1px solid rgba(245,158,11,0.3); }
.task-priority--urgent { background: rgba(239,68,68,0.12);  color: #dc2626; border: 1px solid rgba(239,68,68,0.3); }

/* Meta row: due date/time, assigned badges */
.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--muted, #64748b);
  margin-bottom: 5px;
}
.task-meta span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.task-meta--overdue {
  color: #dc2626;
  font-weight: 600;
}

/* Assign badges — pushed to the right of the meta row */
.task-assign-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(108,60,225,0.10);
  color: #6C3CE1;
  border: 1px solid rgba(108,60,225,0.2);
  margin-left: auto;
}
.task-assign-badge--from {
  background: rgba(16,185,129,0.10);
  color: #059669;
  border: 1px solid rgba(16,185,129,0.25);
  margin-left: auto;
}

.task-notes {
  font-size: 0.79rem;
  color: var(--muted, #64748b);
  margin-bottom: 6px;
  line-height: 1.4;
  word-break: break-word;
}

/* Action buttons row — centred */
.task-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
  justify-content: center;
}
.task-btn {
  border: 1px solid var(--border, #e2e8f0);
  background: var(--bg2, #f8fafc);
  color: var(--text-muted, #64748b);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.task-btn:hover { background: var(--border, #e2e8f0); }
.task-btn-done  { color: #059669; border-color: rgba(16,185,129,0.4); }
.task-btn-done:hover  { background: rgba(16,185,129,0.10); }
.task-btn-undo  { color: #6C3CE1; border-color: rgba(108,60,225,0.3); }
.task-btn-undo:hover  { background: rgba(108,60,225,0.08); }
.task-btn-edit  { color: #2563eb; border-color: rgba(59,130,246,0.3); }
.task-btn-edit:hover  { background: rgba(59,130,246,0.08); }
.task-btn-delete { color: #dc2626; border-color: rgba(239,68,68,0.3); }
.task-btn-delete:hover { background: rgba(239,68,68,0.08); }
.task-btn-assign { color: #7c3aed; border-color: rgba(124,58,237,0.3); }
.task-btn-assign:hover { background: rgba(124,58,237,0.08); }

/* Limit banner */
.task-limit-banner {
  background: linear-gradient(135deg, rgba(245,158,11,0.1), rgba(251,191,36,0.08));
  border: 1px solid rgba(245,158,11,0.35);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 0.83rem;
  color: var(--text, #0f172a);
}
.task-limit-link {
  color: #6C3CE1;
  font-weight: 600;
  text-decoration: none;
  margin-left: 4px;
}
.task-limit-link:hover { text-decoration: underline; }

/* Empty state */
.task-empty {
  text-align: center;
  padding: 40px 20px;
}
.task-empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.task-empty-title { font-size: 1rem; font-weight: 700; color: var(--text, #0f172a); margin-bottom: 6px; }
.task-empty-sub   { font-size: 0.85rem; color: var(--muted, #64748b); margin-bottom: 16px; }
.task-empty-section {
  font-size: 0.82rem;
  color: var(--muted, #94a3b8);
  padding: 12px 0;
  text-align: center;
}

/* ── Modal overlay ────────────────────────────────────────────── */
.task-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  overscroll-behavior: contain;
}
@media (min-width: 600px) {
  .task-modal-overlay {
    align-items: center;
    padding: 24px;
  }
}

.task-modal {
  background: var(--card-bg, #fff);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 540px;
  max-height: 92dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 -4px 32px rgba(0,0,0,0.18);
}
@media (min-width: 600px) {
  .task-modal {
    border-radius: 20px;
    max-height: 88dvh;
    box-shadow: 0 8px 48px rgba(0,0,0,0.22);
  }
}

.task-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  position: sticky;
  top: 0;
  background: linear-gradient(135deg, #FF5D6C, #e04a58);
  z-index: 1;
  border-bottom: none;
}
.task-modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  text-align: center;
  flex: 1;
}
.task-modal-header-spacer { width: 32px; }
.task-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #fff;
  padding: 0;
  width: 32px;
  text-align: right;
  transition: color 0.12s;
}
.task-modal-close:hover { color: rgba(255,255,255,0.8); }

.task-modal-body {
  padding: 18px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Form fields */
.task-field { display: flex; flex-direction: column; gap: 5px; }
.task-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted, #64748b);
}
.task-input,
.task-textarea,
.task-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  font-size: 16px;
  background: var(--bg2, #f8fafc);
  color: var(--text);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.task-input:focus,
.task-textarea:focus,
.task-select:focus {
  border-color: #6C3CE1;
  box-shadow: 0 0 0 3px rgba(108, 60, 225, 0.10);
}
.task-textarea {
  resize: vertical;
  min-height: 80px;
}

/* Two-column date+time row */
.task-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Priority segmented buttons */
.task-priority-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.task-priority-btn {
  border: 1.5px solid var(--border, #e2e8f0);
  background: var(--bg2, #f8fafc);
  border-radius: 8px;
  padding: 7px 4px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  color: var(--muted, #64748b);
}
.task-priority-btn:hover { filter: brightness(0.95); }
.task-priority-btn--active[data-priority="low"]    { background: rgba(16,185,129,0.15); border-color: #10b981; color: #059669; }
.task-priority-btn--active[data-priority="medium"] { background: rgba(59,130,246,0.15); border-color: #3b82f6; color: #2563eb; }
.task-priority-btn--active[data-priority="high"]   { background: rgba(245,158,11,0.15); border-color: #f59e0b; color: #d97706; }
.task-priority-btn--active[data-priority="urgent"] { background: rgba(239,68,68,0.15);  border-color: #ef4444; color: #dc2626; }

/* Modal save button */
.task-modal-save-btn {
  background: #6C3CE1;
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s;
  margin-top: 4px;
}
.task-modal-save-btn:hover  { background: #5a30c0; }
.task-modal-save-btn:active { background: #4a28a0; }

/* Limit-reached modal */
.task-limit-reached-modal {
  text-align: center;
  padding-bottom: 24px;
}
