/* AI Math Analyst — Futuristic Neon Dashboard Styling */

:root {
  --ai-gold: #f0c674;
  --ai-gold-dark: #d4a954;
  --ai-crimson: #ff5c4d;
  --ai-crimson-dark: #c4382b;
  --ai-purple: #9d4edd;
  --ai-purple-bright: #c77dff;
  --ai-dark-bg: #0a0a14;
  --ai-card-bg: rgba(15, 15, 30, 0.8);
  --ai-border: rgba(240, 198, 116, 0.3);
  --ai-glow: rgba(157, 78, 221, 0.4);
  --ai-text-primary: #f5ead0;
  --ai-text-secondary: #ebe0c4;
}

/* AI Analyst Panel */
.ai-analyst-section {
  margin: 40px 0;
  background: linear-gradient(135deg, rgba(157, 78, 221, 0.08) 0%, rgba(255, 92, 77, 0.05) 100%);
  border: 1px solid var(--ai-border);
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  box-shadow: 
    0 0 20px rgba(157, 78, 221, 0.1),
    inset 0 0 20px rgba(240, 198, 116, 0.02);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-analyst-section.expanded {
  box-shadow: 
    0 0 40px rgba(157, 78, 221, 0.25),
    0 0 20px rgba(255, 92, 77, 0.15),
    inset 0 0 30px rgba(240, 198, 116, 0.05);
  border: 1px solid rgba(240, 198, 116, 0.5);
}

/* Header / Toggle */
.ai-analyst-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
  background: linear-gradient(90deg, rgba(157, 78, 221, 0.15) 0%, rgba(15, 15, 30, 0.8) 100%);
  border-bottom: 1px solid var(--ai-border);
  cursor: pointer;
  transition: all 0.3s ease;
}

.ai-analyst-section.expanded .ai-analyst-header {
  border-bottom-color: rgba(240, 198, 116, 0.3);
  background: linear-gradient(90deg, rgba(157, 78, 221, 0.25) 0%, rgba(15, 15, 30, 0.9) 100%);
}

.ai-analyst-header:hover {
  background: linear-gradient(90deg, rgba(157, 78, 221, 0.2) 0%, rgba(15, 15, 30, 0.85) 100%);
}

.ai-analyst-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 600;
  color: var(--ai-gold);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-family: 'DM Mono', monospace;
}

.ai-analyst-title::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ai-crimson);
  box-shadow: 0 0 12px var(--ai-crimson);
  animation: ai-pulse 2s infinite;
}

@keyframes ai-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 12px var(--ai-crimson); }
  50% { opacity: 0.5; box-shadow: 0 0 6px var(--ai-crimson); }
}

.ai-status-badge {
  font-size: 11px;
  padding: 4px 10px;
  background: rgba(157, 78, 221, 0.2);
  border: 1px solid var(--ai-purple);
  border-radius: 20px;
  color: var(--ai-purple-bright);
  letter-spacing: 0.5px;
}

.ai-toggle-icon {
  font-size: 20px;
  transition: transform 0.3s ease;
}

.ai-analyst-section.expanded .ai-toggle-icon {
  transform: rotate(180deg);
}

/* Content Container */
.ai-analyst-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-analyst-section.expanded .ai-analyst-content {
  max-height: 1200px;
}

#ai-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  padding: 24px;
}

/* AI Cards */
.ai-card {
  background: var(--ai-card-bg);
  border: 1px solid var(--ai-border);
  border-radius: 6px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  min-height: 200px;
  display: flex;
  flex-direction: column;
}

.ai-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--ai-gold), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ai-card:hover {
  border-color: rgba(240, 198, 116, 0.5);
  background: rgba(15, 15, 30, 0.95);
  box-shadow: 
    0 0 20px rgba(157, 78, 221, 0.2),
    inset 0 0 20px rgba(240, 198, 116, 0.05);
  transform: translateY(-4px);
}

