/* ═══════════════════════════════════════════════════════════════
   DESIGN SYSTEM — GLOBAL TOKENS
═══════════════════════════════════════════════════════════════ */
:root {
  --bg:         #0c0e1a;
  --bg2:        #111327;
  --surface:    rgba(255,255,255,0.055);
  --surface-h:  rgba(255,255,255,0.09);
  --border:     rgba(255,255,255,0.10);
  --border-h:   rgba(255,255,255,0.22);

  --indigo:     #6366f1;
  --violet:     #8b5cf6;
  --teal:       #14b8a6;
  --green:      #10b981;
  --rose:       #f43f5e;
  --amber:      #f59e0b;

  --text:       #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim:   #64748b;

  --radius:     20px;
  --radius-sm:  12px;
  --radius-xs:  8px;

  --shadow:     0 24px 64px rgba(0,0,0,0.55);
  --shadow-sm:  0 8px 24px rgba(0,0,0,0.35);

  --transition: 0.3s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ═══════════════════════════════════════════════════════════════
   SCREENS
═══════════════════════════════════════════════════════════════ */
.screen {
  display: none;
  min-height: 100dvh;
  position: relative;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.screen.active { display: flex; }

/* ═══════════════════════════════════════════════════════════════
   BACKGROUND ORBS
═══════════════════════════════════════════════════════════════ */
.bg-orbs {
  position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.25;
  animation: drift 18s ease-in-out infinite alternate;
}
.orb-1 { width: 600px; height: 600px; background: var(--indigo);  top: -200px; left: -200px; animation-delay: 0s; }
.orb-2 { width: 500px; height: 500px; background: var(--violet);  bottom: -150px; right: -150px; animation-delay: -6s; }
.orb-3 { width: 400px; height: 400px; background: var(--teal);    top: 40%; left: 40%; animation-delay: -12s; }

@keyframes drift {
  from { transform: translate(0,0) scale(1); }
  to   { transform: translate(40px,40px) scale(1.1); }
}

/* ═══════════════════════════════════════════════════════════════
   GLASS CARD
═══════════════════════════════════════════════════════════════ */
.glass-card {
  position: relative; z-index: 1;
  background: var(--surface);
  backdrop-filter: blur(32px) saturate(180%);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 44px;
  width: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   WELCOME CARD
═══════════════════════════════════════════════════════════════ */
.welcome-card {
  max-width: 520px;
  text-align: center;
}

.logo-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  margin-bottom: 32px;
}
.logo-icon svg { width: 64px; height: 64px; filter: drop-shadow(0 8px 24px rgba(99,102,241,0.5)); }
.logo-badge {
  font-size: 12px; font-weight: 700; letter-spacing: 3px;
  color: var(--violet);
  background: rgba(139,92,246,0.15);
  border: 1px solid rgba(139,92,246,0.3);
  padding: 4px 14px; border-radius: 100px;
}

.welcome-title {
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 16px;
}

.welcome-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 28px;
}

/* Language Switcher */
.lang-switcher {
  display: flex; gap: 12px; justify-content: center;
  margin-bottom: 32px;
}

.lang-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-family: inherit; font-size: 0.95rem; font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.lang-btn:hover {
  background: var(--surface-h);
  border-color: var(--border-h);
  color: var(--text);
  transform: translateY(-2px);
}
.lang-btn.active {
  background: linear-gradient(135deg, rgba(99,102,241,0.25), rgba(139,92,246,0.25));
  border-color: var(--indigo);
  color: var(--text);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.12);
}
.lang-flag { font-size: 1.3rem; }

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════════ */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%;
  padding: 16px 28px;
  border-radius: var(--radius-sm);
  border: none;
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  color: white;
  font-family: inherit; font-size: 1rem; font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  position: relative; overflow: hidden;
  box-shadow: 0 8px 32px rgba(99,102,241,0.4);
}
.btn-primary::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0; transition: var(--transition);
}
.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 40px rgba(99,102,241,0.55);
}
.btn-primary:hover::before { opacity: 1; }
.btn-primary:active { transform: translateY(-1px); }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-family: inherit; font-size: 0.9rem; font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.btn-secondary:hover { background: var(--surface-h); color: var(--text); }

