/* ═══════════════════════════════════════════════════════════════════════════
   ECO-MAX-CC1 · 2026-09-08 · CC-1 — единая карточка контакта (messenger ВЫШКА)
   Зона: модалка карточки (.vy-cc1-wrap/.vy-cc1), аватар в шапке чата
   (.vy-cc1-threadava), онлайн-точки в поиске и дайлере (перекрытие).
   Существующие файлы не тронуты — только аддитивный слой + перекрытия.
   Канон (как DL2/DL3/VE): тёмная база #0b1220/#111c2e, текст #edf3ff,
   акцент #1a56db / #6b96ff, danger #c33349, ok #2fbf83, Onest, тач ≥ 44px,
   1440 и 390. Z: 95 — выше дайлера (90), ниже оверлея звонка (240) и VA-меню (999).
   ═══════════════════════════════════════════════════════════════════════════ */

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

/* ─────────────────── модалка карточки контакта ─────────────────── */

.vy-cc1-wrap {
  position: fixed;
  inset: 0;
  z-index: 95; /* ниже оверлея звонка (#call-overlay), выше шелла и дайлера */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.vy-cc1-wrap[hidden],
.vy-cc1 [hidden] {
  display: none !important;
}
.vy-cc1-scrim {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 18, 0.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
body.vy-cc1-lock {
  overflow: hidden !important;
}

.vy-cc1 {
  position: relative;
  width: min(400px, 100%);
  max-height: min(640px, calc(100dvh - 40px));
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--cc1-surface);
  border: 1px solid var(--cc1-line);
  border-radius: var(--cc1-radius);
  box-shadow: 0 24px 70px rgba(2, 6, 16, 0.6);
  color: var(--cc1-text);
  font-family: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  animation: vy-cc1-pop 0.18s ease-out;
}
@keyframes vy-cc1-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.vy-cc1::before {
  content: "";
  position: sticky;
  top: 0;
  display: block;
  height: 4px;
  background: linear-gradient(90deg, #1a56db, #6b96ff 60%, rgba(107, 150, 255, 0));
  border-radius: var(--cc1-radius) var(--cc1-radius) 0 0;
}

.vy-cc1__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--cc1-muted);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}
.vy-cc1__close:hover {
  background: var(--cc1-surface-2);
  color: var(--cc1-text);
}
.vy-cc1__close:focus-visible {
  outline: 2px solid var(--cc1-accent-2);
  outline-offset: 2px;
}

/* ── шапка: аватар + имя + @username + статус ── */

