/* nallium-tasks-frontend — design system
 *
 * Tokens (:root) et classes de "chrome" (topbar, boutons, alertes) copiés
 * à l'identique de nallium-contacts-frontend/css/style.css pour rester
 * visuellement cohérent avec le reste de l'écosystème Nallium — étendus
 * avec la mise en page liste de tâches (liste | fiche).
 */

:root {
  --text: #172033;
  --muted: #64748b;
  --blue: #3b82f6;
  --green: #22c55e;
  --amber: #f59e0b;
  --pink: #ec4899;
  --violet: #8b5cf6;
  --red: #ef4444;
  --cyan: #06b6d4;
  --bg: #f7f9ff;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-solid: #ffffff;
  --border: rgba(30, 41, 59, 0.12);
  --shadow: 0 24px 80px rgba(30, 41, 59, 0.12);
  --shadow-soft: 0 14px 38px rgba(30, 41, 59, 0.09);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 4%, rgba(6, 182, 212, 0.14), transparent 28%),
    radial-gradient(circle at 90% 12%, rgba(236, 72, 153, 0.1), transparent 24%),
    radial-gradient(circle at 72% 88%, rgba(34, 197, 94, 0.12), transparent 26%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--blue);
  text-decoration: none;
}

button {
  font: inherit;
}

.btn {
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
  padding: 8px 14px;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 13px;
}

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
}

.btn-outline {
  background: var(--panel-solid);
  border-color: var(--border);
  color: var(--text);
}

.btn-outline:hover {
  background: #eef2ff;
}

.btn-danger {
  background: #fff1f2;
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--red);
}

.btn-danger:hover {
  background: #ffe4e6;
}

/* ---------------------------------------------------------------------
 * Barre de navigation
 * ------------------------------------------------------------------- */
.store-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 28px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.store-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: #0f172a;
  cursor: pointer;
}

.store-brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
}

.tk-topbar-spacer {
  flex: 1;
}

.tk-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tk-avatar-sm {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.alert-banner {
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 14px;
}

.alert-banner.error {
  background: #fff1f2;
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
}

.empty-icon {
  font-size: 42px;
  margin-bottom: 12px;
}

.login-gate {
  text-align: center;
  padding: 80px 20px;
}

/* ---------------------------------------------------------------------
 * Mise en page générale (liste | fiche)
 * ------------------------------------------------------------------- */
.tk-shell {
  display: grid;
  grid-template-columns: 340px 1fr;
  height: calc(100vh - 65px);
}

.tk-list-panel {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--panel-solid);
}

.tk-list-toolbar {
  padding: 14px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

.tk-filter-tabs {
  display: flex;
  gap: 4px;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 3px;
}

.tk-filter-tab {
  flex: 1;
  text-align: center;
  border: none;
  background: transparent;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}

.tk-filter-tab.active {
  background: var(--panel-solid);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.tk-list-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0 20px;
}

.tk-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.tk-row:hover {
  background: #f8fafc;
}

.tk-row.active {
  background: #eff6ff;
  border-left-color: var(--blue);
}

.tk-row.done .tk-row-title {
  text-decoration: line-through;
  color: var(--muted);
}

.tk-row-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  margin-top: 1px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
}

.tk-row-check.done {
  background: var(--green);
  border-color: var(--green);
}

.tk-row-info {
  flex: 1;
  min-width: 0;
}

.tk-row-title {
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tk-row-meta {
  display: flex;
  gap: 8px;
  margin-top: 2px;
  flex-wrap: wrap;
}

.tk-chip {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: #f1f5f9;
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

.tk-chip.tk-chip-date {
  color: var(--blue);
  background: #eff6ff;
}

.tk-chip.tk-chip-overdue {
  color: var(--red);
  background: #fff1f2;
}

.tk-row-actions {
  display: none;
  gap: 4px;
  flex-shrink: 0;
}

.tk-row:hover .tk-row-actions {
  display: flex;
}

.tk-row-actions button {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  padding: 3px 5px;
  border-radius: 6px;
}

.tk-row-actions button:hover {
  background: #e2e8f0;
}

/* ---------------------------------------------------------------------
 * Fiche tâche
 * ------------------------------------------------------------------- */
.tk-detail-panel {
  overflow-y: auto;
  padding: 28px 40px 60px;
}

.tk-detail-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 26px;
}

.tk-detail-check {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
}

.tk-detail-check.done {
  background: var(--green);
  border-color: var(--green);
}

.tk-detail-header-info {
  flex: 1;
  min-width: 0;
}

.tk-detail-header-info input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 22px;
  font-weight: 800;
  padding: 2px 0;
}

.tk-detail-header-info input:focus {
  outline: none;
  border-bottom: 2px solid var(--blue);
}

.tk-detail-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tk-save-status {
  font-size: 12px;
  color: var(--muted);
  margin-right: 6px;
  white-space: nowrap;
}

.tk-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px 24px;
  max-width: 900px;
}

.tk-field label,
.tk-field-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 5px;
}

.tk-field input,
.tk-field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 14px;
  font-family: inherit;
  background: var(--panel-solid);
}

.tk-field textarea {
  resize: vertical;
  min-height: 90px;
}

.tk-section {
  margin-top: 30px;
  max-width: 900px;
}

.tk-section-title {
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 10px;
}

/* ---------------------------------------------------------------------
 * Récurrence
 * ------------------------------------------------------------------- */
.tk-chip.tk-chip-recurring {
  color: var(--violet);
  background: #f3ecfe;
}

.tk-recurrence-badge {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--violet);
  background: #f3ecfe;
  border-radius: 999px;
  padding: 3px 10px;
}

.tk-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 12px;
}

.tk-recurrence-fields {
  padding: 14px 16px;
  background: #f8fafc;
  border-radius: 12px;
}

.tk-recurrence-info {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------------------------------------------------------------------
 * Menu contextuel (clic droit) — sur une tâche de la liste ou le vide de
 * la liste. Même patron que nallium-maps-frontend/css/style.css
 * (.mp-context-menu), classes tk-* pour rester cohérent avec le reste de
 * cette app.
 * ------------------------------------------------------------------- */
.tk-context-menu {
  position: fixed;
  z-index: 2000;
  min-width: 200px;
  background: var(--panel-solid);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
}

.tk-context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
}

.tk-context-menu-item:hover {
  background: #f8fafc;
}

.tk-context-menu-item.danger {
  color: var(--red);
}

.tk-context-menu-item.danger:hover {
  background: #fff1f2;
}

.tk-context-menu-icon {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.tk-context-menu-sep {
  height: 1px;
  background: var(--border);
  margin: 5px 4px;
}

/* ---------------------------------------------------------------------
 * Responsive
 * ------------------------------------------------------------------- */
@media (max-width: 860px) {
  .tk-shell {
    grid-template-columns: 1fr;
  }

  .tk-list-panel {
    display: none;
  }

  .tk-shell.tk-show-list .tk-list-panel {
    display: flex;
  }

  .tk-shell.tk-show-list .tk-detail-panel {
    display: none;
  }
}

@media (max-width: 640px) {
  .store-topbar {
    padding: 10px 14px;
  }

  .tk-detail-panel {
    padding: 20px 18px 40px;
  }
}
