/**
 * Единый «спокойный» вид нативных <select> и кастомных выпадающих панелей.
 * Открытый список option на части платформ задаёт ОС — здесь полируем триггер и все .dd-* / меню.
 */

/* ---- Шеврон через data-url (цвет secondary под light/dark и glass) ---- */
html[data-theme='light']:not([data-style='glass'])
  select:not([multiple]):not([size]):not(.no-native-select) {
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%23605E5C' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
html[data-theme='dark']:not([data-style='glass'])
  select:not([multiple]):not([size]):not(.no-native-select) {
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%239D9DA3' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
[data-style='glass'][data-theme='light'] select:not([multiple]):not([size]):not(.no-native-select) {
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%235c5c66' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
[data-style='glass'][data-theme='dark'] select:not([multiple]):not([size]):not(.no-native-select) {
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%23a1a1a6' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

select:not([multiple]):not([size]):not(.no-native-select) {
  -webkit-appearance: none;
  appearance: none;
  font: inherit;
  color: inherit;
  line-height: 1.35;
  cursor: pointer;
  box-sizing: border-box;
  max-width: 100%;
  background-color: var(--card-bg);
  border: 1px solid color-mix(in srgb, var(--filter-border) 92%, transparent);
  border-radius: var(--native-select-radius, 10px);
  padding: var(--native-select-py, 9px) var(--native-select-pr, 38px)
    var(--native-select-py, 9px) var(--native-select-pl, 14px);
  margin: 0;
  outline: none;
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px 14px;
  background-image: var(--select-chevron);
  transition:
    border-color 0.2s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.2s cubic-bezier(0.22, 1, 0.36, 1),
    background-color 0.2s ease,
    opacity 0.15s ease;
}

select:not([multiple]):not([size]):not(.no-native-select):hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 22%, var(--filter-border));
}

select:not([multiple]):not([size]):not(.no-native-select):focus,
select:not([multiple]):not([size]):not(.no-native-select):focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent),
    0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}

select:not([multiple]):not([size]):not(.no-native-select):disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

/* Мультивыбор: без стрелки */
select[multiple],
select[size]:not([size='1']) {
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  font: inherit;
  box-sizing: border-box;
  line-height: 1.35;
  background-image: none;
  background-color: var(--card-bg);
  border: 1px solid color-mix(in srgb, var(--filter-border) 92%, transparent);
  border-radius: var(--native-select-radius, 10px);
  padding: var(--native-select-py, 9px) 12px;
  outline: none;
  transition:
    border-color 0.2s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

select[multiple]:focus,
select[multiple]:focus-visible,
select[size]:not([size='1']):focus,
select[size]:not([size='1']):focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent),
    0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}

select option,
select optgroup {
  font: inherit;
  background-color: var(--dropdown-bg);
  color: var(--text);
}

select optgroup {
  font-weight: 600;
  color: var(--text-secondary);
}

/* Admin: сохранить читаемый фокус, перекрываем прежнее «тонкое» кольцо */
select.admin-input:focus,
select.admin-input:focus-visible {
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent),
    0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}

/* ---- Каталог / фильтры: .dd-list ---- */
.dd-list {
  border-radius: 12px;
}
.dd-item {
  padding: 10px 14px;
  font-size: 13px;
}
.dd-search-input {
  border-radius: 8px;
}

/* ---- Модалки проекта: клиентские списки ---- */
.proj-modal-dd__panel:not(.proj-modal-dd__panel--clients) {
  border-radius: 12px;
}
.proj-modal-dd__pick {
  padding: 10px 14px;
}

/* ---- Меню выбора папки черновика ---- */
.spec-draft-folder-menu {
  border-radius: 12px;
}

/* ---- Панель темы в шапке ---- */
.theme-panel {
  border-radius: 12px;
}

/* Модалка «Сообщить об ошибке»: тот же радиус, что у input/textarea (.report-modal__field в auth.css).
   Иначе правило выше перебивает только <select> «таблеткой» (--native-select-radius до 10–12px). */
.report-modal__field select:not([multiple]):not([size]):not(.no-native-select) {
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  select:not([multiple]):not([size]):not(.no-native-select),
  select[multiple],
  select[size]:not([size='1']) {
    transition: none;
  }
}
