/**
 * database-dropdown.css
 *
 * Styles for the coverage-based database dropdown with confidence indicators.
 *
 * INSTALL: Add to public/css/styles.css or include as separate file
 */

/* ============================================================
 * Dropdown Container
 * ============================================================ */

.db-dropdown {
  position: relative;
  width: 100%;
  font-family: inherit;
}

.db-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--surface, #1e1e1e);
  border: 1px solid var(--border, #333);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}

.db-dropdown-header:hover {
  border-color: var(--primary, #4a9eff);
}

.db-dropdown-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text, #fff);
}

.db-dropdown-arrow {
  margin-left: 8px;
  color: var(--text-muted, #888);
  font-size: 10px;
}

/* ============================================================
 * Confidence Colors on Header
 * ============================================================ */

.db-dropdown-header.confidence-high {
  border-left: 4px solid #22c55e; /* Green */
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.1) 0%, transparent 50%);
}

.db-dropdown-header.confidence-medium {
  border-left: 4px solid #eab308; /* Yellow */
  background: linear-gradient(90deg, rgba(234, 179, 8, 0.1) 0%, transparent 50%);
}

.db-dropdown-header.confidence-low {
  border-left: 4px solid #ef4444; /* Red */
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.1) 0%, transparent 50%);
}

/* ============================================================
 * Dropdown Options (Expanded State)
 * ============================================================ */

.db-dropdown-options {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--surface, #1e1e1e);
  border: 1px solid var(--border, #333);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 100;
  max-height: 300px;
  overflow-y: auto;
}

.db-dropdown-option {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
  transition: background-color 0.15s;
  border-left: 4px solid transparent;
}

.db-dropdown-option:hover {
  background: var(--hover, #2a2a2a);
}

.db-dropdown-option.selected {
  background: var(--primary-dim, rgba(74, 158, 255, 0.15));
}

/* ============================================================
 * Confidence Colors on Options
 * ============================================================ */

.db-dropdown-option.confidence-high {
  border-left-color: #22c55e; /* Green */
}

.db-dropdown-option.confidence-high .db-option-indicator {
  background: #22c55e;
}

.db-dropdown-option.confidence-medium {
  border-left-color: #eab308; /* Yellow */
}

.db-dropdown-option.confidence-medium .db-option-indicator {
  background: #eab308;
}

.db-dropdown-option.confidence-low,
.db-dropdown-option.other {
  border-left-color: #ef4444; /* Red */
}

.db-dropdown-option.confidence-low .db-option-indicator,
.db-dropdown-option.other .db-option-indicator {
  background: #ef4444;
}

/* ============================================================
 * Option Elements
 * ============================================================ */

.db-option-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 10px;
  flex-shrink: 0;
}

.db-option-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text, #fff);
}

.db-option-coverage {
  margin-left: 8px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-raised, #2a2a2a);
  border-radius: 4px;
  color: var(--text-muted, #888);
}

/* ============================================================
 * Divider
 * ============================================================ */

.db-dropdown-divider {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted, #666);
  background: var(--surface-dim, #151515);
  border-top: 1px solid var(--border, #333);
  border-bottom: 1px solid var(--border, #333);
}

/* ============================================================
 * Match Indicator (below dropdown)
 * ============================================================ */

.match-indicator {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  margin-top: 8px;
  border-radius: 6px;
  font-size: 13px;
  gap: 8px;
}

.match-indicator.hidden {
  display: none;
}

.match-indicator.exclusive {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #22c55e;
}

.match-indicator.multiple {
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.3);
  color: #eab308;
}

.match-indicator.no-match {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.match-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: currentColor;
  color: var(--surface, #1e1e1e);
  font-size: 11px;
  font-weight: bold;
}

.match-text {
  flex: 1;
}

.template-text {
  font-size: 12px;
  opacity: 0.8;
}

/* ============================================================
 * Error State
 * ============================================================ */

.db-dropdown-error {
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 6px;
  color: #ef4444;
}
