/* =====================================================
   ZhenyaCloud · тосты и confirm-диалог
   API: window.toast(text, type='info', opts), window.confirmDialog(text)
   ===================================================== */

#zc-toasts {
  position: fixed;
  z-index: 9999;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  pointer-events: none;
  max-width: calc(100vw - 40px);
}
.zc-toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 420px;
  padding: 14px 16px 14px 14px;
  border-radius: 14px;
  background: rgba(20, 20, 32, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #F5F5F7;
  font: 500 14px/1.45 'Inter', -apple-system, sans-serif;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.02);
  transform: translateX(120%);
  opacity: 0;
  transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .35s;
  position: relative;
  overflow: hidden;
}
.zc-toast.zc-show { transform: translateX(0); opacity: 1; }
.zc-toast.zc-hide { transform: translateX(120%); opacity: 0; }

.zc-toast::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--zc-accent, #FFB627);
}
.zc-toast .zc-ico {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--zc-accent-bg, rgba(255, 182, 39, 0.15));
  color: var(--zc-accent, #FFB627);
  font-size: 16px;
  flex-shrink: 0;
}
.zc-toast .zc-body { padding-top: 4px; }
.zc-toast .zc-title {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
  line-height: 1.3;
}
.zc-toast .zc-text {
  color: #C7CAD1;
  font-size: 13px;
  line-height: 1.4;
}
.zc-toast .zc-close {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: #6B7280;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: background .15s, color .15s;
  margin-top: -2px;
  margin-right: -4px;
}
.zc-toast .zc-close:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }

.zc-toast.zc-success { --zc-accent: #34D399; --zc-accent-bg: rgba(52, 211, 153, 0.15); }
.zc-toast.zc-error   { --zc-accent: #F87171; --zc-accent-bg: rgba(239, 68, 68, 0.15); }
.zc-toast.zc-info    { --zc-accent: #60A5FA; --zc-accent-bg: rgba(96, 165, 250, 0.15); }
.zc-toast.zc-warn    { --zc-accent: #FBBF24; --zc-accent-bg: rgba(251, 191, 36, 0.15); }
.zc-toast.zc-gold    { --zc-accent: #FFB627; --zc-accent-bg: rgba(255, 182, 39, 0.15); }

/* Прогресс-бар автоскрытия */
.zc-toast .zc-progress {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--zc-accent);
  transform-origin: left center;
  animation: zc-toast-progress var(--zc-dur, 4s) linear forwards;
  opacity: 0.5;
}
@keyframes zc-toast-progress {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* Confirm-диалог */
#zc-confirm-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  display: grid; place-items: center;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
#zc-confirm-overlay.zc-show { opacity: 1; pointer-events: auto; }
.zc-confirm-box {
  background: rgba(20, 20, 32, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 24px;
  max-width: 380px;
  width: calc(100vw - 40px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  transform: translateY(8px) scale(0.98);
  transition: transform .2s cubic-bezier(.2,.8,.2,1);
}
#zc-confirm-overlay.zc-show .zc-confirm-box { transform: translateY(0) scale(1); }
.zc-confirm-title {
  font-family: 'Unbounded', 'Inter', sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  color: #F5F5F7;
}
.zc-confirm-text {
  color: #9CA3AF;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 18px;
}
.zc-confirm-btns {
  display: flex; gap: 10px; justify-content: flex-end;
}
.zc-confirm-btns button {
  padding: 9px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: 600 14px/1 'Inter', sans-serif;
  cursor: pointer;
  transition: transform .12s, background .15s, border-color .15s;
}
.zc-confirm-btns .zc-cancel {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  color: #F5F5F7;
}
.zc-confirm-btns .zc-cancel:hover { background: rgba(255, 255, 255, 0.1); }
.zc-confirm-btns .zc-ok {
  background: linear-gradient(180deg, #FFB627 0%, #FF8A00 100%);
  color: #1A0F00;
}
.zc-confirm-btns .zc-ok:hover { transform: translateY(-1px); }
.zc-confirm-btns .zc-ok.zc-danger {
  background: linear-gradient(180deg, #F87171 0%, #DC2626 100%);
  color: #fff;
}

@media (max-width: 480px) {
  #zc-toasts { right: 10px; bottom: 10px; left: 10px; }
  .zc-toast { min-width: 0; max-width: 100%; }
}

/* ===== Back-to-top ===== */
#zc-totop {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 182, 39, 0.35);
  background: linear-gradient(180deg, rgba(255, 182, 39, 0.18), rgba(255, 138, 0, 0.18));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #FFD56B;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px) scale(0.92);
  pointer-events: none;
  transition: opacity .25s, transform .25s, border-color .2s, background .2s;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), 0 0 24px rgba(255, 182, 39, 0.18);
}
#zc-totop.zc-show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
#zc-totop:hover { border-color: var(--gold, #FFB627); background: linear-gradient(180deg, rgba(255, 182, 39, 0.32), rgba(255, 138, 0, 0.28)); transform: translateY(-2px) scale(1); }
#zc-totop svg { width: 20px; height: 20px; display: block; }
@media (max-width: 480px) {
  #zc-totop { right: 14px; bottom: 14px; width: 44px; height: 44px; }
}

/* ===== Reveal-on-scroll ===== */
.zc-reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .75s cubic-bezier(.2,.8,.2,1), transform .75s cubic-bezier(.2,.8,.2,1);
  will-change: opacity, transform;
}
.zc-reveal.zc-revealed { opacity: 1; transform: translateY(0); }
/* Страховка: если JS не отработал — через 3 секунды показываем всё */
html.zc-no-js-reveal .zc-reveal,
html.zc-reveal-fallback .zc-reveal { opacity: 1 !important; transform: none !important; }
@media (prefers-reduced-motion: reduce) {
  .zc-reveal { transition: none !important; opacity: 1 !important; transform: none !important; }
}
/* На мобиле reveal-эффект отключаем — на маленьком экране не нужен и риск багов больше */
@media (max-width: 880px) {
  .zc-reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* ===== Mobile drawer (hamburger menu) ===== */
.zc-burger {
  display: none;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--surface, rgba(255,255,255,0.04));
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  position: relative;
}
.zc-burger::before, .zc-burger::after, .zc-burger span {
  content: "";
  position: absolute;
  left: 12px; right: 12px;
  height: 2px;
  background: var(--text, #F5F5F7);
  border-radius: 2px;
  transition: transform .3s, opacity .2s, top .3s;
}
.zc-burger::before { top: 14px; }
.zc-burger span    { top: 21px; display: block; }
.zc-burger::after  { top: 28px; }
.zc-burger[aria-expanded="true"]::before { top: 21px; transform: rotate(45deg); }
.zc-burger[aria-expanded="true"] span    { opacity: 0; }
.zc-burger[aria-expanded="true"]::after  { top: 21px; transform: rotate(-45deg); }
@media (max-width: 880px) {
  .zc-burger { display: inline-flex; }
}

#zc-drawer-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,0.55);
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
  backdrop-filter: blur(2px);
}
#zc-drawer-overlay.zc-show { opacity: 1; pointer-events: auto; }

#zc-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  z-index: 91;
  width: min(320px, 88vw);
  background: rgba(15, 15, 24, 0.96);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: -24px 0 64px rgba(0, 0, 0, 0.6);
  transform: translateX(100%);
  transition: transform .35s cubic-bezier(.2,.8,.2,1);
  overflow-y: auto;
  display: flex; flex-direction: column;
  padding: 22px 22px 28px;
}
#zc-drawer.zc-show { transform: translateX(0); }
.zc-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 18px; margin-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.zc-drawer-title {
  font-family: 'Unbounded', sans-serif;
  font-weight: 700; font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--text, #F5F5F7);
}
.zc-drawer-close {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  cursor: pointer;
  color: var(--text, #F5F5F7);
  font-size: 20px; line-height: 1;
}
.zc-drawer-close:hover { background: rgba(255,255,255,0.08); }
.zc-drawer-nav { display: flex; flex-direction: column; gap: 4px; }
.zc-drawer-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 14px;
  border-radius: 12px;
  font: 600 15px/1.3 'Inter', sans-serif;
  color: var(--text, #F5F5F7);
  text-decoration: none;
  transition: background .15s, color .15s, transform .12s;
}
.zc-drawer-nav a:hover { background: rgba(255, 182, 39, 0.08); color: var(--gold, #FFB627); }
.zc-drawer-nav a:active { transform: scale(0.98); }
.zc-drawer-nav .ico { font-size: 18px; opacity: .9; }

.zc-drawer-cta {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.zc-drawer-cta a {
  display: block; text-align: center;
  padding: 14px 18px;
  border-radius: 12px;
  background: linear-gradient(180deg, #FFB627 0%, #FF8A00 100%);
  color: #1A0F00;
  font: 700 15px/1 'Inter', sans-serif;
  text-decoration: none;
  box-shadow: 0 10px 30px rgba(255, 138, 0, 0.35);
}
@media (min-width: 881px) {
  #zc-drawer, #zc-drawer-overlay { display: none !important; }
}

body.zc-drawer-open { overflow: hidden; }
