/* ============================================================
   Lysvexa Test Tasks — Stylesheet
   Lightweight, semantic, no external dependencies.
   ============================================================ */

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

:root {
  --color-bg:         #f8f9fa;
  --color-surface:    #ffffff;
  --color-border:     #dee2e6;
  --color-text:       #212529;
  --color-text-muted: #6c757d;
  --color-primary:    #0d6efd;
  --color-primary-dk: #0b5ed7;
  --color-success:    #198754;
  --color-danger:     #dc3545;
  --color-danger-dk:  #bb2d3b;
  --color-warning:    #ffc107;
  --color-info:       #0dcaf0;
  --color-high:       #dc3545;
  --color-medium:     #fd7e14;
  --color-low:        #6c757d;
  --color-pending:    #0d6efd;
  --color-completed:  #198754;
  --radius:           6px;
  --shadow-sm:        0 1px 3px rgba(0,0,0,.08);
  --shadow-md:        0 2px 8px rgba(0,0,0,.12);
  --transition:       0.15s ease;
  --font-sans:        system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono:        "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

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

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover, a:focus { text-decoration: underline; }

h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.1rem; font-weight: 600; }

/* ---- Layout ---- */
.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1rem;
}

.main-content {
  flex: 1;
  padding: 2rem 0;
}

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

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: .75rem;
  padding-bottom: .75rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text);
  text-decoration: none;
}

.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius);
  font-size: .9rem;
}

.site-nav { display: flex; gap: .75rem; align-items: center; }
.nav-link { color: var(--color-text-muted); font-size: .9rem; }
.nav-link:hover { color: var(--color-primary); text-decoration: none; }

/* ---- Footer ---- */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 1rem 0;
  font-size: .8rem;
  color: var(--color-text-muted);
  text-align: center;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .9rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  text-decoration: none;
  white-space: nowrap;
  background: none;
  line-height: 1.4;
}

.btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.btn-primary  { background: var(--color-primary);  color: #fff; border-color: var(--color-primary); }
.btn-primary:hover  { background: var(--color-primary-dk); border-color: var(--color-primary-dk); color: #fff; text-decoration: none; }

.btn-secondary { background: #e9ecef; color: var(--color-text); border-color: #ced4da; }
.btn-secondary:hover { background: #d3d7db; text-decoration: none; color: var(--color-text); }

.btn-danger   { background: var(--color-danger); color: #fff; border-color: var(--color-danger); }
.btn-danger:hover   { background: var(--color-danger-dk); border-color: var(--color-danger-dk); color: #fff; text-decoration: none; }

.btn-ghost    { background: transparent; color: var(--color-text-muted); }
.btn-ghost:hover    { background: #e9ecef; text-decoration: none; color: var(--color-text); }

.btn-sm { padding: .3rem .65rem; font-size: .8rem; }

/* ---- Alerts ---- */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .9rem;
}
.alert-success { background: #d1e7dd; color: #0f5132; border: 1px solid #a3cfbb; }
.alert-info    { background: #cff4fc; color: #055160; border: 1px solid #9eeaf9; }
.alert-danger  { background: #f8d7da; color: #842029; border: 1px solid #f1aeb5; }

/* ---- Page header ---- */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { margin-bottom: .5rem; }

/* ---- Filter bar ---- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: flex-end;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.filter-group { display: flex; flex-direction: column; gap: .25rem; min-width: 130px; }
.filter-group label { font-size: .8rem; font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .03em; }

input[type="text"],
input[type="search"],
input[type="date"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: .45rem .7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: .9rem;
  font-family: var(--font-sans);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(13,110,253,.15);
}

textarea { resize: vertical; min-height: 80px; }

/* ---- Task list ---- */
.task-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .75rem;
}

.task-count { font-size: .875rem; color: var(--color-text-muted); }

.task-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.task-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.task-card:hover { box-shadow: var(--shadow-md); }

.task-card.task-completed { opacity: .65; }
.task-card.task-completed .task-title { text-decoration: line-through; color: var(--color-text-muted); }

.task-main {
  display: flex;
  gap: .875rem;
  align-items: flex-start;
  flex: 1;
  min-width: 0;
}

.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 1rem; margin-bottom: .3rem; word-break: break-word; }
.task-desc  { font-size: .85rem; color: var(--color-text-muted); margin-bottom: .5rem; word-break: break-word; }

.task-meta { display: flex; flex-wrap: wrap; gap: .4rem; }
.task-actions { display: flex; gap: .5rem; flex-shrink: 0; align-items: center; }

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-priority.badge-high   { background: #f8d7da; color: #842029; }
.badge-priority.badge-medium { background: #fff3cd; color: #664d03; }
.badge-priority.badge-low    { background: #e9ecef; color: #495057; }

.badge-status.badge-pending   { background: #cfe2ff; color: #084298; }
.badge-status.badge-completed { background: #d1e7dd; color: #0f5132; }

.badge-date { background: #e9ecef; color: #495057; }

/* ---- Toggle button ---- */
.toggle-btn {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition), background var(--transition);
  position: relative;
}

.toggle-btn:hover { border-color: var(--color-primary); }
.toggle-btn.is-done { border-color: var(--color-success); background: var(--color-success); color: #fff; }
.toggle-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.toggle-icon { font-size: .85rem; line-height: 1; }

/* ---- Spinner ---- */
@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
  vertical-align: middle;
}

.spinner-large {
  width: 36px; height: 36px;
  border: 4px solid var(--color-primary);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 1rem;
}

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--color-text-muted);
}
.empty-icon  { font-size: 3rem; margin-bottom: 1rem; }
.empty-title { font-size: 1.25rem; font-weight: 600; color: var(--color-text); margin-bottom: .5rem; }
.empty-hint  { font-size: .9rem; }

/* ---- Forms ---- */
.form-page { max-width: 600px; margin: 0 auto; }
.form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.task-form { position: relative; }

.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block;
  font-weight: 600;
  font-size: .875rem;
  margin-bottom: .4rem;
}
.form-group.has-error input, .form-group.has-error select, .form-group.has-error textarea {
  border-color: var(--color-danger);
}

.required-mark { color: var(--color-danger); margin-left: .1rem; }

.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 140px; }

.form-actions { display: flex; gap: .75rem; margin-top: 1.75rem; }

/* Respect the HTML hidden attribute even when the overlay uses flex layout. */
.form-loading[hidden] { display: none !important; }

/* Form loading overlay */
.form-loading {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  z-index: 10;
  font-weight: 500;
  color: var(--color-text-muted);
}

/* ---- Error summary ---- */
.error-summary {
  background: #f8d7da;
  border: 1px solid #f1aeb5;
  border-radius: var(--radius);
  padding: .875rem 1rem;
  margin-bottom: 1.5rem;
}
.error-summary-title { font-size: .95rem; color: #842029; margin-bottom: .5rem; }
.error-list { margin-left: 1.25rem; font-size: .875rem; color: #842029; }
.error-list li { margin-bottom: .25rem; }

/* ---- Confirm delete ---- */
.confirm-page { display: flex; justify-content: center; padding: 2rem 0; }
.confirm-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  text-align: center;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-md);
}
.confirm-icon  { font-size: 2.5rem; display: block; margin-bottom: 1rem; }
.confirm-title { margin-bottom: .75rem; }
.confirm-body  { color: var(--color-text-muted); margin-bottom: .75rem; font-size: .95rem; }
.confirm-task-title {
  background: #f8f9fa;
  border-left: 4px solid var(--color-danger);
  padding: .5rem .75rem;
  margin: .75rem 0;
  text-align: left;
  font-style: italic;
  border-radius: 0 var(--radius) var(--radius) 0;
  word-break: break-word;
}
.confirm-actions { display: flex; gap: .75rem; justify-content: center; margin-top: 1.5rem; }

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--color-text);
  color: #fff;
  padding: .75rem 1.25rem;
  border-radius: var(--radius);
  font-size: .875rem;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
  z-index: 999;
  max-width: 320px;
}
.toast.show { opacity: 1; pointer-events: auto; }

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .filter-bar { flex-direction: column; }
  .filter-group { min-width: 100%; }
  .task-card { flex-direction: column; }
  .task-actions { justify-content: flex-start; }
  .form-row { flex-direction: column; }
}

