/* ================================================================
   DETAIL PANEL — detail-panel.css
   Side panel for task detail view (Phase 4)
   ================================================================ */

/* -- Panel shell ------------------------------------------------- */
.dp-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: clamp(420px, 35vw, 500px);
  background: var(--raised);
  border-left: 1px solid var(--border);
  z-index: 50;
  transform: translateX(100%);
  transition: transform 250ms ease-out;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.dp-panel.open {
  transform: translateX(0);
}

/* -- Mobile overlay ---------------------------------------------- */
.dp-overlay {
  display: none;
}
@media (max-width: 640px) {
  .dp-overlay.visible {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 49;
  }
  .dp-panel {
    width: 100%;
    border-left: none;
    transition: none;
  }
  .dp-close-btn {
    font-size: 1.8rem;
    padding: 8px 12px;
    min-width: 44px;
    min-height: 44px;
  }
  .dp-focus-btn {
    font-size: 13px;
    padding: 10px 20px;
    min-height: 44px;
  }
  .dp-chip {
    font-size: 13px;
    padding: 8px 14px;
    min-height: 36px;
  }
  .dp-section-toggle {
    font-size: 13px;
    padding: 10px 0;
    min-height: 44px;
  }
  .dp-subtask-row {
    padding: 10px 8px;
    min-height: 44px;
  }
  .dp-subtask-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
  }
  .dp-subtask-archive {
    font-size: 18px;
    padding: 6px 8px;
    opacity: 1;
  }
  .dp-subtask-input {
    font-size: 14px;
    padding: 10px 12px;
    min-height: 44px;
  }
  .dp-notepad-tab {
    font-size: 13px;
    padding: 8px 16px;
    min-height: 36px;
  }
  .dp-notepad-textarea {
    font-size: 14px;
  }
  .dp-title {
    font-size: 22px;
  }
}

/* -- List compression (desktop) ---------------------------------- */
.v2-hub.dp-active #taskListContainer {
  transition: margin-right 250ms ease-out;
  margin-right: clamp(420px, 35vw, 500px);
}
@media (max-width: 640px) {
  .v2-hub.dp-active #taskListContainer {
    margin-right: 0;
  }
}

/* -- Selected card highlight ------------------------------------- */
.tc-card.dp-selected {
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}

/* -- Glass theme support ----------------------------------------- */
.theme-glass .dp-panel {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--raised) 80%, transparent);
}

/* -- Header ------------------------------------------------------ */
.dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.dp-close-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 150ms, background 150ms;
}
.dp-close-btn:hover {
  color: var(--text);
  background: var(--surface2);
}
.dp-save-indicator {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--success);
  opacity: 0;
  transition: opacity 200ms;
  margin-left: auto;
  margin-right: 12px;
}
.dp-save-indicator.visible {
  opacity: 1;
}
.dp-focus-btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 150ms;
}
.dp-focus-btn:hover {
  opacity: 0.85;
}

/* -- Body (scrollable) ------------------------------------------- */
.dp-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.dp-body::-webkit-scrollbar {
  width: 4px;
}
.dp-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* -- Title ------------------------------------------------------- */
.dp-title {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  outline: none;
  padding: 4px 2px;
  border-radius: 6px;
  min-height: 1.4em;
  transition: background 150ms;
  word-break: break-word;
}
.dp-title:focus {
  background: var(--surface2);
}

/* -- Meta chips -------------------------------------------------- */
.dp-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.dp-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mid);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  position: relative;
  transition: border-color 150ms, background 150ms;
  white-space: nowrap;
}
.dp-chip:hover {
  border-color: var(--accent);
  color: var(--text);
}
.dp-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dp-chip-label {
  color: var(--text-dim);
  margin-right: 2px;
}
.dp-chip-editor {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 60;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  padding: 4px;
  min-width: 140px;
  outline: none;
}
.dp-chip-editor option {
  background: var(--surface);
  color: var(--text);
}
input[type="date"].dp-chip-editor {
  color-scheme: dark;
  padding: 4px 8px;
}

/* -- Collapsible sections ---------------------------------------- */
.dp-section {
  margin-top: 20px;
}
.dp-section-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  padding: 6px 0;
  user-select: none;
}
.dp-section-toggle:hover {
  color: var(--text-mid);
}
.dp-chevron {
  display: inline-block;
  transition: transform 200ms;
  font-size: 10px;
}
.dp-chevron.collapsed {
  transform: rotate(-90deg);
}
.dp-badge {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  background: var(--surface2);
  border-radius: 8px;
  padding: 1px 7px;
  margin-left: 4px;
}
.dp-section-body {
  overflow: hidden;
  transition: max-height 200ms ease;
}
.dp-section-body.collapsed {
  max-height: 0 !important;
  overflow: hidden;
}

/* -- Subtasks ---------------------------------------------------- */
.dp-subtask-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
}
.dp-subtask-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 150ms;
}
.dp-subtask-row:hover {
  background: var(--surface2);
}
.dp-subtask-row input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.dp-subtask-title {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dp-subtask-title.done {
  text-decoration: line-through;
  color: var(--text-dim);
}
.dp-subtask-archive {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 4px;
  opacity: 0;
  transition: opacity 150ms, color 150ms;
}
.dp-subtask-row:hover .dp-subtask-archive {
  opacity: 1;
}
.dp-subtask-archive:hover {
  color: var(--critical);
}
.dp-subtask-add {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.dp-subtask-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 10px;
  outline: none;
  transition: border-color 150ms;
}
.dp-subtask-input:focus {
  border-color: var(--accent);
}
.dp-subtask-input::placeholder {
  color: var(--text-dim);
}
.dp-empty-state {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  padding: 8px 0;
}

/* -- Notepad ----------------------------------------------------- */
.dp-notepad-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 8px;
}
.dp-notepad-tab {
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 12px;
  cursor: pointer;
  transition: color 150ms, border-color 150ms, background 150ms;
}
.dp-notepad-tab:hover {
  color: var(--text-mid);
}
.dp-notepad-tab.active {
  color: var(--text);
  background: var(--surface2);
  border-color: var(--border);
}
.dp-notepad-textarea {
  width: 100%;
  min-height: 150px;
  max-height: 40vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  padding: 10px;
  resize: vertical;
  outline: none;
  transition: border-color 150ms;
  box-sizing: border-box;
}
.dp-notepad-textarea:focus {
  border-color: var(--accent);
}
.dp-notepad-textarea::placeholder {
  color: var(--text-dim);
}
.dp-notepad-preview {
  min-height: 150px;
  max-height: 40vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
  padding: 10px;
}
.dp-notepad-preview h1,
.dp-notepad-preview h2,
.dp-notepad-preview h3 {
  color: var(--text);
  margin: 0.5em 0 0.25em;
}
.dp-notepad-preview p { margin: 0.4em 0; }
.dp-notepad-preview code {
  background: var(--surface2);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 0.9em;
}
.dp-notepad-preview pre {
  background: var(--surface2);
  padding: 8px;
  border-radius: 6px;
  overflow-x: auto;
}
.dp-notepad-preview a {
  color: var(--accent);
}
.dp-notepad-preview ul,
.dp-notepad-preview ol {
  padding-left: 1.5em;
  margin: 0.4em 0;
}
.dp-notepad-status {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  margin-left: auto;
}
