/* ================================================================
   styles.css — TaskFlow Professional Dark Theme
   Layout: Sidebar (left) | Main content (right)
================================================================ */

/* ── Reset & variables ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0d0f17;
  --bg-2:        #111320;
  --surface:     #161926;
  --surface-2:   #1d2135;
  --surface-3:   #242840;
  --border:      #2a2f4a;
  --border-2:    #353a5c;
  --accent:      #6366f1;
  --accent-h:    #818cf8;
  --accent-soft: rgba(99,102,241,0.12);
  --ai:          #f59e0b;
  --ai-h:        #fbbf24;
  --ai-soft:     rgba(245,158,11,0.12);
  --success:     #22c55e;
  --danger:      #ef4444;
  --warning:     #f59e0b;
  --col-todo:    #6366f1;
  --col-prog:    #06b6d4;
  --col-done:    #22c55e;
  --text:        #e2e8f0;
  --text-2:      #94a3b8;
  --text-3:      #64748b;
  --radius:      8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --shadow-sm:   0 1px 4px rgba(0,0,0,0.4);
  --shadow:      0 4px 20px rgba(0,0,0,0.5);
  --shadow-lg:   0 8px 40px rgba(0,0,0,0.65);
  --trans:       0.18s ease;
  --font:        "Inter", "Segoe UI", system-ui, sans-serif;
  --header-h:    58px;
  --sidebar-w:   280px;
}

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Sticky Header ─────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 var(--border), var(--shadow-sm);
}

.header-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.logo-icon {
  width: 22px;
  height: 22px;
  color: var(--accent);
  flex-shrink: 0;
}

.logo {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.logo-divider {
  width: 1px;
  height: 18px;
  background: var(--border-2);
}

.tagline {
  font-size: 0.78rem;
  color: var(--text-3);
  font-weight: 500;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  color: var(--text-3);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

/* ── App Shell (sidebar + main) ────────────────────────────────── */
.app-shell {
  display: flex;
  max-width: 1600px;
  margin: 0 auto;
  min-height: calc(100vh - var(--header-h));
}


/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 16px 40px;
  overflow-y: auto;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
}

.sidebar-section {
  margin-bottom: 4px;
}

.sidebar-section--projects {
  flex: 1;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-3);
  margin-bottom: 12px;
}

.section-label svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}

/* ── Forms ─────────────────────────────────────────────────────── */
.sidebar-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 100px;
}

.field-group.grow { flex: 1; min-width: 160px; }
.field-group.full-width { width: 100%; flex-basis: 100%; }

label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.2px;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
select,
textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.875rem;
  padding: 8px 11px;
  transition: border-color var(--trans), box-shadow var(--trans), background var(--trans);
  width: 100%;
  resize: vertical;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-3);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input::placeholder, textarea::placeholder { color: var(--text-3); }

select option { background: var(--surface-2); }

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.84rem;
  font-weight: 600;
  padding: 9px 18px;
  transition: background var(--trans), box-shadow var(--trans), transform 0.1s, color var(--trans), border-color var(--trans);
  white-space: nowrap;
  text-decoration: none;
}

.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-h);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-ai {
  background: var(--ai);
  color: #0d0f17;
}
.btn-ai svg { color: #0d0f17; }
.btn-ai:hover {
  background: var(--ai-h);
  box-shadow: 0 0 0 3px var(--ai-soft);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-2); background: var(--surface-2); }

.btn-full { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 0.8rem; }
.btn-sm svg { width: 13px; height: 13px; }

.btn-edit {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-3);
  padding: 3px 10px;
  font-size: 0.74rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  transition: color var(--trans), border-color var(--trans), background var(--trans);
  white-space: nowrap;
}
.btn-edit:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.btn-danger {
  background: transparent;
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--danger);
  padding: 3px 10px;
  font-size: 0.74rem;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid rgba(239,68,68,0.3);
  font-family: var(--font);
  font-weight: 600;
  transition: background var(--trans), border-color var(--trans);
  white-space: nowrap;
}
.btn-danger:hover { background: rgba(239,68,68,0.12); border-color: var(--danger); }

.btn-delete-project {
  background: transparent;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 6px;
  border-radius: 5px;
  flex-shrink: 0;
  transition: color var(--trans), background var(--trans);
  line-height: 1;
}
.btn-delete-project:hover { color: var(--danger); background: rgba(239,68,68,0.1); }

/* ── Error & helper text ───────────────────────────────────────── */
.field-error { font-size: 0.72rem; color: var(--danger); min-height: 15px; }
.required { color: var(--danger); }
.optional { color: var(--text-3); font-weight: 400; }


/* ── Project List ──────────────────────────────────────────────── */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.project-item {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 7px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.84rem;
  transition: background var(--trans), border-color var(--trans);
  cursor: pointer;
}
.project-item:hover { background: var(--surface-2); border-color: var(--border); }
.project-item.active {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.project-item.active .project-item-name { color: var(--accent-h); }

.project-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
  font-size: 0.84rem;
}
.project-item.active .project-item-name { color: var(--accent-h); }
.project-item:hover .project-item-name { color: var(--text); }

/* ── Main Content ──────────────────────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 20px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Panel base ────────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
}

.panel h2 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

/* ── Controls / Search Panel ───────────────────────────────────── */
.controls-panel { padding: 18px 24px; }

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.controls-actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding-bottom: 1px;
}

