/**
 * Odds Analytics Styles
 */

/* ================== ANALYTICS CONTAINER ================== */
.analytics-section {
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  margin-bottom: 16px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.analytics-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  box-sizing: border-box;
}

/* ================== HEADER ================== */
.analytics-header h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: var(--text-primary);
}

.analytics-disclaimer {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
  font-style: italic;
}

/* Title row with icon and badge */
.analytics-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.analytics-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.analytics-icon i {
  width: 18px;
  height: 18px;
}

.analytics-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.analytics-badge.beta {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

/* Info button */
.btn-info {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.2s ease;
}

.btn-info:hover {
  background: var(--accent-primary);
  color: white;
}

.btn-info i {
  width: 16px;
  height: 16px;
}

.live-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  margin-right: 6px;
  animation: pulse-live-badge 1.5s infinite;
}

@keyframes pulse-live-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.analytics-badge.live {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  animation: pulse-badge 2s infinite;
}

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

/* ================== CONTROLS ================== */
.analytics-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.dataset-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dataset-selector label {
  font-size: 13px;
  color: var(--text-secondary);
}

.dataset-selector select {
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 13px;
}

.btn-refresh {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.2s ease;
}

.btn-refresh:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.btn-refresh i {
  width: 14px;
  height: 14px;
}

/* ================== SESSION CONTROLS ================== */
.session-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
}

.session-controls button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.2s ease;
}