.vy-cc1__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 18px 24px 6px;
  text-align: center;
}
.vy-cc1__ava {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 30px;
  font-weight: 600;
  color: #fff;
  overflow: visible;
  flex-shrink: 0;
  user-select: none;
}
.vy-cc1__ava img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.vy-cc1__ava::after {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #56607a;
  border: 3px solid var(--cc1-surface);
  transition: background 0.2s ease;
}
.vy-cc1__ava.is-online::after {
  background: var(--cc1-ok);
}
.vy-cc1__ava[data-cc1-pending="1"]::after {
  background: #56607a;
}
.vy-cc1__name {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.vy-cc1__uname {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  margin: -6px 0 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--cc1-accent-2);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.vy-cc1__uname:hover {
  background: var(--cc1-accent-soft);
}
.vy-cc1__uname:focus-visible {
  outline: 2px solid var(--cc1-accent-2);
  outline-offset: 2px;
}
.vy-cc1__uname svg {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}
.vy-cc1__status {
  font-size: 14px;
  color: var(--cc1-muted);
}
.vy-cc1__status.is-online {
  color: var(--cc1-ok);
}

/* ── инфо-строки (телефон из поиска DL1/DL2 — если известен) ── */

.vy-cc1__rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 24px 4px;
}
.vy-cc1__row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px 14px;
  border: 1px solid var(--cc1-line);
  border-radius: 14px;
  background: var(--cc1-surface-2);
  text-align: left;
}
.vy-cc1__row-ic {
  display: inline-flex;
  color: var(--cc1-accent-2);
  flex-shrink: 0;
}
.vy-cc1__row-ic svg {
  width: 18px;
  height: 18px;
}
.vy-cc1__row-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.vy-cc1__row-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cc1-muted);
}
.vy-cc1__row-value {
  font-size: 15px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* ── действия: Написать / Позвонить / Профиль ── */

.vy-cc1__actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 16px 24px 22px;
}
.vy-cc1-btn {
  min-height: 64px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 6px;
  border: 1px solid var(--cc1-line);
  border-radius: 14px;
  background: var(--cc1-surface-2);
  color: var(--cc1-text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease, filter 0.16s ease;
}
.vy-cc1-btn svg {
  width: 20px;
  height: 20px;
}
.vy-cc1-btn:hover {
  border-color: var(--cc1-line-strong);
  filter: brightness(1.08);
}
.vy-cc1-btn:active {
  transform: scale(0.96);
}
.vy-cc1-btn:focus-visible {
  outline: 2px solid var(--cc1-accent-2);
  outline-offset: 2px;
}
.vy-cc1-btn[disabled] {
  opacity: 0.55;
  cursor: default;
  transform: none;
}
.vy-cc1-btn--write {
  background: var(--cc1-accent);
  border-color: transparent;
  color: #fff;
}
.vy-cc1-btn--call {
  background: var(--cc1-accent-soft);
  color: var(--cc1-accent-2);
}
.vy-cc1__foot {
  padding: 0 24px 16px;
  text-align: center;
  font-size: 12px;
  color: var(--cc1-muted);
}

/* ── шапка чата: аватар слоя скина (.vy2-header-avatar) + имя — клик → карточка;
      онлайн-точка CC-1 поверх существующего аватара ── */

#thread-header .vy2-header-avatar {
  position: relative;
  cursor: pointer;
}
#thread-header .vy2-header-avatar::after {
  content: "";
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #56607a;
  border: 2px solid var(--surface, #111c2e);
  transition: background 0.2s ease;
}
#thread-header .vy2-header-avatar[data-cc1-online="1"]::after {
  background: var(--va-online, #2fbf83);
}
#thread-header .thread-header__info {
  cursor: pointer;
}
#thread-header .thread-header__info:hover .thread-header__name {
  color: var(--cc1-accent-2);
}

/* ── онлайн-точки: поиск (#search-hits) — перекрытие в едином стиле
      (vanilla .chat-row и VG-перерисовка .vg-hit__ava) ── */

#search-hits .chat-row__avatar[data-cc1-online],
#search-hits .vg-hit__ava[data-cc1-online] {
  position: relative;
}
#search-hits .chat-row__avatar[data-cc1-online="1"]::after,
#search-hits .vg-hit__ava[data-cc1-online="1"]::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--va-online, #2fbf83);
  border: 2px solid var(--surface, #111c2e);
}

/* ── карточки дайлера DL2: единый вид + клик по телу → карточка CC1 ── */

.eco-dial-card {
  cursor: pointer;
}
.eco-dial-card__ava {
  position: relative;
}
.eco-dial-card__ava[data-cc1-online="1"]::after {
  content: "";
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--va-online, #2fbf83);
  border: 2px solid var(--dial-surface, #111c2e);
}

/* ── мобильная верстка 390 ── */

@media (max-width: 480px) {
  .vy-cc1-wrap {
    padding: 12px;
    align-items: flex-end;
  }
  .vy-cc1 {
    width: 100%;
    max-height: calc(100dvh - 24px);
  }
  .vy-cc1__head {
    padding: 14px 16px 4px;
  }
  .vy-cc1__ava {
    width: 76px;
    height: 76px;
    font-size: 26px;
  }
  .vy-cc1__rows {
    padding: 12px 16px 2px;
  }
  .vy-cc1__actions {
    padding: 14px 16px 18px;
    gap: 8px;
  }
  .vy-cc1-btn {
    min-height: 60px;
    font-size: 12px;
  }
}
