/* ============================================================
   Checklists — Modal + Management Styles
   ============================================================ */

/* ─── Pulsing Badge Dot ─── */
.cl-pulse-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 10px;
  height: 10px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid var(--bg-card);
  animation: cl-pulse 1.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes cl-pulse {
  0%, 100% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
  50% { transform: scale(1.15); opacity: 0.85; box-shadow: 0 0 0 5px rgba(239,68,68,0); }
}

/* ─── Overlay / Modal ─── */
.cl-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.cl-overlay.open { opacity: 1; }

.cl-modal {
  width: 90%;
  max-width: 560px;
  max-height: 80vh;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  transform: translateY(12px);
  transition: transform 0.2s ease;
}
.cl-overlay.open .cl-modal { transform: translateY(0); }

.cl-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cl-modal-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-heading);
  margin: 0;
}
.cl-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 6px;
  display: flex;
  transition: all 0.15s;
}
.cl-modal-close:hover { color: var(--text); background: var(--bg-hover); }

.cl-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
}

/* ─── States ─── */
.cl-loading, .cl-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* ─── Checklist Card ─── */
.cl-checklist {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}
.cl-checklist:last-child { margin-bottom: 0; }

.cl-checklist-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}
.cl-checklist-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-heading);
}
.cl-checklist-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  line-height: 1.4;
}
.cl-checklist-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.cl-badge {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}
.cl-badge-recurrence {
  background: rgba(99,102,241,0.1);
  color: #6366f1;
}
.cl-progress-text {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* ─── Progress Bar ─── */
.cl-progress-bar {
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}
.cl-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  border-radius: 3px;
  transition: width 0.35s ease;
}

/* ─── Checklist Items ─── */
.cl-items {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.cl-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}
.cl-item:hover { background: rgba(0,0,0,0.03); }

.cl-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #10b981;
  cursor: pointer;
  flex-shrink: 0;
}
.cl-item-text {
  font-size: 0.82rem;
  color: var(--text);
  transition: all 0.15s;
}
.cl-item.done .cl-item-text {
  text-decoration: line-through;
  color: var(--text-muted);
  opacity: 0.6;
}

/* ─── Management Page Styles ─── */
.cl-page-body {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
}

.cl-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.cl-toolbar-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-heading);
}

.cl-btn-create {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), #6366f1);
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.cl-btn-create:hover { opacity: 0.9; }

/* ─── Checklist Editor Card ─── */
.cl-editor-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
  margin-bottom: 1rem;
  overflow: hidden;
}
.cl-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.12s;
}
.cl-editor-header:hover { background: var(--bg-hover); }

.cl-editor-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}
.cl-editor-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cl-editor-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.cl-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cl-status-dot.active { background: #10b981; }
.cl-status-dot.inactive { background: var(--text-muted); opacity: 0.4; }

.cl-editor-body {
  padding: 1.25rem;
  display: none;
}
.cl-editor-card.expanded .cl-editor-body { display: block; }
.cl-editor-card.expanded .cl-editor-header { border-bottom: 1px solid var(--border); }

.cl-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.cl-form-row.full { grid-template-columns: 1fr; }

.cl-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.cl-form-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.cl-form-input,
.cl-form-select,
.cl-form-textarea {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.82rem;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  transition: border-color 0.15s;
}
.cl-form-input:focus,
.cl-form-select:focus,
.cl-form-textarea:focus {
  outline: none;
  border-color: var(--blue);
}
.cl-form-textarea {
  resize: vertical;
  min-height: 60px;
}

/* ─── Week Day Picker ─── */
.cl-day-btn {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  transition: all 0.15s;
  min-width: 42px;
  text-align: center;
}
.cl-day-btn:hover { border-color: var(--blue); color: var(--text); }
.cl-day-btn.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

/* ─── Items Editor ─── */
.cl-items-editor {
  margin-top: 0.5rem;
}
.cl-items-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.cl-item-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.cl-item-row input {
  flex: 1;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.82rem;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.65rem;
}
.cl-item-row input:focus { outline: none; border-color: var(--blue); }

.cl-item-drag {
  cursor: grab;
  color: var(--text-muted);
  opacity: 0.4;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.cl-item-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 4px;
  display: flex;
  transition: all 0.15s;
  flex-shrink: 0;
}
.cl-item-remove:hover { color: #dc2626; background: rgba(239,68,68,0.08); }

.cl-btn-add-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--blue);
  background: none;
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  margin-top: 0.35rem;
  transition: all 0.15s;
}
.cl-btn-add-item:hover { border-color: var(--blue); background: rgba(59,130,246,0.04); }

/* ─── Actions bar ─── */
.cl-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
}
.cl-btn-save {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  background: #10b981;
  border: none;
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.cl-btn-save:hover { opacity: 0.9; }
.cl-btn-save:disabled { opacity: 0.5; cursor: not-allowed; }

.cl-btn-delete {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: #dc2626;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  transition: all 0.15s;
}
.cl-btn-delete:hover { background: rgba(239,68,68,0.08); }

.cl-btn-toggle {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-input);
  border: 1px solid var(--border);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.cl-btn-toggle:hover { border-color: var(--blue); color: var(--text); }

/* ─── Empty State ─── */
.cl-empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.cl-empty-state-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.cl-empty-state-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 0.3rem;
}
.cl-empty-state-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: 320px;
  margin: 0 auto;
}

@media (max-width: 640px) {
  .cl-form-row { grid-template-columns: 1fr; }
  .cl-modal { width: 95%; max-height: 90vh; }
  .cl-toolbar { flex-direction: column; align-items: stretch; }
}