.search-banner {
  margin-top: 10px;
  min-height: 18px;
  font-size: 0.8rem;
  color: var(--accent-h);
  font-weight: 500;
}
.search-banner.error { color: var(--danger); }

/* ── Task Board Panel ──────────────────────────────────────────── */
.task-board-panel { padding: 20px 22px; }

.task-board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.task-board-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Collapsible Add Task form */
.add-task-collapsed { display: none; }

.add-task-open {
  display: block;
  margin-bottom: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  animation: slideDown 0.2s ease;
}

.add-task-form { display: flex; flex-direction: column; gap: 12px; }

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

/* ── Kanban Columns ────────────────────────────────────────────── */
.task-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: start;
}

.task-column {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 12px;
  min-height: 180px;
}

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 2px solid;
}

.column-header > span:first-child {
  display: flex;
  align-items: center;
  gap: 6px;
}

.column-header svg { width: 12px; height: 12px; }

.todo-header       { color: var(--col-todo); border-color: var(--col-todo); }
.inprogress-header { color: var(--col-prog); border-color: var(--col-prog); }
.done-header       { color: var(--col-done); border-color: var(--col-done); }

.empty-col {
  text-align: center;
  padding: 28px 0 16px;
  font-size: 0.78rem;
  color: var(--text-3);
}

.badge {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 9px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-3);
}

.task-column .badge {
  background: transparent;
  border-color: currentColor;
  opacity: 0.7;
}


/* ── Task Items ────────────────────────────────────────────────── */
.task-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: border-color var(--trans), background var(--trans), box-shadow var(--trans);
}

.task-item:hover {
  border-color: var(--border-2);
  background: var(--surface-2);
  box-shadow: var(--shadow-sm);
}

.task-item.done { opacity: 0.45; }

.task-item.highlight {
  border-color: var(--ai);
  background: rgba(245,158,11,0.06);
  box-shadow: 0 0 0 2px var(--ai-soft);
}

.task-checkbox {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
  margin-top: 3px;
}

.task-content { flex: 1; min-width: 0; }

.task-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
  display: block;
  line-height: 1.4;
}

.task-item.done .task-title {
  text-decoration: line-through;
  color: var(--text-3);
}

.task-desc-text {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 4px;
  word-break: break-word;
  line-height: 1.5;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
  align-items: center;
}

.chip {
  display: inline-block;
  border-radius: 5px;
  font-size: 0.66rem;
  font-weight: 700;
  padding: 2px 7px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.chip-priority-low    { background: rgba(34,197,94,0.12);  color: #4ade80; }
.chip-priority-medium { background: rgba(245,158,11,0.12); color: #fbbf24; }
.chip-priority-high   { background: rgba(239,68,68,0.12);  color: #f87171; }

.task-due {
  font-size: 0.71rem;
  color: var(--text-3);
}

.task-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
  align-items: flex-end;
}

/* ── AI Quick-Add Panel ────────────────────────────────────────── */
.ai-panel {
  border-color: rgba(245,158,11,0.2);
  background: linear-gradient(135deg, var(--surface) 0%, rgba(245,158,11,0.03) 100%);
}

.ai-panel-header { margin-bottom: 16px; }

.ai-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.ai-icon {
  width: 28px;
  height: 28px;
  color: var(--ai);
  flex-shrink: 0;
  margin-top: 1px;
}

.ai-title h2 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}

.ai-subtitle {
  font-size: 0.8rem;
  color: var(--text-3);
  line-height: 1.5;
}

.ai-form { display: flex; flex-direction: column; gap: 14px; }

/* ── Modal ─────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
  animation: fadeIn 0.15s ease;
}

.modal-overlay[hidden] { display: none; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-xl);
  padding: 26px 28px;
  width: min(500px, 95vw);
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.18s ease;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96) translateY(-8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color var(--trans), background var(--trans);
  display: flex;
  align-items: center;
}
.modal-close-btn svg { width: 16px; height: 16px; }
.modal-close-btn:hover { color: var(--text); background: var(--surface-2); }

.modal-box .field-group { margin-bottom: 4px; }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}

/* ── Toast ─────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: 12px 20px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  max-width: 360px;
  animation: toastIn 0.2s ease;
}
.toast[hidden] { display: none; }
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error   { border-color: var(--danger);  color: var(--danger);  }

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

/* ── Spinner ───────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 13px; height: 13px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 5px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive: tablet ────────────────────────────────────────── */
@media (max-width: 960px) {
  :root { --sidebar-w: 240px; }
  .task-columns { grid-template-columns: 1fr; }
  .controls-row { flex-direction: column; align-items: stretch; }
  .controls-actions { flex-wrap: wrap; }
}

@media (max-width: 768px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 16px;
  }
  .main-content { padding: 14px 14px 40px; }
  .task-columns { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  html { font-size: 14px; }
  .tagline { display: none; }
  .logo-divider { display: none; }
  .panel { padding: 14px 14px; }
  .modal-box { padding: 18px 16px; }
  .task-item { flex-direction: column; gap: 8px; }
  .task-actions { flex-direction: row; width: 100%; justify-content: flex-end; }
  .controls-actions .btn { flex: 1; }
}