.btn-arrow { width: 20px; height: 20px; flex-shrink: 0; }

/* Pulse animation */
@keyframes pulse-ring {
  0%   { box-shadow: 0 8px 32px rgba(99,102,241,0.4), 0 0 0 0 rgba(99,102,241,0.5); }
  70%  { box-shadow: 0 8px 32px rgba(99,102,241,0.4), 0 0 0 14px rgba(99,102,241,0); }
  100% { box-shadow: 0 8px 32px rgba(99,102,241,0.4), 0 0 0 0 rgba(99,102,241,0); }
}
.pulse-btn { animation: pulse-ring 2.5s ease-out infinite; }

/* ═══════════════════════════════════════════════════════════════
   INFO CARD
═══════════════════════════════════════════════════════════════ */
.info-card { max-width: 540px; }

.card-header { margin-bottom: 32px; }
.step-badge {
  display: inline-block;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 1.5px;
  color: var(--indigo);
  background: rgba(99,102,241,0.12);
  border: 1px solid rgba(99,102,241,0.25);
  padding: 4px 12px; border-radius: 100px;
  margin-bottom: 12px;
}
.card-header h2 {
  font-size: 1.7rem; font-weight: 800; margin-bottom: 6px;
}
.info-sub { color: var(--text-muted); font-size: 0.9rem; }

/* Form */
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block; font-size: 0.85rem; font-weight: 600;
  color: var(--text-muted); margin-bottom: 8px;
  letter-spacing: 0.3px;
}
.form-input {
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 13px 16px;
  color: var(--text);
  font-family: inherit; font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}
.form-input::placeholder { color: var(--text-dim); }
.form-input:focus {
  border-color: var(--indigo);
  background: rgba(99,102,241,0.08);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.12);
}
.form-input.error {
  border-color: var(--rose);
  box-shadow: 0 0 0 4px rgba(244,63,94,0.12);
}
.input-error {
  font-size: 0.8rem; color: var(--rose);
  margin-top: 6px; min-height: 18px;
  transition: var(--transition);
}

/* Select */
.select-wrapper { position: relative; }
.form-select {
  appearance: none; -webkit-appearance: none;
  cursor: pointer; padding-right: 44px;
}
.form-select option { background: #1e2035; color: var(--text); }
.select-arrow {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-dim); pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════
   SURVEY
═══════════════════════════════════════════════════════════════ */
.survey-container {
  width: 100%; max-width: 720px;
  position: relative; z-index: 1;
  display: flex; flex-direction: column; gap: 16px;
}

.glass-header {
  background: var(--surface);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 28px;
}

.survey-meta {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-bottom: 16px;
}
.user-chip, .dept-chip {
  display: flex; align-items: center; gap: 7px;
  font-size: 0.82rem; color: var(--text-muted);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 100px; padding: 5px 14px;
}
.user-chip svg, .dept-chip svg { width: 14px; height: 14px; flex-shrink: 0; }

.progress-info {
  display: flex; justify-content: space-between;
  font-size: 0.82rem; color: var(--text-muted);
  margin-bottom: 8px;
}
#q-percent { font-weight: 600; color: var(--indigo); }

.progress-bar {
  height: 6px; border-radius: 100px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 100px;
  background: linear-gradient(90deg, var(--indigo), var(--violet));
  transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
  width: 0%;
  box-shadow: 0 0 12px rgba(99,102,241,0.6);
}

/* Question Card */
.question-card { max-width: unset; padding: 36px 40px; }
.question-number {
  font-size: 0.75rem; font-weight: 800; letter-spacing: 2px;
  color: var(--indigo); margin-bottom: 16px;
}
.question-text {
  font-size: clamp(1rem, 2.5vw, 1.2rem); font-weight: 600;
  line-height: 1.55; margin-bottom: 28px; color: var(--text);
}

/* Answer options */
.answers-grid {
  display: flex; flex-direction: column; gap: 11px;
  margin-bottom: 32px;
}
.answer-option {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 15px 18px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  text-align: left;
}
.answer-option:hover {
  background: rgba(99,102,241,0.08);
  border-color: rgba(99,102,241,0.35);
  transform: translateX(4px);
}
.answer-option.selected {
  background: linear-gradient(135deg, rgba(99,102,241,0.18), rgba(139,92,246,0.12));
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12), inset 0 0 20px rgba(99,102,241,0.05);
}

