/* =============================================================================
   custom-select.css — Componente Select Personalizado
   Branding: Vermelho #CC0000 · Dourado #C8963E · Grafite #1A1A1A
   ============================================================================= */

.c-custom-select {
  position: relative;
  width: 100%;
  font-family: inherit;
  user-select: none;
}

/* ── Trigger (campo visível) ─────────────────────────────────────────────── */
.c-custom-select__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--color-border, #E2DDD8);
  border-radius: 6px;
  background: var(--color-bg, #fff);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  min-height: 46px;
}

.c-custom-select__trigger:hover {
  border-color: #CC0000;
}

.c-custom-select.is-open .c-custom-select__trigger {
  border-color: #CC0000;
  box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.12);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.c-custom-select.is-valid .c-custom-select__trigger {
  border-color: #C8963E;
  box-shadow: 0 0 0 3px rgba(200, 150, 62, 0.12);
}

.c-custom-select.is-invalid .c-custom-select__trigger {
  border-color: #CC0000;
  box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.1);
}

/* ── Label (texto dentro do trigger) ─────────────────────────────────────── */
.c-custom-select__label {
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text-muted, #6B6560);
  transition: color 0.2s ease;
}

.c-custom-select__label.has-value {
  color: var(--color-text-base, #1A1A1A);
}

/* ── Seta ────────────────────────────────────────────────────────────────── */
.c-custom-select__arrow {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--color-text-muted, #6B6560);
  transition: transform 0.25s ease, color 0.2s ease;
}

.c-custom-select.is-open .c-custom-select__arrow {
  transform: rotate(180deg);
  color: #CC0000;
}

/* ── Dropdown ────────────────────────────────────────────────────────────── */
.c-custom-select__options {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 500;
  background: var(--color-bg, #fff);
  border: 1.5px solid #CC0000;
  border-top: none;
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  max-height: 260px;
  overflow-y: auto;
  display: none;
  scrollbar-width: thin;
  scrollbar-color: #CC0000 transparent;
}

.c-custom-select__options::-webkit-scrollbar {
  width: 4px;
}
.c-custom-select__options::-webkit-scrollbar-track {
  background: transparent;
}
.c-custom-select__options::-webkit-scrollbar-thumb {
  background: #CC0000;
  border-radius: 2px;
}

.c-custom-select.is-open .c-custom-select__options {
  display: block;
  animation: customSelectOpen 0.15s ease;
}

@keyframes customSelectOpen {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Opções ──────────────────────────────────────────────────────────────── */
.c-custom-select__option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--color-text-base, #1A1A1A);
  border-bottom: 1px solid var(--color-border, #E2DDD8);
  transition: background 0.15s ease, color 0.15s ease;
  position: relative;
}

.c-custom-select__option:last-child {
  border-bottom: none;
}

.c-custom-select__option:hover {
  background: rgba(204, 0, 0, 0.06);
  color: #CC0000;
}

.c-custom-select__option.is-selected {
  background: rgba(204, 0, 0, 0.08);
  color: #CC0000;
  font-weight: 600;
}

.c-custom-select__option.is-selected::after {
  content: '';
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #CC0000;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='none' stroke='%23fff' stroke-width='3' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M5 13l4 4L19 7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 10px;
}

/* ── Separador de grupo ──────────────────────────────────────────────────── */
.c-custom-select__group {
  padding: 0.4rem 1rem 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted, #6B6560);
  background: var(--color-bg-muted, #F7F5F2);
  border-bottom: 1px solid var(--color-border, #E2DDD8);
}

/* ── Dark mode ───────────────────────────────────────────────────────────── */
[data-theme="dark"] .c-custom-select__trigger {
  background: var(--color-bg, #14120F);
  border-color: var(--color-border, #322D27);
}

[data-theme="dark"] .c-custom-select__options {
  background: #1E1B17;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .c-custom-select__option {
  color: #F3F0EB;
  border-color: rgba(255, 255, 255, 0.07);
}

[data-theme="dark"] .c-custom-select__option:hover {
  background: rgba(204, 0, 0, 0.14);
  color: #E8B96A;
}

[data-theme="dark"] .c-custom-select__option.is-selected {
  background: rgba(204, 0, 0, 0.18);
  color: #E8B96A;
}

[data-theme="dark"] .c-custom-select__group {
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.4);
  border-color: rgba(255, 255, 255, 0.07);
}

[data-theme="dark"] .c-custom-select__label {
  color: rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] .c-custom-select__label.has-value {
  color: #F3F0EB;
}
