/* So'rovnoma qo'llanmasi (js/survey-guide.js): tavsiya oynasi, video/matn ko'ruvchi va burchakdagi tugma. */

body.sg-open { overflow: hidden; }

/* ===== Burchakdagi "Qo'llanma" tugmasi ===== */
.sg-fab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 900;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 1.05rem 0.65rem 0.8rem;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--surface-solid);
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: transform 0.15s ease, background 0.15s ease;
}
.sg-fab:hover { background: var(--surface-hover); transform: translateY(-2px); }
.sg-fab svg { width: 20px; height: 20px; flex-shrink: 0; }

@media (max-width: 640px) {
  .sg-fab { right: 0.8rem; bottom: 0.8rem; padding: 0.7rem; }
  .sg-fab span { display: none; }
}

/* ===== Oynalar ===== */
.sg-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.2s ease;
}

.sg-box {
  width: 100%;
  background: var(--surface-solid);
  color: var(--text);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

/* Tavsiya oynasi */
.sg-intro {
  max-width: 460px;
  padding: 1.8rem 1.6rem 1.3rem;
  text-align: center;
}
.sg-intro-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 0.8rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-bg);
  color: var(--accent);
}
.sg-intro-icon svg { width: 30px; height: 30px; }
.sg-intro h3 { margin: 0 0 0.5rem; font-size: 1.2rem; }
.sg-intro-text { margin: 0 0 1.2rem; color: var(--text-2); line-height: 1.5; }

.sg-intro-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.6rem;
}
.sg-choice svg { width: 18px; height: 18px; flex-shrink: 0; }

.sg-remember {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.1rem;
  color: var(--text-2);
  font-size: 0.9rem;
  cursor: pointer;
}
.sg-remember input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }

.sg-skip {
  display: block;
  margin: 0.7rem auto 0;
  padding: 0.4rem 0.8rem;
  border: none;
  background: none;
  color: var(--text-3);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.sg-skip:hover { color: var(--text); }

.sg-hint {
  margin: 0.9rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--stroke);
  color: var(--text-3);
  font-size: 0.8rem;
  line-height: 1.45;
}

/* Video / matn ko'ruvchi */
.sg-viewer {
  max-width: 1280px;
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sg-viewer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem 0.9rem 1.3rem;
  border-bottom: 1px solid var(--stroke);
}
.sg-viewer-head strong { font-size: 1.05rem; }
.sg-close {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.sg-close:hover { background: var(--surface-hover); color: var(--text); }

.sg-tabs {
  display: flex;
  gap: 0.4rem;
  padding: 0.7rem 1.3rem 0;
}
.sg-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}
.sg-tab svg { width: 16px; height: 16px; }
.sg-tab.is-active { background: var(--accent-bg); border-color: var(--accent-border); color: var(--accent); }

.sg-pane { padding: 1rem 1.3rem 1.3rem; overflow: auto; }
.sg-pane video {
  display: block;
  width: 100%;
  max-height: calc(100vh - 12rem);
  border-radius: var(--radius-md);
  background: #000;
}

.sg-pane video { margin: 0 auto; max-width: 1000px; }

