/* ── Checklist App Layout ─────────────────────────────────────────────── */

.checklist-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--app-bg, #0f0f23);
  color: var(--text-primary, #e8e8f2);
  font-family: var(--font-tree-items, 'DM Sans', system-ui, sans-serif);
}

/* ── Top Bar ─────────────────────────────────────────────────────────── */

.checklist-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-secondary, #1a1a2e);
  border-bottom: 1px solid var(--border-color, #3a3a5a);
  min-height: 44px;
  flex-shrink: 0;
  gap: 8px;
}

.checklist-topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-shrink: 0;
}

.checklist-topbar-center {
  flex: 1;
  text-align: center;
  min-width: 0;
}

.checklist-topbar-title {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.checklist-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.checklist-tasks-btn {
  padding: 3px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color, #3a3a5a);
  background: var(--bg-tertiary, #2a2a3e);
  color: var(--text-secondary, #a0a0b8);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.checklist-tasks-btn:hover {
  background: var(--bg-hover, rgba(99, 102, 241, 0.15));
  border-color: var(--accent-primary, #6366f1);
  color: var(--text-primary, #e8e8f2);
}

.checklist-back-btn {
  display: flex;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--accent-primary, #6366f1);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.checklist-back-btn:hover {
  background: var(--bg-hover, rgba(99, 102, 241, 0.15));
}

.checklist-back-arrow {
  font-size: 20px;
  line-height: 1;
  font-weight: 300;
}

.checklist-undo-btn {
  width: 37px;
  height: 37px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #2a7a4a 0%, #1a5c3a 100%);
  border: none;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.checklist-undo-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0) 45%);
  border-radius: inherit;
  pointer-events: none;
}

.checklist-undo-btn.disabled {
  opacity: 0.35;
  cursor: default;
}

.checklist-undo-btn:not(.disabled):hover {
  filter: brightness(1.15);
}

.checklist-edit-btn {
  background: none;
  border: 1px solid var(--border-color, #3a3a5a);
  color: var(--accent-primary, #6366f1);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 12px;
  border-radius: 6px;
}

.checklist-edit-btn.active {
  background: var(--accent-primary, #6366f1);
  color: #fff;
  border-color: var(--accent-primary, #6366f1);
}

.checklist-edit-btn:hover {
  opacity: 0.85;
}

.checklist-topbar-add-subfolder-btn {
  width: 37px;
  height: 37px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #2a5a8a 0%, #1a3a5c 100%);
  border: none;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.checklist-topbar-add-subfolder-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0) 45%);
  border-radius: inherit;
  pointer-events: none;
}

.checklist-topbar-add-subfolder-btn:hover {
  filter: brightness(1.15);
}

.checklist-topbar-add-btn {
  width: 37px;
  height: 37px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #2a5a8a 0%, #1a3a5c 100%);
  border: none;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 1.4rem;
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.checklist-topbar-add-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0) 45%);
  border-radius: inherit;
  pointer-events: none;
}

.checklist-topbar-add-btn:hover {
  filter: brightness(1.15);
}

.checklist-logout-btn {
  background: none;
  border: none;
  color: var(--text-muted, #6b6b8d);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
}

.checklist-logout-btn:hover {
  color: var(--text-primary, #e8e8f2);
}

/* ── Content Area ────────────────────────────────────────────────────── */

.checklist-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.checklist-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-muted, #6b6b8d);
  font-size: 15px;
}

/* ── Bottom Bar ──────────────────────────────────────────────────────── */

.checklist-bottombar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
  background: var(--bg-secondary, #1a1a2e);
  border-top: 1px solid var(--border-color, #3a3a5a);
  min-height: 48px;
  flex-shrink: 0;
}

.checklist-settings-btn {
  background: none;
  border: 1px solid var(--border-color, #3a3a5a);
  color: var(--text-secondary, #a0a0c0);
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.checklist-settings-btn:hover {
  color: var(--text-primary, #e8e8f2);
  background: var(--bg-hover, #2d2d4a);
  border-color: var(--text-secondary, #a0a0c0);
}

.checklist-settings-btn.active {
  color: var(--text-primary, #e8e8f2);
  background: var(--bg-hover, #2d2d4a);
  border-color: var(--text-secondary, #a0a0c0);
}

.modal-overlay.modal-overlay-top {
  align-items: flex-start;
  padding-top: 52px;
}

.checklist-settings-inline-panel {
  background: var(--bg-secondary, #1a1a2e);
  border-bottom: 1px solid var(--border-color, #3a3a5a);
  flex-shrink: 0;
}

.checklist-settings-back-link {
  background: none;
  border: none;
  color: var(--text-secondary, #a0a0c0);
  cursor: pointer;
  padding: 0;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  transition: color 0.15s;
}

.checklist-settings-back-link:hover {
  color: var(--text-primary, #e8e8f2);
}

.checklist-bottombar-center {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  width: 100%;
}

.checklist-toggle-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checklist-toggle-caption {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted, #6b6b8d);
}

.checklist-bottombar-separator {
  width: 1px;
  height: 36px;
  background: var(--border-color, #3a3a5a);
  opacity: 0.5;
  flex-shrink: 0;
}

.checklist-view-toggle {
  display: flex;
  border: 1px solid var(--border-color, #3a3a5a);
  border-radius: 8px;
  overflow: hidden;
}

.checklist-view-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary, #a0a0c0);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 16px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.checklist-view-toggle-btn.active {
  background: var(--accent-primary, #6366f1);
  color: #fff;
}

.checklist-view-toggle-btn:not(.active):hover {
  background: var(--bg-hover, rgba(99, 102, 241, 0.1));
}

/* ── Quick-add bar ───────────────────────────────────────────────────── */

.checklist-quick-add-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-secondary, #1a1a2e);
  border-top: 1px solid var(--border-color, #3a3a5a);
  flex-shrink: 0;
}

.checklist-quick-add-close {
  background: none;
  border: none;
  color: var(--text-secondary, #a0a0c0);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}

.checklist-quick-add-close:hover {
  color: var(--text-primary, #e8e8f2);
  background: var(--bg-hover, #2d2d4a);
}

.checklist-quick-add-input {
  flex: 1;
  min-width: 0;
  padding: 5px 8px;
  font-size: 13px;
  border-radius: 4px;
  border: 1px solid var(--border-color, #3a3a5a);
  background: var(--bg-primary, #0f0f1e);
  color: var(--text-primary, #e8e8f2);
  outline: none;
  transition: border-color 0.15s;
}

.checklist-quick-add-input:focus {
  border-color: var(--accent-primary, #6366f1);
}

.checklist-quick-add-input::placeholder {
  color: var(--text-muted, #6b6b8d);
}

.checklist-quick-add-btn {
  flex-shrink: 0;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border-color, #3a3a5a);
  border-radius: 4px;
  background: var(--accent-primary, #6366f1);
  color: #fff;
  cursor: pointer;
  transition: opacity 0.15s;
}

.checklist-quick-add-btn:hover:not(:disabled) {
  opacity: 0.85;
}

.checklist-quick-add-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Tree containers ─────────────────────────────────────────────────── */

.checklist-tree {
  padding: 0;
}

.checklist-tree-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted, #6b6b8d);
  font-size: 15px;
}

.checklist-tree-toolbar {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-color, #3a3a5a);
}

.checklist-tree-expand-all,
.checklist-tree-collapse-all {
  color: var(--text-muted, #6b6b8d);
  cursor: pointer;
  font-size: 12.5px;
}

.checklist-tree-expand-all:hover,
.checklist-tree-collapse-all:hover {
  color: var(--accent-primary, #6366f1);
}

.checklist-tree-toolbar-sep {
  color: var(--text-muted, #6b6b8d);
  font-size: 12.5px;
  opacity: 0.5;
  padding: 0 6px;
}

/* ── ChecklistView inline controls ──────────────────────────────────── */

.checklist-view-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  min-height: 36px;
  border-bottom: 1px solid var(--border-color, #3a3a5a);
  flex-shrink: 0;
}

.checklist-view-controls-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.checklist-view-controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checklist-view-bottombar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
  border-top: 1px solid var(--border-color, #3a3a5a);
  min-height: 44px;
  flex-shrink: 0;
}

/* ── ChecklistModal compact overrides ───────────────────────────────── */

.checklist-modal-content {
  height: 95vh;
  display: flex;
  flex-direction: column;
}

.checklist-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px;
  min-height: 0;
}

.checklist-modal-header h3 {
  font-size: 0.95rem;
  margin: 0;
}

.checklist-modal-badge {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
}

.checklist-modal-close-btn {
  padding: 2px 10px;
  font-size: 0.8rem;
  min-width: auto;
}

.checklist-modal-content .checklist-view-controls {
  padding: 2px 8px;
  min-height: 28px;
}

.checklist-modal-content .checklist-undo-btn,
.checklist-modal-content .checklist-view-controls .checklist-undo-btn {
  width: 24px;
  height: 24px;
}

.checklist-modal-content .checklist-undo-btn svg,
.checklist-modal-content .checklist-view-controls .checklist-undo-btn svg {
  width: 14px;
  height: 14px;
}

.checklist-modal-content .checklist-edit-btn {
  font-size: 0.75rem;
  padding: 1px 8px;
}

.checklist-modal-content .checklist-topbar-add-btn {
  width: 26px;
  height: 26px;
  font-size: 16px;
}

.checklist-modal-content .checklist-view-bottombar {
  padding: 3px 0;
  min-height: 30px;
}

.checklist-modal-content .checklist-toggle-caption {
  font-size: 9px;
}

.checklist-modal-content .checklist-view-toggle-btn {
  font-size: 0.7rem;
  padding: 2px 8px;
}

.checklist-modal-content .checklist-bottombar-separator {
  padding: 0 4px;
}

/* ── Responsive: Desktop ─────────────────────────────────────────────── */

.checklist-app.desktop .checklist-content {
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.checklist-app.desktop .checklist-topbar {
  padding: 8px 24px;
}

.checklist-app.desktop .checklist-bottombar {
  padding: 8px 24px;
}

/* ── Responsive: Mobile ──────────────────────────────────────────────── */

.checklist-app.mobile .checklist-topbar-title {
  font-size: 15px;
}

.checklist-app.mobile .checklist-logout-btn {
  display: none;
}

.checklist-app.mobile .checklist-toggle-caption {
  display: none;
}