.answer-letter {
  flex-shrink: 0; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-xs); border: 1.5px solid var(--border);
  font-size: 0.78rem; font-weight: 700; color: var(--text-dim);
  background: rgba(255,255,255,0.05);
  transition: var(--transition);
  margin-top: 1px;
}
.answer-option.selected .answer-letter {
  background: var(--indigo);
  border-color: var(--indigo);
  color: white;
}
.answer-text {
  font-size: 0.92rem; line-height: 1.5; color: var(--text);
}

/* Nav */
.nav-row {
  display: flex; justify-content: space-between; gap: 12px;
}
.btn-nav {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit; font-size: 0.9rem; font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.btn-nav svg { width: 18px; height: 18px; }
.btn-nav:hover { background: var(--surface-h); border-color: var(--border-h); transform: translateY(-2px); }
.btn-nav:disabled { opacity: 0.35; pointer-events: none; }

.btn-next {
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(99,102,241,0.35);
}
.btn-next:hover { box-shadow: 0 10px 28px rgba(99,102,241,0.5); }

/* ═══════════════════════════════════════════════════════════════
   FINISH CARD
═══════════════════════════════════════════════════════════════ */
.finish-card { max-width: 480px; text-align: center; }
.finish-icon { margin-bottom: 24px; }
.finish-icon svg { width: 80px; height: 80px; }
.finish-title {
  font-size: 2rem; font-weight: 800; margin-bottom: 10px;
  background: linear-gradient(135deg, var(--green), var(--teal));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.finish-sub { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 28px; }
.finish-stats {
  display: flex; gap: 20px; justify-content: center;
}
.stat-item { text-align: center; }
.stat-val { font-size: 2.4rem; font-weight: 800; color: var(--indigo); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* ═══════════════════════════════════════════════════════════════
   ALREADY DONE
═══════════════════════════════════════════════════════════════ */
.already-card { max-width: 440px; text-align: center; }
.already-icon { font-size: 3.5rem; margin-bottom: 20px; }
.already-card h2 { font-size: 1.6rem; font-weight: 700; margin-bottom: 12px; }
.already-card p { color: var(--text-muted); line-height: 1.6; }

/* ═══════════════════════════════════════════════════════════════
   ADMIN SCREEN
═══════════════════════════════════════════════════════════════ */
#screen-admin {
  display: none;
  flex-direction: column;
  align-items: stretch;
  min-height: 100dvh;
  padding: 0;
}
#screen-admin.active {
  display: flex;
}

.admin-wrap {
  width: 100%; max-width: 1400px; margin: 0 auto;
  padding: 32px 24px; flex: 1;
}

.admin-header {
  margin-bottom: 28px;
}
.admin-title-row {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px; margin-bottom: 20px;
}
.admin-title-row h2 {
  display: flex; align-items: center; gap: 12px;
  font-size: 1.5rem; font-weight: 700;
}
.admin-title-row h2 svg { width: 24px; height: 24px; color: var(--indigo); }

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

.btn-export {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-xs);
  border: none;
  background: linear-gradient(135deg, #059669, #10b981);
  color: white; font-family: inherit; font-size: 0.88rem; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  box-shadow: 0 4px 14px rgba(16,185,129,0.35);
}
.btn-export:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(16,185,129,0.5); }
.btn-export svg { width: 16px; height: 16px; }

