/* ==========================================================================
   Liquid Glassmorphism & Modern Mesh Design System
   Suyuq shisha, jonli gradientlar, Apple uslubidagi nafis UI
   ========================================================================== */

:root {
  --bg-deep: #090d16;
  --glass-bg: rgba(255, 255, 255, 0.12);
  --glass-bg-hover: rgba(255, 255, 255, 0.18);
  --glass-border: rgba(255, 255, 255, 0.28);
  --glass-border-lit: rgba(255, 255, 255, 0.55);
  
  --text-pure: #ffffff;
  --text-soft: rgba(255, 255, 255, 0.85);
  --text-muted: rgba(255, 255, 255, 0.65);
  
  --primary-glow: #6366f1;
  --accent-cyan: #06b6d4;
  --accent-pink: #ec4899;
  --accent-amber: #f59e0b;

  --kahoot-red: #f43f5e;
  --kahoot-blue: #3b82f6;
  --kahoot-yellow: #f59e0b;
  --kahoot-green: #10b981;

  --radius-full: 9999px;
  --radius-xl: 32px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-deep);
  min-height: 100vh;
  color: var(--text-pure);
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Orqa Fondagi Jonli Suyuq Sharlar (Liquid Glowing Mesh Orbs)
   ========================================================================== */
.liquid-mesh-background {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  filter: blur(80px);
  opacity: 0.85;
}

.liquid-orb {
  position: absolute;
  border-radius: 50%;
  mix-blend-mode: screen;
  will-change: transform;
}

.orb-1 {
  width: 550px;
  height: 550px;
  top: -100px;
  left: -100px;
  background: radial-gradient(circle, #6366f1 0%, #4338ca 60%, transparent 80%);
  animation: floatOrb1 22s infinite alternate ease-in-out;
}

.orb-2 {
  width: 600px;
  height: 600px;
  bottom: -120px;
  right: -80px;
  background: radial-gradient(circle, #ec4899 0%, #be185d 60%, transparent 80%);
  animation: floatOrb2 26s infinite alternate ease-in-out;
}

.orb-3 {
  width: 480px;
  height: 480px;
  top: 35%;
  left: 45%;
  background: radial-gradient(circle, #06b6d4 0%, #0369a1 60%, transparent 80%);
  animation: floatOrb3 20s infinite alternate ease-in-out;
}

.orb-4 {
  width: 400px;
  height: 400px;
  bottom: 10%;
  left: 15%;
  background: radial-gradient(circle, #8b5cf6 0%, #6d28d9 60%, transparent 80%);
  animation: floatOrb4 24s infinite alternate ease-in-out;
}

@keyframes floatOrb1 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(120px, 80px) scale(1.15); }
  100% { transform: translate(60px, 140px) scale(0.95); }
}

@keyframes floatOrb2 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-100px, -90px) scale(1.1); }
  100% { transform: translate(-160px, -40px) scale(0.9); }
}

@keyframes floatOrb3 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-80px, 100px) scale(1.2); }
  100% { transform: translate(70px, -60px) scale(0.85); }
}

@keyframes floatOrb4 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(90px, -70px) scale(1.1); }
  100% { transform: translate(-50px, 60px) scale(0.95); }
}

/* ==========================================================================
   Liquid Glass Asosiy Klassi
   ========================================================================== */
.liquid-glass {
  position: relative;
  background: var(--glass-bg);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-radius: var(--radius-xl);
  border: 1px solid var(--glass-border);
  box-shadow: 
    0 24px 50px -12px rgba(0, 0, 0, 0.45),
    0 8px 24px -4px rgba(0, 0, 0, 0.25),
    inset 0 1px 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -1px 1px 0 rgba(0, 0, 0, 0.2);
  isolation: isolate;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.35s ease,
              box-shadow 0.35s ease;
}

/* Yoritilgan burchak ramkasi (Lit Specular Rim) */
.liquid-glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.75) 0%,
    rgba(255, 255, 255, 0.1) 40%,
    rgba(255, 255, 255, 0) 60%,
    rgba(255, 255, 255, 0.35) 100%
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* Bandingni yo'qotish uchun nozik grain qatlami */
.liquid-glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ==========================================================================
   Struktura & Floating Nav Bar
   ========================================================================== */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Ixcham suzuvchi Shisha Navbar (Floating Glass Pill) */
