/* ═══════════════════════════════════════════════════════════════════════════
   ECO-MAX-DIAL · 2026-09-08 · DL2 — «Набрать номер» (дайлер ВЫШКИ)
   Зона: триггер у поиска в списке чатов (.eco-dial-trigger), модалка дайлера
   (.eco-dial-wrap / .eco-dial). Только визуал: существующие файлы не тронуты.
   Канон (как VE-слой): тёмная база #0b1220/#111c2e, текст #edf3ff,
   акцент #1a56db / #6b96ff, danger #c33349, Onest, тач ≥ 44px, 1440 и 390.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --dial-bg: #0b1220;
  --dial-surface: #111c2e;
  --dial-surface-2: #16233a;
  --dial-line: rgba(107, 150, 255, 0.16);
  --dial-line-strong: rgba(107, 150, 255, 0.28);
  --dial-text: #edf3ff;
  --dial-muted: rgba(237, 243, 255, 0.58);
  --dial-accent: #1a56db;
  --dial-accent-2: #6b96ff;
  --dial-accent-soft: rgba(26, 86, 219, 0.16);
  --dial-danger: #c33349;
  --dial-ok: #2fbf83;
  --dial-radius: 20px;
}

/* ─────────────────── Триггер «Набрать» рядом с поиском ─────────────────── */

#panel-list .search.eco-dial-on {
  position: relative;
}
#panel-list .search.eco-dial-on .search__input {
  padding-right: 58px;
}
.eco-dial-trigger {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--dial-line);
  border-radius: 13px;
  background: var(--dial-accent-soft);
  color: var(--dial-accent-2);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}
.eco-dial-trigger:hover {
  background: rgba(26, 86, 219, 0.3);
  border-color: var(--dial-line-strong);
  color: #cfe0ff;
}
.eco-dial-trigger:active {
  transform: translateY(-50%) scale(0.94);
}
.eco-dial-trigger:focus-visible {
  outline: 2px solid var(--dial-accent-2);
  outline-offset: 2px;
}

/* ─────────────────────────── Обёртка и подложка ─────────────────────────── */

.eco-dial-wrap {
  position: fixed;
  inset: 0;
  z-index: 90; /* ниже оверлея звонка (#call-overlay), выше шелла */
}
.eco-dial-wrap.hidden {
  display: none;
}
.eco-dial-scrim {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 16, 0.66);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: dial-fade 0.16s ease both;
}
body.eco-dial-lock {
  overflow: hidden;
}

/* ─────────────────────────────── Модалка ────────────────────────────────── */

.eco-dial {
  position: absolute;
  left: 50%;
  top: 14vh;
  transform: translateX(-50%);
  width: min(480px, calc(100vw - 32px));
  max-height: min(76vh, 720px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #111c2e 0%, #0e1729 100%);
  border: 1px solid var(--dial-line);
  border-radius: var(--dial-radius);
  box-shadow: 0 24px 64px rgba(2, 6, 14, 0.6), 0 0 0 1px rgba(4, 8, 16, 0.4);
  color: var(--dial-text);
  font-family: "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  animation: dial-pop 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
@keyframes dial-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes dial-pop {
  from { opacity: 0; transform: translateX(-50%) translateY(14px) scale(0.98); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

.eco-dial__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 12px 18px;
  border-bottom: 1px solid var(--dial-line);
  background: linear-gradient(180deg, #131f33 0%, #101a2b 100%);
}
.eco-dial__head-ic {
  width: 40px;
  height: 40px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  background: var(--dial-accent-soft);
  color: var(--dial-accent-2);
  border: 1px solid var(--dial-line);
}
.eco-dial__title {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--dial-text);
  flex: 1;
  min-width: 0;
}
.eco-dial__close {
  width: 44px;
  height: 44px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--dial-muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.16s ease, color 0.16s ease;
}
.eco-dial__close:hover {
  background: rgba(237, 243, 255, 0.08);
  color: var(--dial-text);
}
.eco-dial__close:focus-visible {
  outline: 2px solid var(--dial-accent-2);
  outline-offset: 2px;
}

/* ── поле номера ── */
.eco-dial__field {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 16px 6px;
  padding: 0 14px;
  min-height: 56px;
  background: var(--dial-surface-2);
  border: 1px solid var(--dial-line-strong);
  border-radius: 16px;
  color: var(--dial-accent-2);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.eco-dial__field:focus-within {
  border-color: var(--dial-accent-2);
  box-shadow: 0 0 0 3px rgba(107, 150, 255, 0.14);
}
.eco-dial__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  min-height: 54px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--dial-text);
  font-family: inherit;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  caret-color: var(--dial-accent-2);
}
.eco-dial__input::placeholder {
  color: rgba(237, 243, 255, 0.34);
  font-weight: 500;
}

.eco-dial__status {
  padding: 2px 20px 10px;
  min-height: 26px;
  font-size: 12.5px;
  color: var(--dial-muted);
}
.eco-dial__status.is-error {
  color: #ff92a6;
}

/* ── результаты ── */
.eco-dial__list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 12px calc(16px + env(safe-area-inset-bottom, 0px));
  overscroll-behavior: contain;
}
.eco-dial-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 8px;
  color: var(--dial-muted);
  font-size: 14px;
}
.eco-dial-loading--muted {
  justify-content: center;
}
.eco-dial-spinner {
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 50%;
  border: 2px solid rgba(107, 150, 255, 0.25);
  border-top-color: var(--dial-accent-2);
  animation: dial-spin 0.8s linear infinite;
}
@keyframes dial-spin {
  to { transform: rotate(360deg); }
}

