/* ── Binder Panel — Warm Ink ── */

/* Header */
.binder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem 0.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.binder-header h3 {
  font-family: var(--font-ui);
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0;
}
.binder-header .topbar-btn {
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--duration-fast), color var(--duration-fast);
}
.binder-header .topbar-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.binder-header .topbar-btn svg { width: 14px; height: 14px; }

/* Tree container */
#binder-tree {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}

/* ── Binder Tree ── */
.binder-list {
  list-style: none;
  margin: 0;
  padding: 0 0 0 1rem;
}
.binder-list:first-child {
  padding-left: 0;
}

.binder-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem 0.3rem 0.5rem;
  cursor: pointer;
  border-radius: var(--radius);
  margin: 1px 0.4rem;
  font-family: var(--font-ui);
  font-size: var(--font-sm);
  color: var(--text-secondary);
  transition: background var(--duration-fast), color var(--duration-fast);
  user-select: none;
  position: relative;
}
.binder-row:hover {
  background: var(--surface-2);
  color: var(--text);
}
.binder-row.selected {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}
.binder-row.selected::before {
  content: '';
  position: absolute;
  left: -0.4rem;
  top: 20%;
  bottom: 20%;
  width: 2px;
  background: var(--accent);
  border-radius: 2px;
}

/* Drag handle */
.binder-drag-handle {
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 14px;
  color: var(--muted);
  opacity: 0.4;
  cursor: grab;
  transition: opacity var(--duration-fast);
}
.binder-row:hover .binder-drag-handle {
  display: flex;
  opacity: 0.7;
}
@media (max-width: 768px) {
  .binder-drag-handle {
    display: flex;
    opacity: 0.5;
  }
}

/* Chevron for folders */
.binder-chevron {
  width: 16px;
  text-align: center;
  font-size: 10px;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--muted);
  transition: color var(--duration-fast);
}
.binder-row:hover .binder-chevron,
.binder-row.selected .binder-chevron {
  color: var(--text);
}

/* Node icon */
.binder-icon {
  flex-shrink: 0;
  font-size: 14px;
  color: var(--muted);
  transition: color var(--duration-fast);
}
.binder-row.selected .binder-icon { color: var(--accent); }

/* Node label */
.binder-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--font-sm);
  min-width: 0;
}

/* ── Binder hover action buttons ── */
.binder-actions {
  display: none;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
  margin-left: 2px;
}
.binder-row:hover .binder-actions,
.binder-row.selected .binder-actions {
  display: flex;
}
.binder-action-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 5px;
  border-radius: var(--radius);
  line-height: 1;
  font-family: var(--font-ui);
  transition: background var(--duration-fast), color var(--duration-fast);
}
.binder-action-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}
.binder-action-delete:hover {
  background: var(--error) !important;
  color: #fff !important;
}

/* ── Mobile: 44px touch targets for binder ── */
@media (max-width: 768px) {
  .binder-row {
    padding: 8px 10px;
    min-height: 44px;
  }
  .binder-actions {
    display: flex; /* always show on mobile — no hover */
    gap: 2px;
  }
  .binder-action-btn {
    min-width: 36px;
    min-height: 36px;
    font-size: 13px;
    padding: 6px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .binder-chevron {
    min-width: 28px;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Inline rename input */
.binder-rename-input {
  background: var(--surface-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--font-sm);
  padding: 1px 4px;
  width: 100%;
  min-width: 60px;
  outline: 2px solid var(--accent);
  outline-offset: 0;
}

/* Collapse: hide child lists */
.binder-folder.collapsed > .binder-list {
  display: none;
}

/* ── Drag indicators ── */
.dragging {
  opacity: 0.4;
}
.drop-above {
  border-top: 2px solid var(--accent);
}
.drop-below {
  border-bottom: 2px solid var(--accent);
}
.drop-inside {
  background: var(--accent-soft);
  border-radius: var(--radius);
}

/* ── Metadata Panel — Warm Ink ── */
.metadata-panel {
  padding: 0;
}
.metadata-group {
  margin-bottom: 0.75rem;
}
.metadata-group label {
  display: block;
  font-family: var(--font-ui);
  font-size: var(--font-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
  color: var(--muted);
}
.metadata-group textarea,
.metadata-group input[type="text"],
.metadata-group select {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--font-sm);
  resize: vertical;
  box-sizing: border-box;
  transition: border-color var(--duration-fast), background var(--duration-fast);
}
.metadata-group textarea:focus,
.metadata-group input[type="text"]:focus,
.metadata-group select:focus {
  border-color: var(--accent);
  background: var(--surface);
  outline: none;
}
.metadata-group input[type="color"] {
  width: 40px;
  height: 28px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
}
/* Manage Custom Fields button — Warm Ink style */
.manage-custom-fields-btn {
  font-family: var(--font-ui);
  font-size: var(--font-xs);
  font-weight: 500;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.3rem 0.65rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: color var(--duration-fast), background var(--duration-fast), border-color var(--duration-fast);
}
.manage-custom-fields-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ── Corkboard ── */
.corkboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  padding: 12px;
}

.cork-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid transparent;
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: box-shadow var(--duration-fast);
}
.cork-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.cork-card.cork-drop-target {
  border-color: var(--accent);
}
.cork-card.dragging {
  opacity: 0.4;
}

.cork-title {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: var(--font-sm);
  color: var(--text);
  margin-bottom: 6px;
}
.cork-synopsis {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 8px;
  min-height: 34px;
}
.cork-status {
  font-size: var(--font-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