.btn-clear {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(244,63,94,0.3);
  background: rgba(244,63,94,0.1);
  color: var(--rose); font-family: inherit; font-size: 0.88rem; font-weight: 600;
  cursor: pointer; transition: var(--transition);
}
.btn-clear:hover { background: rgba(244,63,94,0.2); }
.btn-clear svg { width: 16px; height: 16px; }

.admin-stats-row {
  display: flex; gap: 16px; flex-wrap: wrap;
}
.admin-stat-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem; color: var(--text-muted);
}
.admin-stat-chip .chip-val {
  font-weight: 700; font-size: 1.1rem; color: var(--text);
}

/* Admin Table */
.admin-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
}

.admin-table {
  width: 100%; border-collapse: collapse; font-size: 0.85rem;
}
.admin-table thead tr {
  background: rgba(99,102,241,0.1);
  border-bottom: 1px solid var(--border);
}
.admin-table th {
  padding: 14px 16px; text-align: left;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.8px;
  color: var(--text-muted); white-space: nowrap;
}
.admin-table td {
  padding: 13px 16px; border-bottom: 1px solid rgba(255,255,255,0.05);
  vertical-align: top; line-height: 1.5;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(255,255,255,0.03); }

.row-num {
  width: 40px; color: var(--text-dim); font-size: 0.8rem; text-align: center;
}
.lang-tag {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 2px 10px; border-radius: 100px; font-size: 0.75rem; font-weight: 700;
}
.lang-tag.ru { background: rgba(99,102,241,0.15); color: #a5b4fc; border: 1px solid rgba(99,102,241,0.25); }
.lang-tag.kz { background: rgba(20,184,166,0.15); color: #5eead4; border: 1px solid rgba(20,184,166,0.25); }

.expand-btn {
  background: rgba(99,102,241,0.12); border: 1px solid rgba(99,102,241,0.25);
  border-radius: var(--radius-xs); color: #a5b4fc; font-size: 0.75rem;
  padding: 3px 10px; cursor: pointer; transition: var(--transition);
}
.expand-btn:hover { background: rgba(99,102,241,0.25); }

.answers-detail {
  display: none; margin-top: 8px;
  background: rgba(0,0,0,0.25); border-radius: var(--radius-xs);
  padding: 10px 12px; font-size: 0.8rem; color: var(--text-muted);
}
.answers-detail.open { display: block; }
.answer-row { padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.answer-row:last-child { border-bottom: none; }

/* Empty state */
.admin-empty {
  text-align: center; padding: 60px 20px; color: var(--text-dim);
}
.admin-empty svg { width: 48px; height: 48px; margin-bottom: 16px; opacity: 0.4; }
.admin-empty p { font-size: 1rem; }

/* ═══════════════════════════════════════════════════════════════
   MODAL
═══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  transition: var(--transition);
}
.modal-overlay.hidden { display: none; }

.modal-box {
  width: 100%; max-width: 400px;
  text-align: center; padding: 40px;
}
.modal-icon { font-size: 2.5rem; margin-bottom: 16px; }
.modal-box h3 { font-size: 1.3rem; font-weight: 700; margin-bottom: 8px; }
.modal-box p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn-primary { flex: 1; }
.modal-actions .btn-secondary { flex: 1; }

/* ═══════════════════════════════════════════════════════════════
   HIDDEN & UTILITY
═══════════════════════════════════════════════════════════════ */
.hidden { display: none !important; }

#admin-trigger {
  position: fixed; bottom: 12px; right: 16px;
  width: 20px; height: 20px; z-index: 999; cursor: default;
}

/* Card entrance animation */
@keyframes slide-up {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}
.glass-card, .glass-header { animation: slide-up 0.5s ease both; }

/* Responsive */
@media (max-width: 600px) {
  .glass-card { padding: 28px 22px; }
  .question-card { padding: 24px 20px; }
  .nav-row { gap: 8px; }
  .btn-nav { padding: 11px 16px; font-size: 0.85rem; }
  .admin-wrap { padding: 20px 12px; }
  .admin-title-row { flex-direction: column; align-items: flex-start; }
  .finish-stats { gap: 28px; }
}