.session-controls button i {
  width: 14px;
  height: 14px;
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.session-status {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.session-status.active {
  color: var(--accent-success);
  font-weight: 500;
}

.session-status.active .status-dot {
  background: var(--accent-success);
  animation: pulse-live 1.5s infinite;
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

/* ================== HEATMAP CONTROLS ================== */
.heatmap-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
}

.heatmap-controls label {
  font-size: 13px;
  color: var(--text-secondary);
}

.window-buttons {
  display: flex;
  gap: 6px;
}

.window-btn {
  padding: 4px 12px;
  border: 1px solid var(--border-default);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.2s ease;
}

.window-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.window-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

/* ================== PREDICTION CARD ================== */
.prediction-card {
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid var(--border-default);
}

.prediction-main {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.prediction-main.good {
  color: #22c55e;
}

.prediction-main.bad {
  color: #ef4444;
}

.prediction-main.neutral {
  color: #f59e0b;
}

.prediction-main i {
  width: 32px;
  height: 32px;
}

.prediction-content {
  flex: 1;
}

.prediction-label {
  font-size: 16px;
  font-weight: 600;
}

.prediction-score {
  font-size: 13px;
  opacity: 0.8;
}

.confidence-meter {
  margin-bottom: 12px;
}

.confidence-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.confidence-bar {
  height: 6px;
  background: var(--border-default);
  border-radius: 3px;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  background: linear-gradient(90deg, #ef4444, #f59e0b, #22c55e);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.prediction-disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
  font-style: italic;
}

.prediction-loading {
  text-align: center;
  padding: 24px;
  color: var(--text-secondary);
}

/* ================== STATS GRID ================== */
.analytics-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stat-box {
  background: var(--bg-tertiary);
  padding: 12px;
  border-radius: var(--radius-md);
  text-align: center;
  position: relative;
}

.stat-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
}

.stat-icon i {
  width: 16px;
  height: 16px;
}

.stat-icon.global {
  background: rgba(99, 102, 241, 0.15);
  color: #6366f1;
}

.stat-icon.recent {
  background: rgba(14, 165, 233, 0.15);
  color: #0ea5e9;
}

.stat-icon.volatility {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.stat-icon.confidence {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.stat-box .stat-label {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.stat-box .stat-value {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

@media (max-width: 600px) {
  .analytics-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ================== HEATMAP ================== */
.heatmap-section h4,
.streak-section h4,
.explanation-section h4,
.sessions-section h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px 0;
  color: var(--text-primary);
}

.odds-heatmap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.heatmap-cell {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.heatmap-cell:hover {
  transform: scale(1.1);
  z-index: 1;
}

.empty-heatmap {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ================== STREAK INFO ================== */
.streak-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.streak-item {
  background: var(--bg-tertiary);
  padding: 10px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.streak-item.danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.streak-item.good {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.streak-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.streak-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ================== EXPLANATION ================== */
.explanation-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.explanation-list li {
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.explanation-list li:last-child {
  margin-bottom: 0;
}

/* ================== SESSIONS LIST ================== */
.sessions-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.2s ease;
}

.session-item:hover {
  background: var(--bg-hover);
}

.session-item.active {
  border: 1px solid var(--accent-success);
}

.session-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.session-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.session-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.session-badge {
  font-size: 10px;
  padding: 2px 8px;
  background: var(--accent-success);
  color: white;
  border-radius: 10px;
  text-transform: uppercase;
  font-weight: 600;
}

.empty-sessions {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ================== UTILITY ================== */
.hidden {
  display: none !important;
}
/**
 * Odds Analytics Styles
 */

/* ================== ANALYTICS CONTAINER ================== */
.analytics-section {
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  margin-bottom: 16px;
}

.analytics-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ================== HEADER ================== */
.analytics-header h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: var(--text-primary);
}

.analytics-disclaimer {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
  font-style: italic;
}

/* ================== CONTROLS ================== */
.analytics-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.dataset-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dataset-selector label {
  font-size: 13px;
  color: var(--text-secondary);
}

.dataset-selector select {
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 13px;
}

.btn-refresh {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.2s ease;
}

.btn-refresh:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.btn-refresh i {
  width: 14px;
  height: 14px;
}

/* ================== SESSION CONTROLS ================== */
.session-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
}

.session-controls button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.2s ease;
}

.session-controls button i {
  width: 14px;
  height: 14px;
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.session-status {
  font-size: 13px;
  color: var(--text-secondary);
}

.session-status.active {
  color: var(--accent-success);
  font-weight: 500;
}

/* ================== PREDICTION CARD ================== */
.prediction-card {
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid var(--border-default);
}

.prediction-main {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.prediction-main.good {
  color: #22c55e;
}

.prediction-main.bad {
  color: #ef4444;
}

.prediction-main.neutral {
  color: #f59e0b;
}

.prediction-main i {
  width: 32px;
  height: 32px;
}

.prediction-content {
  flex: 1;
}

.prediction-label {
  font-size: 16px;
  font-weight: 600;
}

.prediction-score {
  font-size: 13px;
  opacity: 0.8;
}

.confidence-meter {
  margin-bottom: 12px;
}

.confidence-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.confidence-bar {
  height: 6px;
  background: var(--border-default);
  border-radius: 3px;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  background: linear-gradient(90deg, #ef4444, #f59e0b, #22c55e);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.prediction-disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
  font-style: italic;
}

.prediction-loading {
  text-align: center;
  padding: 24px;
  color: var(--text-secondary);
}

/* Prediction Error State */
.prediction-error {
  text-align: center;
  padding: 24px;
  color: var(--text-secondary);
}

.prediction-error i {
  width: 32px;
  height: 32px;
  color: var(--danger);
  margin-bottom: 8px;
}

.prediction-error p {
  margin: 0 0 4px 0;
  font-size: 14px;
}

.prediction-error .error-detail {
  font-size: 12px;
  color: var(--text-muted);
}

/* ================== STATS GRID ================== */
.analytics-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stat-box {
  background: var(--bg-tertiary);
  padding: 12px;
  border-radius: var(--radius-md);
  text-align: center;
}

.stat-box .stat-label {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.stat-box .stat-value {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

@media (max-width: 600px) {
  .analytics-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ================== HEATMAP ================== */
.heatmap-section h4,
.streak-section h4,
.explanation-section h4,
.sessions-section h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px 0;
  color: var(--text-primary);
}

.odds-heatmap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.heatmap-cell {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.heatmap-cell:hover {
  transform: scale(1.1);
  z-index: 1;
}

.empty-heatmap {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ================== STREAK INFO ================== */
.streak-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.streak-item {
  background: var(--bg-tertiary);
  padding: 10px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.streak-item.danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.streak-item.good {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.streak-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.streak-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ================== EXPLANATION ================== */
.explanation-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.explanation-list li {
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.explanation-list li:last-child {
  margin-bottom: 0;
}

/* ================== SESSIONS LIST ================== */
.sessions-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.2s ease;
}

.session-item:hover {
  background: var(--bg-hover);
}

.session-item.active {
  border: 1px solid var(--accent-success);
}

.session-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.session-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.session-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.session-badge {
  font-size: 10px;
  padding: 2px 8px;
  background: var(--accent-success);
  color: white;
  border-radius: 10px;
  text-transform: uppercase;
  font-weight: 600;
}

.empty-sessions {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ================== UTILITY ================== */
.hidden {
  display: none !important;
}


/* ================== LAYOUT FIXES ================== */

/* Hide legacy prediction card on odds page (analytics one is used instead) */
#page-odds > .prediction-card {
  display: none;
}


/* ================== RESPONSIVE FIXES ================== */

/* Mobile: Stack controls vertically */
@media (max-width: 480px) {
  .analytics-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .dataset-selector {
    flex-direction: column;
    align-items: stretch;
  }
  
  .dataset-selector select {
    width: 100%;
  }
  
  .session-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .session-controls button {
    width: 100%;
    justify-content: center;
  }
  
  .heatmap-controls {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .prediction-main {
    flex-direction: column;
    text-align: center;
  }
}

/* Tablet: Adjust grids */
@media (max-width: 768px) {
  .analytics-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  
  .stat-box {
    padding: 10px;
  }
  
  .stat-box .stat-value {
    font-size: 16px;
  }
}

/* Small mobile: Single column stats */
@media (max-width: 360px) {
  .analytics-stats-grid {
    grid-template-columns: 1fr;
  }
}

/* Ensure heatmap cells don't overflow on small screens */
@media (max-width: 480px) {
  .heatmap-cell {
    width: 36px;
    height: 36px;
    font-size: 10px;
  }
}

/* Session list item improvements for mobile */
@media (max-width: 480px) {
  .session-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  .session-meta {
    font-size: 10px;
  }
}


/* ================== ADDITIONAL RESPONSIVE FIXES ================== */

/* Ensure analytics section never overflows */
.analytics-section {
  max-width: 100vw;
  box-sizing: border-box;
}

/* Streak grid responsive */
@media (max-width: 480px) {
  .streak-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  
  .streak-item {
    padding: 8px;
  }
  
  .streak-value {
    font-size: 16px;
  }
  
  .streak-label {
    font-size: 10px;
  }
}

/* Explanation list text wrapping */
.explanation-list li {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Heatmap section responsive */
@media (max-width: 480px) {
  .heatmap-section h4,
  .streak-section h4,
  .explanation-section h4,
  .sessions-section h4 {
    font-size: 13px;
  }
}

/* Ensure prediction card doesn't overflow */
.prediction-card {
  max-width: 100%;
  overflow: hidden;
}

.prediction-main {
  flex-wrap: wrap;
  gap: 8px;
}

/* Stats grid ensure no overflow */
.analytics-stats-grid {
  width: 100%;
}

/* Heatmap container */
.odds-heatmap {
  max-width: 100%;
  overflow-x: auto;
}


/* ================== PAGE INTEGRATION FIXES ================== */

/* Ensure analytics works within odds page layout */
#page-odds .analytics-section {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* Container fixes for nested flex */
.analytics-container {
  min-height: 0;
}

/* Ensure all sections within analytics can shrink */
.analytics-container > * {
  flex-shrink: 0;
}

/* Allow sessions list to scroll if too long */
.sessions-list {
  max-height: 300px;
  overflow-y: auto;
}


/* ================== MOBILE CRITICAL FIXES ================== */

/* Force analytics section to be visible on all devices */
.analytics-section {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  z-index: 1;
}

/* Mobile: Ensure proper stacking and no overflow hiding */
@media (max-width: 768px) {
  #page-odds {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    display: none;
  }
  
  #page-odds.active {
    display: flex !important;
  }
  
  #page-odds .analytics-section {
    flex: none !important;
    overflow: visible !important;
    display: block !important;
  }
}

/* Small mobile: Full width adjustments */
@media (max-width: 480px) {
  .analytics-section {
    padding: 12px;
    margin-bottom: 12px;
    border-radius: var(--radius-lg);
  }
  
  .analytics-header h3 {
    font-size: 16px;
  }
  
  .analytics-disclaimer {
    font-size: 11px;
  }
  
  /* Stack all controls vertically */
  .analytics-controls,
  .session-controls,
  .heatmap-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  
  .dataset-selector {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }
  
  .dataset-selector select,
  .session-controls button,
  .btn-refresh {
    width: 100%;
  }
  
  /* Stats grid - 2 columns on mobile */
  .analytics-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  
  .stat-box {
    padding: 10px 8px;
  }
  
  .stat-box .stat-value {
    font-size: 16px;
  }
  
  .stat-box .stat-label {
    font-size: 10px;
  }
  
  /* Heatmap smaller cells */
  .heatmap-cell {
    width: 32px;
    height: 32px;
    font-size: 10px;
  }
  
  /* Prediction card adjustments */
  .prediction-card {
    padding: 12px;
  }
  
  .prediction-main {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }
  
  .prediction-main i {
    width: 28px;
    height: 28px;
  }
  
  .prediction-label {
    font-size: 14px;
  }
  
  .prediction-score {
    font-size: 12px;
  }
  
  /* Streak grid */
  .streak-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  
  .streak-item {
    padding: 8px 4px;
  }
  
  .streak-value {
    font-size: 16px;
  }
  
  .streak-label {
    font-size: 9px;
  }
  
  /* Session items */
  .session-item {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px;
    gap: 4px;
  }
  
  .session-label {
    font-size: 13px;
  }
  
  .session-meta {
    font-size: 10px;
  }
  
  /* Explanation list */
  .explanation-list li {
    font-size: 12px;
    padding: 6px 10px;
  }
}

/* Extra small devices */
@media (max-width: 360px) {
  .analytics-stats-grid {
    grid-template-columns: 1fr;
  }
  
  .heatmap-cell {
    width: 28px;
    height: 28px;
    font-size: 9px;
  }
}

/* Ensure heatmap doesn't break layout */
.odds-heatmap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-start;
}

/* Fix for iOS Safari viewport issues */
@supports (-webkit-touch-callout: none) {
  .analytics-section {
    -webkit-overflow-scrolling: touch;
  }
}


/* ================== INFO MODAL ================== */
.analytics-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.analytics-modal.hidden {
  display: none !important;
}

.analytics-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.analytics-modal-content {
  position: relative;
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: modal-slide-in 0.3s ease;
}

@keyframes modal-slide-in {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.analytics-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-tertiary);
}

.analytics-modal-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.analytics-modal-header h4 i {
  width: 20px;
  height: 20px;
  color: var(--accent-primary);
}

.btn-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.2s ease;
}

.btn-modal-close:hover {
  background: var(--danger);
  color: white;
}

.btn-modal-close i {
  width: 18px;
  height: 18px;
}

.analytics-modal-body {
  padding: 20px;
  overflow-y: auto;
  max-height: calc(85vh - 65px);
}

.info-section {
  margin-bottom: 20px;
}

.info-section:last-of-type {
  margin-bottom: 0;
}

.info-section h5 {
  margin: 0 0 10px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.info-section h5 i {
  width: 16px;
  height: 16px;
  color: var(--accent-primary);
}

.info-section p {
  margin: 0 0 10px 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.info-section ul {
  margin: 0 0 10px 0;
  padding-left: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.info-section li {
  margin-bottom: 4px;
}

.info-section li strong {
  color: var(--text-primary);
}

.color-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 4px;
  vertical-align: middle;
}

.color-dot.red {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.color-dot.yellow {
  background: linear-gradient(135deg, #eab308, #ca8a04);
}

.color-dot.green {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.color-dot.purple {
  background: linear-gradient(135deg, #a855f7, #9333ea);
}

.info-disclaimer {
  display: flex;
  gap: 12px;
  padding: 14px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-md);
  margin-top: 20px;
}

.info-disclaimer i {
  width: 20px;
  height: 20px;
  color: var(--warning);
  flex-shrink: 0;
}

.info-disclaimer p {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.info-disclaimer strong {
  color: var(--warning);
}

/* Mobile modal adjustments */
@media (max-width: 480px) {
  .analytics-modal {
    padding: 0;
    align-items: flex-end;
  }
  
  .analytics-modal-content {
    max-height: 90vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    animation: modal-slide-up 0.3s ease;
  }
  
  @keyframes modal-slide-up {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }
  
  .analytics-modal-body {
    padding: 16px;
  }
  
  .info-section h5 {
    font-size: 13px;
  }
  
  .info-section p,
  .info-section ul {
    font-size: 12px;
  }
}
