/* VPN SOPRANO — Support Chat Widget (v17) */

:root{
  /*
    ✅ Widget inherits the site theme (app.css tokens).
    Fallbacks keep the chat readable if widget is embedded elsewhere.
  */
  --sc-bg:        var(--bg0, #010410);
  --sc-card:      var(--glass, rgba(255,255,255,.085));
  --sc-text:      var(--text, rgba(232,247,255,.94));
  --sc-muted:     var(--muted, rgba(232,247,255,.68));

  --sc-border:    var(--stroke, rgba(168,239,249,.18));
  --sc-input-bg:  rgba(255,255,255,.06);

  --sc-accent:    var(--accent, #25B9EF);
  --sc-accent2:   var(--pAccent, #075AA1);
  --sc-accent3:   var(--accent2, #A8EFF9);

  /* close / attention */
  --sc-pink:      var(--pAccent, #075AA1);
  --sc-pink-soft: rgba(7,90,161,.14);

  --sc-danger:    var(--bad, rgba(255,59,48,.96));
  --sc-danger-soft: rgba(255,59,48,.14);

  --sc-ok:        rgba(160,255,226,.95);
  --sc-ok-bg:     rgba(168,239,249,.10);
  --sc-ok-br:     rgba(168,239,249,.22);

  --sc-err:       rgba(255,179,179,.96);
  --sc-err-bg:    rgba(255,59,48,.10);
  --sc-err-br:    rgba(255,59,48,.22);
}

.sc-overlay, .sc-overlay * ,
.sc-modal, .sc-modal *{
  box-sizing: border-box;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* жёстко прячем скрытые блоки (важно против конфликтов CSS) */
.sc-modal [hidden]{ display:none !important; }

.sc-overlay{
  position: fixed;
  inset: 0;
  background: rgba(3,1,10,.62);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 14px;
}

/* контейнер */
.sc-modal{
  width: 100%;
  max-width: 520px;
  background: var(--sc-card);
  border: 1px solid var(--sc-border);
  border-radius: var(--radius2, 28px);
  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
  box-shadow:
    var(--shadow3, 0 26px 85px rgba(0,0,0,.62)),
    0 0 0 1px rgba(168,239,249,.10),
    0 0 22px rgba(168,239,249,.12),
    0 0 22px rgba(7,90,161,.10);
  overflow: hidden;
  color: var(--sc-text);
  position: relative;
  isolation: isolate;
}

/* subtle highlight like .glass */
.sc-modal:after{
  content:"";
  position:absolute;
  inset:0;
  border-radius: inherit;
  pointer-events:none;
  opacity:.35;
  background: radial-gradient(900px 260px at 20% 0%, rgba(255,255,255,.18), transparent 55%);
  mix-blend-mode: screen;
}

/* inner neon rim */
.sc-modal:before{
  content:"";
  position:absolute;
  inset:-1px;
  border-radius: inherit;
  pointer-events:none;
  background: linear-gradient(135deg,
    rgba(168,239,249,.22),
    rgba(37,185,239,.14),
    rgba(7,90,161,.18));
  opacity:.52;
  mix-blend-mode: screen;

  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  padding: 1px;
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

/* ===== верхний бренд-блок ===== */
.sc-topbar{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding:14px 14px 10px;
  border-bottom:1px solid var(--sc-border);
}

.sc-brand{
  display:flex;
  align-items:center;
  gap:10px;
  min-width: 0;
}

.sc-brand-logo{
  width:52px;
  height:52px;
  border-radius:14px;
  overflow:hidden;
  border: 1px solid rgba(255,255,255,.14);
  box-shadow:
    0 0 0 1px rgba(168,239,249,.10),
    0 0 0 2px rgba(7,90,161,.08) inset,
    0 14px 28px rgba(0,0,0,.35);
  background: rgba(255,255,255,.06);
  flex: 0 0 auto;
}

.sc-brand-logo img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.sc-brand-text{
  display:flex;
  flex-direction:column;
  gap:2px;
  line-height:1.05;
  min-width: 0;
}

.sc-brand-main{
  font-weight: 900;
  font-size: 18px;
  letter-spacing: .4px;
  white-space: nowrap;
}

.sc-brand-main .sc-dash{ margin: 0 6px; opacity:.9; }

/* кнопки справа (сначала кабинет, ниже закрыть/свернуть) */
.sc-top-actions{
  display:flex;
  flex-direction: column;
  gap:10px;
  align-items:flex-end;
  flex: 0 0 auto;
}

/* =========================================================
   ✅ КАБИНЕТ — 1:1 как на главной (index.php + style.css)
   ========================================================= */

/* База кнопки как .store-badge из style.css */
.sc-modal .store-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:6px 12px;

  border-radius:999px;
  font-size:13px;
  font-weight:600;

  text-decoration:none;
  white-space:nowrap;

  border: 1px solid rgba(255,255,255,.14);
  background: var(--btn, rgba(255,255,255,.09));
  color: var(--sc-text);

  box-shadow: var(--shadow1, 0 10px 28px rgba(0,0,0,.28));

  transition:
    background .15s ease,
    box-shadow .15s ease,
    transform .12s ease,
    border-color .15s ease,
    color .15s ease;

  /* ширина как на главной */
  min-width:190px;
}

.sc-modal .store-badge:hover,
.sc-modal .store-badge:focus-visible{
  background:
    radial-gradient(circle at 0 0, rgba(255,255,255,.14), transparent 64%),
    linear-gradient(135deg, rgba(7,90,161,.28), rgba(168,239,249,.16));
  border-color: rgba(168,239,249,.22);
  box-shadow:
    0 16px 44px rgba(0,0,0,.42),
    0 0 18px rgba(168,239,249,.08),
    0 0 18px rgba(7,90,161,.07);
  transform:translateY(-1px);
}

.sc-modal .store-badge:active{
  transform:translateY(0);
  box-shadow: var(--shadow1, 0 10px 28px rgba(0,0,0,.28));
}

/* В шапке на главной убирается пунктир у top-nav-link — здесь просто на всякий */
.sc-modal .top-nav-link{ border-bottom:none; }

/* Фиолетовый “скин” как .cabinet-btn из style.css (БЕЗ изменения формы/размера!) */
.sc-modal .cabinet-btn{
  border: 1px solid rgba(168,239,249,.18) !important;
  color: var(--sc-text) !important;
  background:
    radial-gradient(140px 120px at 30% 20%, rgba(255,255,255,.14), transparent 64%),
    linear-gradient(135deg, rgba(7,90,161,.26), rgba(168,239,249,.16)) !important;
  box-shadow:
    0 16px 44px rgba(0,0,0,.42),
    0 0 18px rgba(168,239,249,.08),
    0 0 18px rgba(7,90,161,.07) !important;
}

.sc-modal .cabinet-btn:hover,
.sc-modal .cabinet-btn:focus-visible{
  background:
    radial-gradient(160px 140px at 30% 20%, rgba(255,255,255,.18), transparent 66%),
    linear-gradient(135deg, rgba(7,90,161,.32), rgba(168,239,249,.20)) !important;
  border-color: rgba(168,239,249,.22) !important;
}

.sc-modal .cabinet-btn:active{
  transform: translateY(0);
  box-shadow:
    0 10px 28px rgba(0,0,0,.28) !important;
}

/* ===== Закрыть/свернуть — выше и розовая ===== */
.sc-action.sc-closebtn{
  display:inline-flex;
  align-items:center;
  justify-content:center;

  min-width: 190px;   /* как на главной по ширине */
  height: 40px;       /* ВЫШЕ, чем кабинет */
  padding: 0 18px;
  border-radius: 999px;

  background: rgba(255,255,255,.06);
  color: var(--sc-text);
  font-weight: 900;

  border: 1px solid rgba(255,255,255,.14);
  box-shadow: none;

  cursor:pointer;
  font-size: 12px;
  line-height: 1;
  text-shadow: 0.35px 0 0 currentColor, -0.35px 0 0 currentColor;

}

.sc-action.sc-closebtn:hover,
.sc-action.sc-closebtn:focus-visible{
  background:
    radial-gradient(circle at 0 0, rgba(7,90,161,.22), transparent 60%),
    rgba(255,255,255,.08);
  border-color: rgba(168,239,249,.22);
}

.sc-action.sc-closebtn:active{ transform: translateY(1px); }

/* =========================
   МОДАЛКА: убрать "Кабинет" и сделать кнопку закрыть/свернуть крестиком
   (не влияет на страницу /support_chat/chat.php)
   ========================= */

/* В модалке (когда есть overlay) скрываем кнопку "Кабинет" */
.sc-overlay .cabinet-btn{ display:none !important; }

/* В модалке превращаем кнопку "Закрыть / свернуть" в кнопку-крестик */
.sc-overlay .sc-action.sc-closebtn{
  min-width: 40px !important;
  width: 40px !important;
  height: 40px !important;
  padding: 0 !important;
  border-radius: 999px !important;
  position: relative;
  text-indent: -9999px;
  overflow: hidden;
  text-shadow: none;
}

.sc-overlay .sc-action.sc-closebtn::after{
  content: "×";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-indent: 0;
  font-size: 28px;
  line-height: 1;
  color: var(--sc-text);
}

/* На странице /support_chat/chat.php тоже превращаем кнопку закрыть/свернуть в крестик */
#supportChatPage .sc-action.sc-closebtn{
  min-width: 40px !important;
  width: 40px !important;
  height: 40px !important;
  padding: 0 !important;
  border-radius: 999px !important;
  position: relative;
  text-indent: -9999px;
  overflow: hidden;
  text-shadow: none;
}

#supportChatPage .sc-action.sc-closebtn::after{
  content: "×";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-indent: 0;
  font-size: 28px;
  line-height: 1;
  color: var(--sc-text);
}


/* ===== заголовок "Чат поддержки" ===== */
.sc-head{
  padding: 12px 14px;
  border-bottom: 1px solid var(--sc-border);
}

.sc-title{
  font-weight: 900;
  font-size: 22px;
}

/* ===== тело ===== */
.sc-body{ padding: 14px; }

.sc-row{ margin-bottom: 10px; }

.sc-label{
  font-size: 13px;
  font-weight: 900;
  margin-bottom: 6px;
  color: var(--sc-text);
  text-align: left;
  padding-left: 6px;
}

/* Ввод/печать — белым жирным */
.sc-input,
.sc-textarea{
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--sc-border);
  background: var(--sc-input-bg);
  color: var(--sc-text) !important;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 800 !important;
  caret-color: var(--sc-text) !important;
  outline: none;
  -webkit-text-fill-color: var(--sc-text) !important; /* iOS Safari */
}

/* убираем “белую плёнку” от автозаполнения */
.sc-input:-webkit-autofill,
.sc-textarea:-webkit-autofill{
  -webkit-text-fill-color: var(--sc-text) !important;
  transition: background-color 999999s ease-out 0s;
  -webkit-box-shadow: 0 0 0px 1000px var(--sc-input-bg) inset !important;
  box-shadow: 0 0 0px 1000px var(--sc-input-bg) inset !important;
  border: 1px solid var(--sc-border) !important;
}

.sc-input::placeholder,
.sc-textarea::placeholder{
  color: rgba(255,255,255,.55) !important;
  font-weight: 700;
}

/* ===== RTL support (fa / Arabic-script locales) ===== */
html[dir="rtl"] .sc-label{
  text-align: right;
  padding-left: 0;
  padding-right: 6px;
}

html[dir="rtl"] .sc-input,
html[dir="rtl"] .sc-textarea{
  text-align: right;
}

.sc-input:focus,
.sc-textarea:focus{
  border-color: rgba(168,239,249,.22);
  box-shadow:
    0 0 0 3px rgba(7,90,161,.18),
    0 0 0 1px rgba(168,239,249,.10) inset;
}

.sc-textarea{
  min-height: 90px;
  resize: vertical;
}

/* залоченный email (из URL) */
.sc-input.sc-locked{
  opacity: .95;
  cursor: not-allowed;
}

/* кнопки */
.sc-btn{
  width: 100%;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 14px;
  padding: 12px 12px;
  background:
    radial-gradient(140px 120px at 30% 20%, rgba(255,255,255,.22), transparent 58%),
    linear-gradient(135deg, rgba(7,90,161,.92), rgba(168,239,249,.55));
  color: var(--sc-text);
  font-weight: 900;
  cursor: pointer;
  position: relative;
  font-size: 16px;
  line-height: 1.1;
  box-shadow:
    0 18px 60px rgba(0,0,0,.55),
    0 0 34px rgba(168,239,249,.14),
    0 0 34px rgba(7,90,161,.14);
}

.sc-btn:hover,
.sc-btn:focus-visible{
  background:
    radial-gradient(160px 140px at 30% 20%, rgba(255,255,255,.26), transparent 60%),
    linear-gradient(135deg, rgba(7,90,161,.96), rgba(168,239,249,.62));
  border-color: rgba(168,239,249,.22);
}

.sc-btn:focus-visible{
  outline:none;
  box-shadow:
    0 0 0 3px rgba(7,90,161,.18),
    0 18px 60px rgba(0,0,0,.55);
}

.sc-btn[disabled]{ opacity: .65; cursor: not-allowed; }

.sc-btn.is-loading{
  opacity: .75;
  pointer-events: none;
}

.sc-btn.is-loading::after{
  content:"";
  position:absolute;
  right:14px;
  top:50%;
  width:16px;
  height:16px;
  margin-top:-8px;
  border-radius:50%;
  border:2px solid rgba(11,16,32,.35);
  border-top-color: rgba(11,16,32,.95);
  animation: scspin .8s linear infinite;
}

@keyframes scspin{ to{ transform: rotate(360deg); } }

.sc-note{
  margin-top: 10px;
  color: var(--sc-muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
  font-weight: 700;
}

/* ссылки внутри подсказок */
.sc-note a,
.sc-inline-link{
  color: var(--sc-accent);
  text-decoration: underline;
  font-weight: 900;
}

.sc-note a:hover,
.sc-note a:focus-visible,
.sc-inline-link:hover,
.sc-inline-link:focus-visible{
  text-decoration: none;
}

/* пурпурные ссылки (для Телеграмм / support@...) */
.sc-inline-link-purple{
  color: var(--sc-pink);
}

/* алерты */
.sc-error{
  margin: 10px 0 0;
  color: var(--sc-err);
  background: var(--sc-err-bg);
  border: 1px solid var(--sc-err-br);
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 900;
  display: none;
  text-align: center;
}

.sc-ok{
  margin: 10px 0 0;
  color: var(--sc-ok);
  background: var(--sc-ok-bg);
  border: 1px solid var(--sc-ok-br);
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 900;
  display: none;
  text-align: center;
}

/* чат */
.sc-chat{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sc-msgs{
  height: 280px;
  overflow: auto;
  border: 1px solid var(--sc-border);
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  padding: 10px;
}

.sc-bubble{
  max-width: 85%;
  padding: 8px 10px;
  border-radius: 14px;
  margin: 6px 0;
  font-size: 14px;
  line-height: 1.35;
  border: 1px solid var(--sc-border);
  word-break: break-word;

  color: var(--sc-text) !important;
  font-weight: 800 !important;
}

.sc-client{
  margin-left: auto;
  background:
    radial-gradient(220px 180px at 20% 0%, rgba(255,255,255,.12), transparent 60%),
    linear-gradient(135deg, rgba(7,90,161,.28), rgba(168,239,249,.14));
  border-color: rgba(168,239,249,.18);
}
.sc-admin{
  margin-right: auto;
  background: rgba(255,255,255,.06);
}
.sc-system{
  margin-right: auto;
  background: rgba(37,185,239,.10);
  border-color: rgba(37,185,239,.18);
}

.sc-sendrow{
  display: flex;
  gap: 8px;
}

.sc-sendrow .sc-textarea{
  min-height: 44px;
  resize: none;
}

.sc-sendbtn{
  min-width: 110px;
  border: 1px solid rgba(168,239,249,.18);
  border-radius: 14px;
  padding: 10px 12px;
  background:
    radial-gradient(140px 120px at 30% 20%, rgba(255,255,255,.14), transparent 64%),
    linear-gradient(135deg, rgba(7,90,161,.26), rgba(168,239,249,.16));
  color: var(--sc-text);
  font-weight: 900;
  cursor: pointer;
}

.sc-sendbtn:hover,
.sc-sendbtn:focus-visible{
  background:
    radial-gradient(160px 140px at 30% 20%, rgba(255,255,255,.18), transparent 66%),
    linear-gradient(135deg, rgba(7,90,161,.32), rgba(168,239,249,.20));
  border-color: rgba(168,239,249,.22);
}

.sc-sendbtn:focus-visible{
  outline:none;
  box-shadow: 0 0 0 3px rgba(7,90,161,.18);
}

.sc-sendbtn[disabled]{ opacity: .65; cursor: not-allowed; }

/* ===== close menu (Свернуть / Закрыть) ===== */
.sc-close-menu{
  position:absolute;
  inset:0;
  background: rgba(3,1,10,.62);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display:none;
  align-items:center;
  justify-content:center;
  padding:14px;
  z-index: 5;
}

.sc-close-box{
  width:100%;
  max-width: 420px;
  background: var(--sc-card);
  border: 1px solid var(--sc-border);
  border-radius: var(--radius2, 28px);
  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
  padding: 14px;
  box-shadow: var(--shadow2, 0 10px 30px rgba(0,0,0,.35));
}

.sc-close-title{
  font-weight: 900;
  font-size: 16px;
  text-align:center;
  margin-bottom: 12px;
}

.sc-close-actions{
  display:flex;
  gap:10px;
}

.sc-close-actions .sc-mini{
  flex:1;
  height: 46px;
  border-radius: 16px;
  font-weight: 900;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: var(--sc-text);
  cursor:pointer;
}

.sc-close-actions .sc-mini:hover,
.sc-close-actions .sc-mini:focus-visible{
  background: rgba(255,255,255,.08);
  border-color: rgba(168,239,249,.22);
  outline: none;
}

.sc-close-actions .sc-mini.sc-danger{
  border-color: rgba(255,59,48,.45);
  background: rgba(255,59,48,.12);
}

/* ===== rate ===== */
.sc-rate{
  padding: 14px;
  color: var(--sc-text);
  text-align: center;
}

.sc-rate-title{
  font-weight: 900;
  font-size: 16px;
  margin-bottom: 10px;
}

.sc-rate-actions{
  display: flex;
  gap: 10px;
}

.sc-rate-btn{
  flex: 1;
  border-radius: 14px;
  padding: 12px 10px;
  border: 1px solid var(--sc-border);
  background: rgba(255,255,255,.06);
  color: var(--sc-text);
  font-size: 20px;
  cursor: pointer;
}

.sc-rate-btn:hover{
  background: rgba(7,90,161,.14);
}

.sc-rate-skip{
  margin-top: 10px;
  color: var(--sc-muted);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  user-select:none;
}

.sc-rate-skip:hover{ color: var(--sc-text); }

/* mobile */
@media (max-width:720px){
  .sc-modal{ max-width: 100%; }
  .sc-msgs{ height: 240px; }
  .sc-sendbtn{ min-width: 90px; }

  /* ✅ Кабинет на мобилке — как на главной (по тексту) */
  .sc-modal .cabinet-btn{
    min-width: 0 !important;
    width: fit-content !important;
    padding: 5px 10px !important;
    font-size: 12px !important;
    line-height: 1 !important;
    white-space: nowrap;
  }

  /* "Закрыть/свернуть" на мобилке тоже не тянем фикс. шириной */
  .sc-action.sc-closebtn{
    min-width: 0 !important;
    width: fit-content !important;
  }
}



/* =========================
   iPhone Safari: STOP INPUT ZOOM (global)
   ========================= */
@media (max-width: 720px){
  .sc-modal .sc-input,
  .sc-modal .sc-textarea{
    font-size: 16px !important;
  }
}