/* ── Acadian Task Manager — Custom Styles ── */

:root {
  --color-overdue-bg: #fff0ee;
  --color-overdue-border: #e05252;
  --color-overdue-text: #b91c1c;
  --color-today-bg: #fffbea;
  --color-today-border: #f59e0b;
  --color-upcoming-bg: #f0f9ff;
  --color-upcoming-border: #3b82f6;
  --color-completed-bg: #f0fdf4;
  --color-stat-overdue: #e05252;
  --color-stat-today: #f59e0b;
  --color-stat-week: #3b82f6;
  --color-primary: #1d4ed8;
  --min-tap: 48px;
}

/* ── Header ── */
.main-header {
  background: #1e3a5f;
  padding: 0.75rem 1.5rem;
  border-bottom: 3px solid #f59e0b;
}
.main-header nav ul li a {
  color: #fff;
  font-weight: 600;
  font-size: 1.05rem;
}
.brand-link {
  font-size: 1.3rem !important;
  letter-spacing: -0.5px;
}
.btn-nav {
  background: #f59e0b;
  color: #1e3a5f !important;
  border-radius: 6px;
  padding: 0.45rem 1.1rem;
  font-weight: 700;
  min-height: var(--min-tap);
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

/* ── Footer ── */
.main-footer {
  background: #f1f5f9;
  padding: 1rem 1.5rem;
  margin-top: 2.5rem;
  border-top: 1px solid #e2e8f0;
  font-size: 0.9rem;
  color: #64748b;
}

/* ── Flash Messages ── */
.flash {
  border-radius: 8px;
  margin-bottom: 1rem;
  padding: 0.85rem 1.2rem;
  border-left: 5px solid;
}
.flash p { margin: 0; font-weight: 600; font-size: 1rem; }
.flash-success { background: #d1fae5; border-color: #10b981; color: #065f46; }
.flash-error   { background: #fee2e2; border-color: #ef4444; color: #991b1b; }

/* ── Page Header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.page-header h1 {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 800;
  color: #1e3a5f;
}
.subtitle { color: #64748b; margin: 0; font-size: 1rem; }

/* ── Stat Cards ── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  text-align: center;
  padding: 1.5rem 1rem;
  border-radius: 12px;
  border: 2px solid;
  margin: 0;
}
.stat-number { font-size: 2.8rem; font-weight: 900; line-height: 1; }
.stat-label  { font-size: 1rem; font-weight: 600; margin-top: 0.25rem; }
.stat-overdue { background: #fff0ee; border-color: var(--color-stat-overdue); color: var(--color-stat-overdue); }
.stat-today   { background: #fffbea; border-color: var(--color-stat-today);   color: var(--color-stat-today);   }
.stat-week    { background: #eff6ff; border-color: var(--color-stat-week);    color: var(--color-stat-week);    }

/* ── Section Headers ── */
.task-section { margin-bottom: 2rem; }
.section-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.75rem; padding-bottom: 0.4rem; border-bottom: 2px solid; }
.overdue-title  { color: var(--color-stat-overdue); border-color: var(--color-stat-overdue); }
.today-title    { color: var(--color-stat-today);   border-color: var(--color-stat-today); }
.upcoming-title { color: var(--color-stat-week);    border-color: var(--color-stat-week); }

/* ── Task Cards ── */
.task-list { display: flex; flex-direction: column; gap: 0.75rem; }
.task-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border-radius: 10px;
  border-left: 5px solid #e2e8f0;
  padding: 1rem 1.2rem;
  background: #fff;
  margin: 0;
  flex-wrap: wrap;
}
.task-overdue   { border-left-color: var(--color-overdue-border); background: var(--color-overdue-bg); }
.task-today     { border-left-color: var(--color-today-border);   background: var(--color-today-bg); }
.task-upcoming  { border-left-color: var(--color-upcoming-border); background: var(--color-upcoming-bg); }

/* Row styles for all-tasks page */
.row-overdue  { border-left-color: var(--color-overdue-border); background: var(--color-overdue-bg); }
.row-today    { border-left-color: var(--color-today-border);   background: var(--color-today-bg); }
.row-completed{ border-left-color: #10b981; background: #f0fdf4; }

.task-info { flex: 1; min-width: 0; }
.task-row-top { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.25rem; }
.task-title { font-size: 1.15rem; font-weight: 700; margin: 0 0 0.35rem 0; color: #1e293b; }
.task-desc  { font-size: 0.9rem; color: #64748b; margin: 0.35rem 0 0 0; }
.task-meta  { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; font-size: 0.9rem; color: #475569; }
.meta-worker   { font-weight: 600; }
.meta-phone    { color: #64748b; }
.meta-due      { color: #475569; }
.meta-completed{ color: #065f46; font-weight: 600; }
.overdue-text  { color: var(--color-overdue-text); font-weight: 700; }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-interval { background: #e0f2fe; color: #0369a1; }
.badge-overdue  { background: #fee2e2; color: #b91c1c; }
.status-badge   { padding: 0.15rem 0.65rem; border-radius: 99px; font-size: 0.78rem; font-weight: 700; }
.status-pending   { background: #fef3c7; color: #92400e; }
.status-completed { background: #d1fae5; color: #065f46; }

/* ── Task Actions ── */
.task-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 120px;
  align-items: stretch;
}
.complete-form, .delete-form { margin: 0; }
.btn-complete, .btn-edit, .btn-delete, .btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--min-tap);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  border: none;
  width: 100%;
  text-align: center;
  transition: opacity 0.15s;
}
.btn-complete { background: #10b981; color: #fff; }
.btn-complete:hover { opacity: 0.88; }
.btn-edit     { background: #3b82f6; color: #fff; }
.btn-edit:hover { opacity: 0.88; }
.btn-delete   { background: #ef4444; color: #fff; }
.btn-delete:hover { opacity: 0.88; }
.btn-primary  { background: var(--color-primary); color: #fff; }
.btn-primary:hover { opacity: 0.88; }
.btn-secondary{ background: #e2e8f0; color: #334155; }
.btn-secondary:hover { opacity: 0.88; }
.btn-large    { min-height: 52px; font-size: 1.05rem; padding: 0.65rem 1.5rem; }

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.filter-btn {
  padding: 0.5rem 1.1rem;
  min-height: var(--min-tap);
  border-radius: 8px;
  background: #e2e8f0;
  color: #334155;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  border: 2px solid transparent;
  transition: all 0.15s;
}
.filter-btn.active, .filter-btn:hover {
  background: #1e3a5f;
  color: #fff;
  border-color: #1e3a5f;
}

/* ── Form ── */
.form-card {
  background: #fff;
  border-radius: 12px;
  padding: 2rem;
  border: 1px solid #e2e8f0;
  max-width: 760px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin-bottom: 1.5rem;
}
.full-width { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 0.3rem; }
.form-group label { font-weight: 600; font-size: 0.95rem; color: #334155; }
.form-group input,
.form-group select,
.form-group textarea {
  min-height: var(--min-tap);
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  border: 2px solid #cbd5e1;
  font-size: 1rem;
  color: #1e293b;
  background: #f8fafc;
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #3b82f6;
  background: #fff;
}
.form-group textarea { min-height: 80px; resize: vertical; }
.required { color: #ef4444; }
.form-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.form-actions .btn-primary { width: auto; }
.form-actions .btn-secondary { width: auto; }

/* ── Empty State ── */
.empty-state {
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  text-align: center;
  padding: 2rem;
  color: #64748b;
}
.empty-state p { margin: 0; font-size: 1rem; }
.empty-msg { color: #64748b; font-size: 1rem; }

/* ── Notify Results ── */
.notify-status { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.5rem; align-items: center; }
.status-item { padding: 0.2rem 0.7rem; border-radius: 99px; font-size: 0.85rem; font-weight: 700; }
.status-ok   { background: #d1fae5; color: #065f46; }
.status-fail { background: #fee2e2; color: #991b1b; }
.status-error{ color: #b91c1c; font-size: 0.85rem; }

/* ── Photo thumbnail ── */
.task-photo-thumb { margin-top: 0.5rem; }
.task-photo-thumb img { max-height: 80px; border-radius: 6px; border: 1px solid #e2e8f0; }

/* ── Task table wrapper ── */
.task-table-wrap { display: flex; flex-direction: column; gap: 0.75rem; }

/* ── Completion notes (shown on completed tasks in task list) ── */
.task-completion-notes {
  font-size: 0.9rem;
  color: #065f46;
  background: #d1fae5;
  border-left: 3px solid #10b981;
  padding: 0.4rem 0.75rem;
  border-radius: 0 6px 6px 0;
  margin-top: 0.4rem;
}

/* ── Completion form page ── */
.task-summary-card {
  background: #eff6ff;
  border: 2px solid #3b82f6;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  max-width: 760px;
}
.task-summary-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #3b82f6;
  margin-bottom: 0.35rem;
}
.task-summary-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #1e293b;
  margin: 0 0 0.5rem 0;
}

.complete-form-card {
  max-width: 760px;
}
.complete-label {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e3a5f;
  display: block;
  margin-bottom: 0.5rem;
}
.optional-tag {
  font-weight: 400;
  font-size: 0.9rem;
  color: #64748b;
}
.complete-textarea {
  width: 100%;
  min-height: 130px;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 2px solid #cbd5e1;
  font-size: 1rem;
  color: #1e293b;
  background: #f8fafc;
  resize: vertical;
  transition: border-color 0.15s;
  font-family: inherit;
  box-sizing: border-box;
}
.complete-textarea:focus {
  outline: none;
  border-color: #3b82f6;
  background: #fff;
}

/* Photo upload tap zone */
.photo-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 110px;
  border: 2px dashed #94a3b8;
  border-radius: 12px;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  padding: 1.5rem;
  text-align: center;
}
.photo-upload-area:hover {
  border-color: #3b82f6;
  background: #eff6ff;
}
.photo-upload-icon { font-size: 2rem; }
.photo-upload-text { font-size: 1rem; font-weight: 600; color: #475569; }
.photo-file-input  { display: none; }

/* Photo preview */
.photo-preview-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
}
.photo-preview-img {
  max-height: 90px;
  max-width: 140px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  object-fit: cover;
}
.btn-remove-photo {
  background: #fee2e2;
  color: #b91c1c;
  border: none;
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  min-height: var(--min-tap);
}
.btn-remove-photo:hover { background: #fecaca; }

/* Confirm / Cancel buttons */
.complete-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.btn-complete-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0.65rem 2rem;
  background: #10b981;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-complete-submit:hover { opacity: 0.88; }
.btn-cancel-complete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0.65rem 1.5rem;
  background: #e2e8f0;
  color: #334155;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
}
.btn-cancel-complete:hover { background: #cbd5e1; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .stat-cards { grid-template-columns: 1fr; }
  .form-grid  { grid-template-columns: 1fr; }
  .full-width { grid-column: 1; }
  .task-card  { flex-direction: column; }
  .task-actions { flex-direction: row; flex-wrap: wrap; min-width: unset; width: 100%; }
  .task-actions .btn-complete,
  .task-actions .btn-edit,
  .task-actions .btn-delete { flex: 1; min-width: 80px; }
  .filter-bar { flex-wrap: wrap; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .complete-actions { flex-direction: column; }
  .btn-complete-submit,
  .btn-cancel-complete { width: 100%; }
}
