/* ===== MODERN GLASSMORPHISM MAGIC 8-BALL ===== */

/* CSS Custom Properties */
:root {
  /* Colors */
  --primary-bg: #0d1421;
  --secondary-bg: #1a2332;
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.18);
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-tertiary: #ec4899;
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.5);
  
  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-tertiary: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --gradient-glass: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
  
  /* Shadows */
  --shadow-glass: 0 8px 32px rgba(31, 38, 135, 0.37);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.4);
  --shadow-ball: 0 20px 60px rgba(0, 0, 0, 0.4);
  
  /* Transitions */
  --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  
  /* Borders */
  --border-radius: 20px;
  --border-radius-large: 32px;
  --border-radius-pill: 50px;
}

/* Global Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Space Grotesk', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--primary-bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Background Effects */
.background-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
}

.bg-gradient-1,
.bg-gradient-2,
.bg-gradient-3 {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.3;
  animation: float 20s ease-in-out infinite;
}

.bg-gradient-1 {
  width: 400px;
  height: 400px;
  background: var(--gradient-primary);
  top: -200px;
  right: -200px;
  animation-delay: 0s;
}

.bg-gradient-2 {
  width: 300px;
  height: 300px;
  background: var(--gradient-secondary);
  bottom: -150px;
  left: -150px;
  animation-delay: -7s;
}

.bg-gradient-3 {
  width: 250px;
  height: 250px;
  background: var(--gradient-tertiary);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -14s;
}

/* Floating Orbs */
.floating-orbs {
  position: absolute;
  width: 100%;
  height: 100%;
}

.orb {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  animation: orbFloat 15s ease-in-out infinite;
}

.orb-1 { width: 20px; height: 20px; top: 20%; left: 10%; animation-delay: 0s; }
.orb-2 { width: 30px; height: 30px; top: 60%; right: 15%; animation-delay: -3s; }
.orb-3 { width: 15px; height: 15px; bottom: 30%; left: 20%; animation-delay: -6s; }
.orb-4 { width: 25px; height: 25px; top: 40%; right: 30%; animation-delay: -9s; }
.orb-5 { width: 18px; height: 18px; bottom: 20%; right: 10%; animation-delay: -12s; }

/* Main Container */
.main-container {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* Glass Header */
.glass-header {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-large);
  margin-bottom: 2rem;
  box-shadow: var(--shadow-glass);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  gap: 2rem;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  font-size: 3rem;
  filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.6));
  animation: pulse 2s ease-in-out infinite;
}

.main-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  margin: 0;
  line-height: 1.1;
}

.title-line-1 {
  display: block;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  background: linear-gradient(135deg, #fff 0%, #a78bfa 50%, #f472b6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.title-line-2 {
  display: block;
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  color: var(--text-secondary);
  font-weight: 600;
}

.subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0.5rem 0 0 0;
}

/* Stats Container */
.stats-container {
  display: flex;
  gap: 2rem;
}

.stat-item {
  text-align: center;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-number {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-primary);
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Content Area */
.content-area {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

/* Ball Section */
.ball-section {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
}

.ball-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

/* Decoration Rings */
.decoration-rings {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: -1;
}

.ring {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  animation: ringRotate 20s linear infinite;
}

.ring-1 {
  width: 300px;
  height: 300px;
  top: -150px;
  left: -150px;
  animation-delay: 0s;
}

.ring-2 {
  width: 400px;
  height: 400px;
  top: -200px;
  left: -200px;
  animation-delay: -7s;
}

.ring-3 {
  width: 500px;
  height: 500px;
  top: -250px;
  left: -250px;
  animation-delay: -14s;
}

/* Magic Ball Glass */
.magic-ball-glass {
  position: relative;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #2a2a2a 0%, #0a0a0a 70%);
  box-shadow: var(--shadow-ball), var(--shadow-glow);
  cursor: pointer;
  transition: var(--transition-smooth);
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.magic-ball-glass:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5), var(--shadow-glow);
}

.ball-gradient-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--gradient-glass);
  opacity: 0.6;
}

