/* ============================================
 * Custom Columns — Modal, Editors, Renderers
 * ============================================ */

/* Modal overrides */
.cc-modal-content {
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
}

.cc-modal-title {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 600;
}

/* Form */
.cc-form-group {
  margin-bottom: 14px;
}

.cc-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6b7280;
  margin-bottom: 6px;
}

.cc-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
  margin-top: 4px;
}

.cc-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  box-sizing: border-box;
}

.cc-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.cc-input-sm {
  width: 80px;
}

.cc-textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}

.cc-textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.cc-hint {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 4px;
}

/* Type picker grid (2x4) */
.cc-type-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.cc-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.cc-type-btn:hover {
  border-color: #a5b4fc;
  background: #f5f3ff;
}

.cc-type-btn.active {
  border-color: #6366f1;
  background: #eef2ff;
  box-shadow: 0 0 0 1px #6366f1;
}

.cc-type-icon {
  font-size: 18px;
  line-height: 1;
}

.cc-type-label {
  font-size: 11px;
  color: #374151;
  font-weight: 500;
}

/* Config panel */
.cc-config-panel {
  margin-bottom: 14px;
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.cc-config-row {
  display: flex;
  gap: 12px;
}

.cc-config-field {
  flex: 1;
  margin-bottom: 8px;
}

.cc-config-field:last-child {
  margin-bottom: 0;
}

/* Existing columns list (manage section) */
.cc-manage-section {
  margin-top: 8px;
}

.cc-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 12px 0;
}

.cc-existing-list {
  max-height: 200px;
  overflow-y: auto;
}

.cc-existing-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
}

.cc-existing-item:hover {
  background: #f3f4f6;
}

.cc-existing-type {
  width: 20px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}

.cc-existing-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cc-existing-edit,
.cc-existing-delete {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
  color: #9ca3af;
  transition: color 0.15s;
  font-family: inherit;
}

.cc-existing-edit:hover {
  color: #6366f1;
}

.cc-existing-delete:hover {
  color: #ef4444;
}

/* ============================================
 * Cell Renderers
 * ============================================ */

/* Tags */
.cc-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  line-height: 18px;
  white-space: nowrap;
}

/* Rating stars */
.cc-rating {
  display: inline-flex;
  gap: 1px;
  cursor: pointer;
}

.cc-star {
  color: #d1d5db;
  font-size: 16px;
  transition: color 0.1s;
  cursor: pointer;
}

.cc-star.filled {
  color: #f59e0b;
}

.cc-star:hover {
  color: #fbbf24;
}

/* Checkbox */
.cc-checkbox {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: #6366f1;
}

/* URL */
.cc-url {
  color: #6366f1;
  text-decoration: none;
  font-size: 12px;
}

.cc-url:hover {
  text-decoration: underline;
}

/* ============================================
 * Select Editor Popup
 * ============================================ */

/* Override AG Grid popup editor wrapper to fit content */
.ag-popup-editor {
  width: auto !important;
  height: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
}

.cc-select-editor {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  padding: 4px;
  min-width: 120px;
  max-width: 220px;
  max-height: 200px;
  overflow-y: auto;
  width: max-content;
}

.cc-select-options {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.cc-select-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  user-select: none;
  transition: background 0.05s;
}

.cc-select-option:hover {
  background: #f3f4f6;
}

.cc-select-option:active {
  background: #e5e7eb;
}

.cc-select-option.selected {
  background: #eef2ff;
}

.cc-select-option.focused {
  outline: 2px solid #6366f1;
  outline-offset: -2px;
}

.cc-select-option input[type="checkbox"],
.cc-select-option input[type="radio"] {
  display: none;
}

.cc-select-empty {
  color: #9ca3af;
  font-size: 11px;
  padding: 6px;
  text-align: center;
}

.cc-tag-clear {
  background: #f3f4f6 !important;
  color: #6b7280;
  font-size: 11px;
}

.cc-select-clear:hover .cc-tag-clear {
  background: #fee2e2 !important;
  color: #dc2626;
}

/* Date editor */
.cc-date-editor {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
}

/* ============================================
 * "+" Button for Column Picker
 * ============================================ */

.cc-add-column-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  color: #6366f1;
  background: none;
  border: 1px dashed #a5b4fc;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.cc-add-column-btn:hover {
  background: #eef2ff;
  border-color: #6366f1;
}

/* Dark theme support */
.ag-theme-alpine-dark .cc-select-editor {
  background: #1f2937;
  border-color: #374151;
}

.ag-theme-alpine-dark .cc-select-option:hover {
  background: #374151;
}

.ag-theme-alpine-dark .cc-select-option:active {
  background: #4b5563;
}

.ag-theme-alpine-dark .cc-select-option.selected {
  background: #312e81;
}

.ag-theme-alpine-dark .cc-select-option.focused {
  outline-color: #818cf8;
}

/* Text Editor (popup textarea) */
.cc-text-editor {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  padding: 8px;
  min-width: 280px;
}

.cc-text-textarea {
  width: 100%;
  min-width: 260px;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  background: #fff;
  color: #111827;
}

.cc-text-textarea:focus {
  outline: none;
  border-color: #C41230;
  box-shadow: 0 0 0 2px rgba(196, 18, 48, 0.1);
}

/* ============================================
 * Vote Cell
 * ============================================ */

.cc-vote-cell {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  user-select: none;
}

.cc-vote-score {
  font-weight: 600;
  font-size: 13px;
  min-width: 24px;
  text-align: center;
}

.cc-vote-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  padding: 1px 4px;
  font-size: 12px;
  color: #9ca3af;
  transition: all 0.15s;
  font-family: inherit;
  line-height: 1;
}

.cc-vote-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.cc-vote-btn.cc-vote-up:hover,
.cc-vote-btn.cc-vote-up.active {
  color: #16a34a;
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.cc-vote-btn.cc-vote-down:hover,
.cc-vote-btn.cc-vote-down.active {
  color: #dc2626;
  background: #fef2f2;
  border-color: #fecaca;
}

.cc-vote-count {
  font-size: 11px;
  font-weight: 500;
}

/* Vote tooltip (appended to body to escape AG Grid overflow clipping) */
.cc-vote-tooltip {
  display: none;
  position: fixed;
  transform: translateX(-50%) translateY(-100%);
  background: #1f2937;
  color: #f9fafb;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 10000;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.cc-vote-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1f2937;
}

.cc-vote-tip-row {
  line-height: 1.4;
}