.eco-dial-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
  padding: 12px 10px;
  margin: 2px 4px;
  border-radius: 16px;
  border: 1px solid transparent;
  transition: background 0.16s ease, border-color 0.16s ease;
}
.eco-dial-card:hover {
  background: rgba(22, 35, 58, 0.75);
  border-color: var(--dial-line);
}
.eco-dial-card__ava {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--dial-accent);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  user-select: none;
}
.eco-dial-card__body {
  min-width: 0;
}
.eco-dial-card__name {
  font-size: 15px;
  font-weight: 620;
  color: var(--dial-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.eco-dial-card__num {
  margin-top: 2px;
  font-size: 13px;
  color: var(--dial-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.eco-dial-card__actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-top: 10px;
}
.eco-dial-card__actions .eco-dial-btn {
  flex: 1;
}

.eco-dial-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 13px;
  border: 1px solid var(--dial-line-strong);
  background: var(--dial-surface-2);
  color: var(--dial-text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 620;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease, color 0.16s ease;
}
.eco-dial-btn:focus-visible {
  outline: 2px solid var(--dial-accent-2);
  outline-offset: 2px;
}
.eco-dial-btn:active {
  transform: scale(0.97);
}
.eco-dial-btn[disabled] {
  opacity: 0.6;
  cursor: default;
}
.eco-dial-btn--call {
  background: linear-gradient(180deg, #1d5fe0 0%, #1a56db 100%);
  border-color: rgba(107, 150, 255, 0.45);
  color: #fff;
  box-shadow: 0 6px 18px rgba(26, 86, 219, 0.35);
}
.eco-dial-btn--call:hover {
  background: linear-gradient(180deg, #2a6cf0 0%, #1d5fe0 100%);
}
.eco-dial-btn--msg:hover {
  background: rgba(107, 150, 255, 0.14);
  border-color: var(--dial-accent-2);
  color: #cfe0ff;
}
.eco-dial-btn.is-busy {
  opacity: 0.55;
}
.eco-dial-btn--invite {
  min-width: 220px;
  background: var(--dial-accent-soft);
  border-color: var(--dial-line-strong);
  color: var(--dial-accent-2);
  margin-top: 14px;
}
.eco-dial-btn--invite:hover {
  background: rgba(26, 86, 219, 0.3);
  color: #cfe0ff;
}

/* ── пустые состояния ── */
.eco-dial-idle,
.eco-dial-nouser,
.eco-dial-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 30px 18px 26px;
  color: var(--dial-muted);
}
.eco-dial-idle__ic,
.eco-dial-nouser__ic {
  width: 72px;
  height: 72px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(22, 35, 58, 0.9);
  border: 1px solid var(--dial-line);
  color: var(--dial-accent-2);
  margin-bottom: 8px;
}
.eco-dial-idle strong,
.eco-dial-nouser strong {
  color: var(--dial-text);
  font-size: 15.5px;
  font-weight: 650;
}
.eco-dial-idle span,
.eco-dial-nouser span {
  font-size: 13.5px;
  max-width: 300px;
  line-height: 1.45;
}
.eco-dial-empty {
  font-size: 14px;
}

/* ─────────────────────────── Адаптив ≤ 640px ────────────────────────────── */

@media (max-width: 640px) {
  .eco-dial {
    left: 0;
    top: auto;
    bottom: 0;
    transform: none;
    width: 100%;
    max-height: 86vh;
    border-radius: 22px 22px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    animation: dial-sheet 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.1) both;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  @keyframes dial-sheet {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .eco-dial__head {
    padding: 14px 12px 10px 16px;
  }
  .eco-dial__head::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 4px;
    border-radius: 2px;
    background: rgba(237, 243, 255, 0.18);
  }
  .eco-dial {
    position: absolute;
  }
  .eco-dial__field {
    margin: 12px 12px 6px;
  }
}

/* ── prefers-reduced-motion ── */
@media (prefers-reduced-motion: reduce) {
  .eco-dial-scrim,
  .eco-dial {
    animation: none;
  }
  .eco-dial-spinner {
    animation-duration: 1.6s;
  }
}