.floating-glass-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  margin: 0 auto 36px;
  width: 100%;
  max-width: 880px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 
    0 16px 36px rgba(0, 0, 0, 0.3),
    inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

.brand-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #ffffff;
}

.brand-logo-img {
  height: 38px;
  width: 38px;
  object-fit: contain;
  border-radius: 11px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  display: inline-block;
  vertical-align: middle;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.brand-pill:hover .brand-logo-img {
  transform: scale(1.08) rotate(-2deg);
}

.brand-text {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, #ffffff 30%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.user-badge-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.user-badge-pill span:not(.inline-ios-emoji) {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
}

.avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  display: block;
}

.btn-nav-logout {
  background: rgba(244, 63, 94, 0.15);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.35);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-nav-logout:hover {
  background: #f43f5e;
  color: #ffffff;
}

/* Mobil Ekranlar Uchun Navbar Moslashuvi (≤ 600px) */
@media (max-width: 600px) {
  .app-container {
    padding: 10px 8px;
  }

  .floating-glass-nav {
    padding: 8px 10px;
    margin-bottom: 16px !important;
    gap: 6px;
  }

  .brand-pill {
    gap: 6px;
    min-width: 0;
    flex-shrink: 1;
    overflow: hidden;
  }

  .brand-logo-img {
    height: 28px;
    width: 28px;
    border-radius: 8px;
    flex-shrink: 0;
  }

  .brand-text {
    font-size: 13.5px;
    letter-spacing: -0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nav-actions {
    gap: 5px;
    flex-shrink: 0;
  }

  .user-badge-pill {
    padding: 4px 7px;
    gap: 4px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .user-badge-pill span:not(.inline-ios-emoji) {
    max-width: 70px;
    font-size: 11.5px;
  }

  .btn-nav-logout {
    padding: 4px 9px;
    font-size: 11.5px;
    white-space: nowrap;
    flex-shrink: 0;
  }
}

@media (max-width: 380px) {
  .floating-glass-nav {
    padding: 6px 8px;
    gap: 4px;
  }

  .brand-text {
    font-size: 12px;
  }

  .brand-logo-img {
    height: 24px;
    width: 24px;
    border-radius: 6px;
  }

  .user-badge-pill {
    padding: 3px 6px;
    gap: 3px;
    font-size: 11px;
  }

  .user-badge-pill span:not(.inline-ios-emoji) {
    max-width: 50px;
    font-size: 11px;
  }

  .btn-nav-logout {
    padding: 4px 8px;
    font-size: 11px;
  }
}

/* ==========================================================================
   Asosiy Kirish Kartasi (Hero Glass Card)
   ========================================================================== */
.glass-hero-card {
  max-width: 480px;
  margin: 40px auto;
  padding: 44px 36px;
  text-align: center;
  animation: heroEntrance 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes heroEntrance {
  0% { opacity: 0; transform: translateY(32px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.glass-hero-card:hover {
  transform: translateY(-4px);
  background: var(--glass-bg-hover);
  box-shadow: 
    0 32px 64px -12px rgba(0, 0, 0, 0.5),
    0 12px 32px -4px rgba(0, 0, 0, 0.3),
    inset 0 1px 1px 0 rgba(255, 255, 255, 0.6);
}

.hero-emoji-bubble {
  width: 90px;
  height: 90px;
  margin: 0 auto 24px;
  border-radius: 30px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.05) 100%);
  border: 1px solid rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 
    0 16px 32px rgba(0, 0, 0, 0.2),
    inset 0 1px 1px rgba(255, 255, 255, 0.6);
  animation: bubbleFloat 4s infinite ease-in-out;
}

@keyframes bubbleFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.05); }
}

.hero-title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #ffffff;
  margin-bottom: 12px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-soft);
  margin-bottom: 34px;
}

/* ==========================================================================
   Tugmalar (Buttons)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 700;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.28);
  cursor: pointer;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  outline: none;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.w-full {
  width: 100%;
}

/* Google Kirish - Sof, Oq, Elegant Shisha */
.btn-google-liquid {
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 
    0 12px 28px rgba(0, 0, 0, 0.25),
    0 2px 6px rgba(0, 0, 0, 0.1),
    inset 0 1px 1px #ffffff;
}