.ai-card:hover::before {
  opacity: 1;
}

/* Card Specific Colors */
.ai-rtp-card { --card-accent: #f0c674; }
.ai-volatility-card { --card-accent: #ff5c4d; }
.ai-player-card { --card-accent: #c77dff; }
.ai-risk-card { --card-accent: #ff6b9d; }
.ai-balance-card { --card-accent: #00d9ff; }

.ai-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--ai-border);
}

.ai-icon {
  font-size: 24px;
  opacity: 0.9;
}

.ai-card h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--card-accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: 'DM Mono', monospace;
}

.ai-text {
  font-size: 13px;
  color: var(--ai-text-secondary);
  line-height: 1.6;
  font-family: 'DM Mono', monospace;
  flex: 1;
  min-height: 60px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Typewriter Animation */
@keyframes typewriter {
  from { width: 0; }
  to { width: 100%; }
}

.ai-text {
  overflow: hidden;
  border-right: 2px solid var(--card-accent);
  padding-right: 4px;
  animation: none;
}

/* Loading State */
.ai-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 40px;
  color: var(--ai-text-secondary);
  font-size: 14px;
  font-family: 'DM Mono', monospace;
  letter-spacing: 1px;
}

.ai-spinner {
  width: 30px;
  height: 30px;
  border: 2px solid rgba(240, 198, 116, 0.2);
  border-top: 2px solid var(--ai-gold);
  border-radius: 50%;
  animation: ai-spin 0.8s linear infinite;
}

@keyframes ai-spin {
  to { transform: rotate(360deg); }
}

/* Smooth Loading Pulse */
@keyframes ai-load-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.ai-loading span {
  animation: ai-load-pulse 1.5s ease-in-out infinite;
}

/* Responsive */
@media (max-width: 1024px) {
  #ai-cards-container {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
    padding: 16px;
  }

  .ai-card {
    padding: 16px;
    min-height: 160px;
  }

  .ai-analyst-header {
    padding: 16px;
  }

  .ai-analyst-title {
    font-size: 14px;
  }
}

@media (max-width: 640px) {
  #ai-cards-container {
    grid-template-columns: 1fr;
  }

  .ai-card {
    min-height: 140px;
  }

  .ai-analyst-section.expanded .ai-analyst-content {
    max-height: 2000px;
  }
}

/* Premium Glow Effects */
.ai-card:nth-child(1):hover {
  box-shadow: 
    0 0 25px rgba(240, 198, 116, 0.3),
    inset 0 0 20px rgba(240, 198, 116, 0.05);
}

.ai-card:nth-child(2):hover {
  box-shadow: 
    0 0 25px rgba(255, 92, 77, 0.3),
    inset 0 0 20px rgba(255, 92, 77, 0.05);
}

.ai-card:nth-child(3):hover {
  box-shadow: 
    0 0 25px rgba(199, 125, 255, 0.3),
    inset 0 0 20px rgba(199, 125, 255, 0.05);
}

.ai-card:nth-child(4):hover {
  box-shadow: 
    0 0 25px rgba(255, 107, 157, 0.3),
    inset 0 0 20px rgba(255, 107, 157, 0.05);
}

.ai-card:nth-child(5):hover {
  box-shadow: 
    0 0 25px rgba(0, 217, 255, 0.3),
    inset 0 0 20px rgba(0, 217, 255, 0.05);
}

/* Animation for card entrance */
@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#ai-cards-container .ai-card {
  animation: card-enter 0.5s ease-out forwards;
}

#ai-cards-container .ai-card:nth-child(1) { animation-delay: 0.1s; }
#ai-cards-container .ai-card:nth-child(2) { animation-delay: 0.2s; }
#ai-cards-container .ai-card:nth-child(3) { animation-delay: 0.3s; }
#ai-cards-container .ai-card:nth-child(4) { animation-delay: 0.4s; }
#ai-cards-container .ai-card:nth-child(5) { animation-delay: 0.5s; }