.ball-reflection {
  position: absolute;
  top: 15%;
  left: 25%;
  width: 80px;
  height: 50px;
  background: radial-gradient(ellipse, rgba(255, 255, 255, 0.4) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(15px);
}

.ball-inner-glow {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
}

/* Answer Container */
.answer-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, #1a1a2e 0%, #0f0f23 100%);
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.answer-window {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
}

.answer-image {
  width: 100px;
  height: auto;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.4));
  animation: answerFloat 3s ease-in-out infinite;
}

.answer-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transform: translateX(-100%);
  animation: shimmer 2s ease-in-out infinite;
}

/* Number Display */
.number-display {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffffff 0%, #f1f5f9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 4px 20px rgba(0, 0, 0, 0.1);
  border: 3px solid rgba(255, 255, 255, 0.8);
}

.number-eight {
  font-family: 'Poppins', sans-serif;
  font-size: 6rem;
  font-weight: 800;
  color: #1e293b;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.number-glow {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent-primary), var(--accent-secondary), var(--accent-tertiary), var(--accent-primary));
  z-index: -1;
  filter: blur(10px);
  opacity: 0.7;
}

/* Interactive Elements */
.interaction-indicators {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}

.click-pulse {
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  border: 2px solid var(--accent-primary);
  opacity: 0;
  animation: clickPulse 2s ease-out infinite;
}

.hover-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  opacity: 0;
  transition: var(--transition-smooth);
}

.magic-ball-glass:hover .hover-ring {
  opacity: 1;
}

/* Status Text */
.status-text {
  text-align: center;
}

.instruction-main {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.instruction-sub {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Interaction Panel */
.interaction-panel {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-large);
  padding: 2rem;
  box-shadow: var(--shadow-glass);
  display: flex;
  flex-direction: column;
  gap: 2rem;
  height: fit-content;
}

/* Input Section */
.input-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.input-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.input-decoration {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--accent-primary), transparent);
}

.input-container {
  display: flex;
  gap: 1rem;
}

.input-wrapper {
  flex: 1;
  position: relative;
}

.question-input-glass {
  width: 100%;
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition-smooth);
  backdrop-filter: blur(10px);
}

.question-input-glass::placeholder {
  color: var(--text-muted);
}

.question-input-glass:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.input-focus-ring {
  position: absolute;
  inset: -2px;
  border-radius: var(--border-radius);
  background: linear-gradient(45deg, var(--accent-primary), var(--accent-secondary));
  z-index: -1;
  opacity: 0;
  transition: var(--transition-smooth);
}

.question-input-glass:focus + .input-focus-ring {
  opacity: 0.5;
}

.input-glow {
  position: absolute;
  inset: -5px;
  border-radius: var(--border-radius);
  background: var(--gradient-primary);
  z-index: -2;
  filter: blur(10px);
  opacity: 0;
  transition: var(--transition-smooth);
}

.question-input-glass:focus ~ .input-glow {
  opacity: 0.3;
}

/* Ask Button Glass */
.ask-button-glass {
  position: relative;
  padding: 1rem 2rem;
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--border-radius);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-smooth);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

.ask-button-glass:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4);
}

.ask-button-glass:active {
  transform: translateY(0);
}

.button-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transform: translateX(-100%);
  transition: var(--transition-smooth);
}

.ask-button-glass:hover .button-shimmer {
  transform: translateX(100%);
}

.button-icon-container {
  transition: var(--transition-smooth);
}

.ask-button-glass:hover .button-icon-container {
  transform: translateX(3px);
}

/* Chat Section */
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.chat-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.chat-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.chat-container {
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  height: 300px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.05);
  scrollbar-width: thin;
  scrollbar-color: var(--accent-primary) transparent;
}

.chat-container::-webkit-scrollbar {
  width: 6px;
}

.chat-container::-webkit-scrollbar-track {
  background: transparent;
}

.chat-container::-webkit-scrollbar-thumb {
  background: var(--accent-primary);
  border-radius: 3px;
}

.log-message {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  border-left: 3px solid var(--accent-primary);
  font-size: 0.9rem;
  line-height: 1.5;
  transition: var(--transition-smooth);
}

.log-message:hover {
  background: rgba(255, 255, 255, 0.08);
}

.user {
  color: var(--accent-tertiary);
  font-weight: 600;
}

.the-8-ball {
  color: #f59e0b;
  font-weight: 600;
}