/* Video ovoz tili tanlagichi */
.sg-vlang {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-width: 1000px;
  margin: 0 auto 0.7rem;
  color: var(--text-2);
  font-size: 0.88rem;
  font-weight: 600;
}
.sg-vlang-seg {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  background: var(--surface-2);
}
.sg-vlang-seg button {
  padding: 0.35rem 0.85rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.sg-vlang-seg button.is-active { background: var(--accent); color: #fff; }
.sg-vlang-seg button:disabled { color: var(--text-3); cursor: not-allowed; }
.sg-soon { font-weight: 500; font-size: 0.8em; }

/* Qo'llanma sahifasi o'z skroli bilan iframe ichida */
.sg-text { padding: 0; overflow: hidden; }
.sg-text iframe {
  display: block;
  width: 100%;
  height: calc(100vh - 9rem);
  border: 0;
}

@media (max-width: 640px) {
  .sg-overlay { padding: 0.5rem; }
  .sg-intro { padding: 1.4rem 1.1rem 1.1rem; }
  .sg-viewer { max-height: calc(100vh - 1rem); }
}

/* ===== Kirish sahifasi: video tugmasi + eslatma ===== */
/* Panel har doim to'q "shisha" fonda — shuning uchun ranglar mavzuga bog'liq emas. */
/* Kompyuterda — o'ng pastki burchak */
.sg-login {
  position: fixed;
  right: 2rem;
  bottom: 2rem;
  z-index: 10;
  animation: panelIn 0.5s cubic-bezier(0.34,1.1,0.64,1) 0.3s both;
}

.sg-login-btn {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 1.1rem 0.7rem 0.75rem;
  border: 1px solid rgba(74, 222, 128, 0.45);
  border-radius: 999px;
  background: rgba(6, 18, 10, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  color: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}
.sg-login-btn:hover { background: rgba(22, 120, 60, 0.6); transform: translateY(-2px); }

.sg-login-play {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #22c55e;
  color: #fff;
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.45);
}
.sg-login-play svg { width: 20px; height: 20px; margin-left: 2px; }

/* Tugma "chaqiradi": play doirasidan to'lqin tarqaladi */
.sg-login-btn.is-pulsing .sg-login-play::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid #4ade80;
  animation: sg-ring 1.8s ease-out infinite;
}
@keyframes sg-ring {
  from { transform: scale(1); opacity: 0.9; }
  to { transform: scale(1.9); opacity: 0; }
}

.sg-login-label { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.sg-login-label b { font-size: 0.98rem; }
.sg-login-label small { color: rgba(255, 255, 255, 0.72); font-size: 0.8rem; }

/* Eslatma pufakchasi — tugmaning ustida, strelkasi play doirasiga qaragan */
.sg-bubble {
  position: absolute;
  right: 0;
  width: 300px;
  bottom: calc(100% + 14px);
  z-index: 2;
  padding: 0.85rem 2.4rem 0.85rem 1rem;
  border-radius: 16px;
  background: #fff;
  color: #0a0f0c;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform-origin: calc(100% - 34px) 100%;
  transform: translateY(14px) scale(0.6);
  transition: opacity 0.25s ease, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0s linear 0.45s;
}
.sg-bubble::after {
  content: "";
  position: absolute;
  right: 26px;
  bottom: -8px;
  width: 16px;
  height: 16px;
  background: #fff;
  transform: rotate(45deg);
  border-radius: 0 0 4px 0;
}
.sg-bubble.is-shown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  transition: opacity 0.25s ease, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0s;
  animation: sg-float 3s ease-in-out 0.6s infinite;
}
@keyframes sg-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.sg-bubble-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.sg-bubble-body strong { font-size: 0.95rem; color: #15803d; }
.sg-bubble-body span { font-size: 0.86rem; line-height: 1.4; color: #364d40; }

.sg-bubble-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #7a9486;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.sg-bubble-close:hover { background: #f0f4f0; color: #0a0f0c; }

/* Telefonda burchakda joy yo'q (pastda badge va lenta) — panel ostida, uning eni bo'yicha */
@media (max-width: 900px) {
  .sg-login {
    position: relative;
    right: auto;
    bottom: auto;
    width: min(480px, 100%);
    flex-shrink: 0;
  }
  .sg-login-btn { border-radius: 18px; }
  .sg-bubble { left: 0; right: 0; width: auto; transform-origin: 34px 100%; }
  .sg-bubble::after { left: 26px; right: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .sg-login,
  .sg-login-btn.is-pulsing .sg-login-play::after,
  .sg-bubble.is-shown { animation: none; }
  .sg-bubble { transition: opacity 0.2s ease, visibility 0s; transform: none; }
}