.btn-google-liquid:hover {
  background: #ffffff;
  transform: translateY(-2px) scale(1.01);
  box-shadow: 
    0 18px 36px rgba(0, 0, 0, 0.32),
    0 4px 10px rgba(0, 0, 0, 0.15),
    inset 0 1px 2px #ffffff;
}

.btn-google-liquid svg {
  width: 20px;
  height: 20px;
}

/* Shaffof Shisha Tugma (Sinov / Secondary) */
.btn-glass-subtle {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-soft);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  font-size: 14px;
  padding: 12px 20px;
  box-shadow: 
    0 8px 20px rgba(0, 0, 0, 0.2),
    inset 0 1px 1px rgba(255, 255, 255, 0.3);
}

.btn-glass-subtle:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.45);
  transform: translateY(-2px);
  box-shadow: 
    0 12px 28px rgba(0, 0, 0, 0.28),
    inset 0 1px 1px rgba(255, 255, 255, 0.5);
}

/* Asosiy Suyuq Shisha Tugmalar (Liquid Glass - Yashil emas, nafis safir & binafsha neon shisha) */
.btn-primary-liquid,
.btn-success-liquid,
.btn-liquid-accent {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.45) 0%, rgba(139, 92, 246, 0.38) 50%, rgba(6, 182, 212, 0.42) 100%);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 
    0 12px 30px -4px rgba(99, 102, 241, 0.42),
    0 4px 12px rgba(0, 0, 0, 0.25),
    inset 0 1px 1.5px 0 rgba(255, 255, 255, 0.75),
    inset 0 -1px 2px 0 rgba(0, 0, 0, 0.25);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.btn-primary-liquid::before,
.btn-success-liquid::before,
.btn-liquid-accent::before {
  content: "";
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  pointer-events: none;
  transition: left 0.7s ease;
}

.btn-primary-liquid:hover::before,
.btn-success-liquid:hover::before,
.btn-liquid-accent:hover::before {
  left: 125%;
}

.btn-primary-liquid:hover,
.btn-success-liquid:hover,
.btn-liquid-accent:hover {
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.58) 0%, rgba(168, 85, 247, 0.48) 50%, rgba(34, 211, 238, 0.52) 100%);
  border-color: rgba(255, 255, 255, 0.7);
  transform: translateY(-2px);
  box-shadow: 
    0 16px 40px -4px rgba(99, 102, 241, 0.55),
    0 6px 16px rgba(0, 0, 0, 0.3),
    inset 0 1px 2px 0 #ffffff;
}

.btn:active {
  transform: scale(0.97);
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(0.6);
}

/* ==========================================================================
   Rol Tanlash Kartalari (Ustoz / Talaba)
   ========================================================================== */
.roles-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 28px 0;
}

.role-select-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  border-radius: 24px;
  padding: 24px 16px;
  cursor: pointer;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.role-select-card:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.45);
  transform: translateY(-4px);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.25);
}

.role-select-card.selected {
  background: rgba(99, 102, 241, 0.25);
  border-color: #818cf8;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.35), 0 16px 32px rgba(99, 102, 241, 0.25);
  transform: translateY(-3px);
}

.role-card-icon {
  margin-bottom: 12px;
}

.role-card-title {
  font-size: 19px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 6px;
}

.role-card-desc {
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.4;
}

/* ==========================================================================
   Modallar (QR Scanner)
   ========================================================================== */
.qr-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.qr-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.qr-modal-content {
  max-width: 420px;
  width: 90%;
  padding: 30px;
  text-align: center;
}

.qr-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.qr-modal-close {
  background: transparent;
  border: none;
  font-size: 32px;
  cursor: pointer;
  color: var(--text-soft);
  line-height: 1;
}

.qr-scanner-box {
  width: 100%;
  max-width: 320px;
  margin: 0 auto 16px;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  border: 2px solid rgba(99, 102, 241, 0.45);
  background: rgba(15, 23, 42, 0.75);
  min-height: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#qrScannerReader {
  width: 100% !important;
  border-radius: 18px !important;
  overflow: hidden !important;
}

#qrScannerReader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 18px !important;
}

.hidden {
  display: none !important;
}

/* Accessibility */
@media (prefers-reduced-transparency: reduce) {
  .liquid-glass, .floating-glass-nav {
    background: #111827;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}