/* Glass Footer */
.glass-footer {
  margin-top: 2rem;
}

.navigation-glass {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 1rem;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-pill);
  padding: 1rem;
  box-shadow: var(--shadow-glass);
}

.nav-item-glass {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--border-radius);
  transition: var(--transition-smooth);
  overflow: hidden;
}

.nav-item-glass:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
}

.nav-icon {
  transition: var(--transition-smooth);
}

.nav-item-glass:hover .nav-icon {
  transform: scale(1.1);
  filter: drop-shadow(0 0 10px currentColor);
}

.nav-text {
  font-size: 0.8rem;
  font-weight: 500;
}

.nav-hover-effect {
  position: absolute;
  inset: 0;
  background: var(--gradient-primary);
  opacity: 0;
  transition: var(--transition-smooth);
  border-radius: var(--border-radius);
}

.nav-item-glass:hover .nav-hover-effect {
  opacity: 0.1;
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--primary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: var(--transition-smooth);
}

.loading-content {
  text-align: center;
}

.loading-ball {
  width: 100px;
  height: 100px;
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 2rem;
  animation: loadingPulse 1.5s ease-in-out infinite;
}

.loading-8 {
  font-size: 3rem;
  font-weight: 800;
  color: white;
}

.loading-text {
  font-size: 1.5rem;
  margin-bottom: 2rem;
  color: var(--text-primary);
}

.loading-progress {
  width: 300px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin: 0 auto;
}

.progress-bar {
  height: 100%;
  background: var(--gradient-primary);
  width: 0%;
  transition: width 0.3s ease;
}

/* Notification Container */
.notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Animations */
@keyframes float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(30px, -30px) rotate(120deg); }
  66% { transform: translate(-20px, 20px) rotate(240deg); }
}

@keyframes orbFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@keyframes ringRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes answerFloat {
  0%, 100% { transform: translate(-50%, -50%) translateY(0); }
  50% { transform: translate(-50%, -50%) translateY(-5px); }
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes clickPulse {
  0% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.1); opacity: 0.3; }
  100% { transform: scale(1.2); opacity: 0; }
}

@keyframes loadingPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Shake Animation */
.shake .magic-ball-glass {
  animation: shake 0.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes shake {
  0%, 100% { transform: translateY(-5px) scale(1.02) rotate(0deg); }
  25% { transform: translateY(-5px) scale(1.02) rotate(-2deg) translateX(2px); }
  50% { transform: translateY(-5px) scale(1.02) rotate(2deg) translateX(-2px); }
  75% { transform: translateY(-5px) scale(1.02) rotate(-1deg) translateX(1px); }
}

.hidden {
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-smooth);
}

/* Responsive Design */
@media (max-width: 1200px) {
  .content-area {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .ball-section {
    min-height: 50vh;
  }
}

@media (max-width: 768px) {
  .main-container {
    padding: 0.5rem;
  }
  
  .header-content {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  
  .stats-container {
    gap: 1rem;
  }
  
  .magic-ball-glass {
    width: 220px;
    height: 220px;
  }
  
  .answer-container,
  .number-display {
    width: 120px;
    height: 120px;
  }
  
  .number-eight {
    font-size: 4rem;
  }
  
  .answer-image {
    width: 80px;
  }
  
  .input-container {
    flex-direction: column;
  }
  
  .navigation-glass {
    gap: 0.5rem;
    padding: 0.75rem;
  }
  
  .nav-item-glass {
    padding: 0.75rem 1rem;
  }
}

@media (max-width: 480px) {
  .title-line-1 {
    font-size: 1.5rem;
  }
  
  .title-line-2 {
    font-size: 1rem;
  }
  
  .magic-ball-glass {
    width: 180px;
    height: 180px;
  }
  
  .answer-container,
  .number-display {
    width: 100px;
    height: 100px;
  }
  
  .number-eight {
    font-size: 3rem;
  }
  
  .glass-panel {
    padding: 1rem;
  }
  
  .chat-container {
    height: 200px;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus Management */
.magic-ball-glass:focus {
  outline: 3px solid var(--accent-primary);
  outline-offset: 4px;
}

.ask-button-glass:focus,
.nav-item-glass:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.question-input-glass:focus {
  outline: none; /* Handled by custom focus ring */
}