/* Contentable Field - Admin Form Styling
 * Design: Clean, professional admin interface
 * Spacing: 4px grid (4, 8, 12, 16, 24, 32)
 * Colors: Neutral grays with blue accents
 */

/* ===== FIELD UNIT OVERRIDES ===== */

.field-unit--contentable {
  margin-bottom: 24px;
}

.field-unit--contentable .field-unit__hint {
  margin-top: 6px;
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
}

/* ===== SEARCH WRAPPER ===== */

.contentable-search-wrapper {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
}

.contentable-search-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #475569;
}

/* Search Container (positioning context for dropdown) */
.contentable-search-container {
  position: relative !important;
  width: 100%;
  isolation: isolate;
}

/* Search Input Styling */
.contentable-search-container input[type="text"] {
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  line-height: 1.5;
  color: #1e293b;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  transition: border-color 150ms ease-out, box-shadow 150ms ease-out;
}

.contentable-search-container input[type="text"]:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.contentable-search-container input[type="text"]::placeholder {
  color: #94a3b8;
}

/* ===== RESULTS DROPDOWN ===== */

.contentable-results-dropdown {
  display: none !important;
  position: absolute !important;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 9999 !important;
  margin-top: 4px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
              0 4px 6px -2px rgba(0, 0, 0, 0.05);
  max-height: 280px;
  overflow-x: hidden;
  overflow-y: auto;
}

.contentable-results-dropdown[style*="display: block"] {
  display: block !important;
}

/* Scrollbar styling for dropdown */
.contentable-results-dropdown::-webkit-scrollbar {
  width: 8px;
}

.contentable-results-dropdown::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 0 8px 8px 0;
}

.contentable-results-dropdown::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.contentable-results-dropdown::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ===== RESULT ITEMS ===== */

.contentable-result-item {
  display: block !important;
  width: 100% !important;
  text-align: left !important;
  padding: 10px 12px !important;
  margin: 0 !important;
  border: none !important;
  border-bottom: 1px solid #f1f5f9 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: inherit !important;
  font-size: 14px !important;
  font-weight: normal !important;
  cursor: pointer !important;
  transition: background-color 150ms ease-out !important;
  box-shadow: none !important;
  text-transform: none !important;
  letter-spacing: normal !important;
}

.contentable-result-item:first-child {
  border-radius: 8px 8px 0 0 !important;
}

.contentable-result-item:last-child {
  border-bottom: none !important;
  border-radius: 0 0 8px 8px !important;
}

.contentable-result-item:hover {
  background: #f8fafc !important;
  color: inherit !important;
}

.contentable-result-item:active {
  background: #f1f5f9 !important;
}

.contentable-result-name {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #0f172a;
  line-height: 1.4;
}

.contentable-result-subtext {
  display: block;
  font-size: 13px;
  color: #64748b;
  margin-top: 2px;
  line-height: 1.4;
}

/* ===== SELECTED ITEM ===== */

.contentable-selected-container {
  margin-top: 16px;
}

.contentable-selected-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 12px 14px;
}

.contentable-selected-info {
  flex: 1;
  min-width: 0;
}

.contentable-selected-name {
  font-size: 14px;
  font-weight: 500;
  color: #0c4a6e;
  line-height: 1.4;
}

.contentable-selected-subtext {
  font-size: 13px;
  color: #0369a1;
  margin-top: 2px;
  line-height: 1.4;
}

.contentable-selected-meta {
  font-size: 12px;
  color: #0284c7;
  margin-top: 4px;
  font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
}

/* ===== CLEAR BUTTON ===== */

.contentable-clear-btn {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 150ms ease-out;
}

.contentable-clear-btn:hover {
  color: #ef4444;
  background: #fee2e2;
}

.contentable-clear-btn:active {
  background: #fecaca;
}

.contentable-clear-btn svg {
  width: 16px;
  height: 16px;
}

/* ===== EMPTY STATES ===== */

.contentable-global-message,
.contentable-empty-state,
.contentable-error-state {
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
}

.contentable-global-message {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.contentable-empty-state {
  padding: 16px 14px;
  color: #64748b;
  text-align: center;
}

.contentable-error-state {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */

@media (max-width: 768px) {
  .contentable-search-wrapper {
    margin-top: 16px;
    padding-top: 16px;
  }

  .contentable-results-dropdown {
    max-height: 240px;
  }
}
