/* Trend Visualizer Modal
   Clean, shareable visualization of selected trend props
   Inspired by parlaybuilder.ai-dashboard design */

/* ==============================================
   MODAL BACKDROP & CONTAINER
   ============================================== */
.trend-visualizer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: vizFadeIn 0.2s ease;
}

@keyframes vizFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.trend-visualizer-container {
  position: relative;
  max-width: 600px;
  width: 100%;
  animation: vizSlideIn 0.25s ease;
}

@keyframes vizSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Close Button */
.viz-close-btn {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 36px;
  height: 36px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: #94a3b8;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.viz-close-btn:hover {
  background: #334155;
  color: #fff;
  transform: scale(1.05);
}

/* Body scroll lock */
body.viz-modal-open {
  overflow: hidden;
}

/* ==============================================
   VISUALIZATION CANVAS
   ============================================== */
.viz-canvas {
  border-radius: 0;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(148, 163, 184, 0.1),
    0 25px 50px -12px rgba(0, 0, 0, 0.5);
  padding: 32px;
  width: 565px;
  height: 565px;
  display: flex;
  flex-direction: column;
}

/* Compact mode for many items */
.viz-canvas.compact {
  padding: 24px;
}

.viz-canvas.compact .viz-header {
  margin-bottom: 16px;
}

.viz-canvas.compact .viz-date {
  font-size: 13px;
}

.viz-canvas.compact .viz-subtitle {
  font-size: 18px;
}

.viz-canvas.compact .viz-footer {
  margin-top: 16px;
}

.viz-canvas.compact .viz-brand {
  font-size: 22px;
  letter-spacing: 3px;
}

/* ==============================================
   DRAGGABLE ELEMENTS
   ============================================== */
.viz-draggable {
  cursor: grab;
  user-select: none;
  transition: opacity 0.15s ease;
  position: relative;
  z-index: 10;
}

.viz-draggable.viz-draggable-h {
  cursor: ew-resize;
}

.viz-draggable:hover {
  opacity: 0.85;
}

.viz-draggable.dragging {
  cursor: grabbing;
  opacity: 0.7;
}

.viz-draggable.viz-draggable-h.dragging {
  cursor: ew-resize;
}

/* ==============================================
   HEADER
   ============================================== */
.viz-header {
  text-align: center;
  margin-bottom: 24px;
}

.viz-date {
  font-size: 14px;
  font-weight: 500;
  color: #94a3b8;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.viz-subtitle {
  font-size: 20px;
  font-weight: 800;
  color: #22d3ee;
  text-shadow: 0 0 20px rgba(34, 211, 238, 0.4);
  letter-spacing: 0.5px;
}

/* ==============================================
   ROWS CONTAINER
   ============================================== */
.viz-rows {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ==============================================
   ROW LAYOUT
   ============================================== */
.viz-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
}

/* Compact row styles */
.viz-row.compact {
  padding: 6px 12px;
  gap: 10px;
}

.viz-row.compact .viz-logo {
  width: 34px;
  height: 34px;
}

.viz-row.compact .viz-logo .viz-avatar {
  width: 34px;
  height: 34px;
}

.viz-row.compact .viz-logo .viz-team-badge {
  width: 15px;
  height: 15px;
  bottom: -3px;
  right: -3px;
}

.viz-row.compact .viz-player {
  font-size: 12px;
}

.viz-row.compact .viz-prop {
  font-size: 11px;
}

.viz-row.compact .viz-hitrate {
  font-size: 12px;
}

/* Info container (player + prop) */
.viz-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Player avatar wrapper */
.viz-logo {
  position: relative;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viz-logo .viz-avatar {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 8px;
}

/* Fallback: team logo only (no headshot) */
.viz-logo .viz-avatar.is-logo {
  object-fit: contain;
}

/* Team badge overlay (bottom-right) */
.viz-logo .viz-team-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  object-fit: contain;
  border-radius: 50%;
  z-index: 1;
}

/* Player Name */
.viz-player {
  font-size: 14px;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
}

/* Prop (over/under line stat) */
.viz-prop {
  font-size: 14px;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
}

.viz-prop .side-over {
  color: #4ade80;
}

.viz-prop .side-under {
  color: #f87171;
}

/* Hit Rate */
.viz-hitrate {
  font-size: 15px;
  font-weight: 900;
  font-family: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
  color: #22d3ee;
  text-shadow: 0 0 12px rgba(34, 211, 238, 0.6);
  letter-spacing: 1px;
  flex-shrink: 0;
  margin-left: auto;
}

/* ==============================================
   PARLAY FOOTER (Combined Odds)
   ============================================== */
.viz-parlay-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding: 14px 20px;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.08) 0%, rgba(34, 211, 238, 0.02) 100%);
  border: 1px solid rgba(34, 211, 238, 0.15);
  border-radius: 10px;
}

.viz-parlay-label {
  font-size: 13px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.viz-parlay-odds {
  font-size: 22px;
  font-weight: 900;
  font-family: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
  color: #22d3ee;
  text-shadow: 0 0 20px rgba(34, 211, 238, 0.6);
}

/* ==============================================
   FOOTER / BRANDING
   ============================================== */
.viz-footer {
  margin-top: 24px;
  text-align: center;
}

.viz-brand {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #22d3ee;
  text-shadow: 0 0 30px rgba(34, 211, 238, 0.7);
  font-family: 'Inter', system-ui, sans-serif;
}

/* ==============================================
   ACTIONS (Download Button)
   ============================================== */
.viz-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.viz-download-note {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 10px;
  font-size: 12px;
  color: #64748b;
  font-style: italic;
}

.viz-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.15) 0%, rgba(34, 211, 238, 0.05) 100%);
  border: 1px solid rgba(34, 211, 238, 0.25);
  border-radius: 10px;
  color: #22d3ee;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.viz-action-btn:hover {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.25) 0%, rgba(34, 211, 238, 0.1) 100%);
  border-color: rgba(34, 211, 238, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(34, 211, 238, 0.2);
}

.viz-action-btn svg {
  flex-shrink: 0;
}

/* Shuffle button styling */
.viz-action-btn.viz-shuffle-btn {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.15) 0%, rgba(168, 85, 247, 0.05) 100%);
  border-color: rgba(168, 85, 247, 0.25);
  color: #c084fc;
}

.viz-action-btn.viz-shuffle-btn:hover {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.25) 0%, rgba(168, 85, 247, 0.1) 100%);
  border-color: rgba(168, 85, 247, 0.4);
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.2);
}

/* Preview toggle buttons */
.viz-action-btn.viz-preview-btn {
  background: linear-gradient(135deg, rgba(100, 116, 139, 0.15) 0%, rgba(100, 116, 139, 0.05) 100%);
  border-color: rgba(100, 116, 139, 0.25);
  color: #94a3b8;
}

.viz-action-btn.viz-preview-btn:hover {
  background: linear-gradient(135deg, rgba(100, 116, 139, 0.25) 0%, rgba(100, 116, 139, 0.1) 100%);
  border-color: rgba(100, 116, 139, 0.4);
}

.viz-action-btn.viz-preview-btn.active {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.2) 0%, rgba(34, 211, 238, 0.1) 100%);
  border-color: rgba(34, 211, 238, 0.4);
  color: #22d3ee;
}

/* Copy button success state */
.viz-action-btn.copied {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(34, 197, 94, 0.1) 100%);
  border-color: rgba(34, 197, 94, 0.4);
  color: #4ade80;
}

/* Download button success state */
.viz-action-btn.downloaded {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(34, 197, 94, 0.1) 100%);
  border-color: rgba(34, 197, 94, 0.4);
  color: #4ade80;
}

/* Disabled/loading state for buttons */
.viz-action-btn:disabled,
.viz-action-btn.downloading,
.viz-action-btn.copying {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

/* Loading spinner */
.viz-spinner {
  animation: vizSpin 1s linear infinite;
}

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

/* ==============================================
   VISUALIZE BUTTON (in filters bar)
   ============================================== */
.trend-sheets-container .filters-bar .visualize-btn {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.15) 0%, rgba(168, 85, 247, 0.05) 100%);
  border-color: rgba(168, 85, 247, 0.3);
  color: #c084fc;
}

.trend-sheets-container .filters-bar .visualize-btn:hover {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.25) 0%, rgba(168, 85, 247, 0.1) 100%);
  border-color: rgba(168, 85, 247, 0.5);
  box-shadow: 0 2px 12px rgba(168, 85, 247, 0.25);
}

.trend-sheets-container .filters-bar .visualize-btn svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

/* ==============================================
   RESPONSIVE STYLES
   ============================================== */
@media (max-width: 768px) {
  .trend-visualizer-backdrop {
    padding: 12px;
    align-items: flex-start;
    padding-top: 40px;
  }

  .trend-visualizer-container {
    max-width: 100%;
  }

  .viz-canvas {
    padding: 20px 16px;
    width: 100%;
    height: auto;
    min-height: 400px;
  }

  .viz-table-header {
    display: none;
  }

  .viz-row {
    grid-template-columns: 36px 1fr auto;
    gap: 8px 10px;
    padding: 10px 12px;
  }

  .viz-logo {
    grid-row: span 2;
    width: 36px;
    height: 36px;
    align-self: start;
  }

  .viz-logo .viz-avatar {
    width: 36px;
    height: 36px;
  }

  .viz-logo .viz-team-badge {
    width: 16px;
    height: 16px;
  }

  .viz-player {
    font-size: 14px;
    grid-column: 2;
  }

  .viz-prop {
    font-size: 12px;
    color: #94a3b8;
    grid-column: 2;
  }

  .viz-odds {
    display: none;
  }

  .viz-hitrate {
    font-size: 14px;
    grid-row: span 2;
    align-self: center;
  }

  .viz-parlay-footer {
    padding: 10px 14px;
  }

  .viz-parlay-label {
    font-size: 11px;
  }

  .viz-parlay-odds {
    font-size: 18px;
  }

  .viz-subtitle {
    font-size: 16px;
  }

  .viz-brand {
    font-size: 20px;
    letter-spacing: 3px;
  }

  .viz-close-btn {
    top: -8px;
    right: -8px;
    width: 32px;
    height: 32px;
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  .viz-canvas {
    padding: 16px 12px;
  }

  .viz-header {
    margin-bottom: 16px;
  }

  .viz-date {
    font-size: 12px;
  }

  .viz-subtitle {
    font-size: 14px;
  }

  .viz-row {
    padding: 8px 10px;
  }

  .viz-logo {
    width: 32px;
    height: 32px;
  }

  .viz-logo .viz-avatar {
    width: 32px;
    height: 32px;
  }

  .viz-logo .viz-team-badge {
    width: 14px;
    height: 14px;
  }

  .viz-player {
    font-size: 13px;
  }

  .viz-prop {
    font-size: 11px;
  }

  .viz-hitrate {
    font-size: 13px;
  }

  .viz-footer {
    margin-top: 16px;
  }

  .viz-brand {
    font-size: 18px;
    letter-spacing: 2px;
  }

  .viz-actions {
    margin-top: 12px;
  }

  .viz-action-btn {
    padding: 10px 18px;
    font-size: 13px;
  }
}

/* ==============================================
   PARLAY COMBO VISUALIZATION
   ============================================== */
.viz-canvas.parlay-mode {
  justify-content: space-between;
  min-height: 565px;
}

.viz-combos {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: center;
}

/* Individual Combo - logo left, legs center, hit rate right */
.viz-combo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.viz-combo.compact {
  gap: 10px;
}

/* Logo on the left */
.viz-combo-logo {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viz-combo.compact .viz-combo-logo {
  width: 32px;
  height: 32px;
}

.viz-combo-logo img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.viz-combo.compact .viz-combo-logo img {
  width: 28px;
  height: 28px;
}

/* Legs Container */
.viz-combo-legs {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.viz-combo.compact .viz-combo-legs {
  gap: 4px;
}

/* Individual Leg */
.viz-combo-leg {
  display: flex;
  align-items: center;
  gap: 12px;
}

.viz-combo-leg.compact {
  gap: 8px;
}

/* Leg text reads like a sentence: "Player Name over 19.5 PTS" */
.viz-leg-text {
  font-size: 14px;
  font-weight: 500;
  color: #e2e8f0;
}

.viz-combo-leg.compact .viz-leg-text {
  font-size: 12px;
}

.viz-leg-text .side-over {
  color: #4ade80;
  font-weight: 600;
}

.viz-leg-text .side-under {
  color: #f87171;
  font-weight: 600;
}

/* Hit rate - vertically centered relative to legs */
.viz-combo-hitrate {
  font-size: 13px;
  font-weight: 700;
  font-family: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
  color: #22d3ee;
  text-shadow: 0 0 10px rgba(34, 211, 238, 0.5);
  flex-shrink: 0;
  text-align: center;
  line-height: 1.5;
  margin-left: auto;
}

.viz-combo-hitrate .hit-count {
  color: #4ade80;
  text-shadow: 0 0 10px rgba(74, 222, 128, 0.5);
}

.viz-combo.compact .viz-combo-hitrate {
  font-size: 11px;
}

/* Meta container for odds + hitrate */
.viz-combo-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

/* Parlay odds badge */
.viz-combo-parlay-odds {
  font-size: 14px;
  font-weight: 700;
  font-family: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
  color: #4ade80;
  background: rgba(74, 222, 128, 0.15);
  padding: 4px 12px;
  border-radius: 6px;
  text-shadow: 0 0 10px rgba(74, 222, 128, 0.3);
}

.viz-combo.compact .viz-combo-parlay-odds {
  font-size: 12px;
  padding: 3px 10px;
}

/* Divider Between Combos */
.viz-combo-divider {
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(148, 163, 184, 0.15) 20%,
    rgba(148, 163, 184, 0.15) 80%,
    transparent 100%
  );
  margin: 4px 0;
}

/* ==============================================
   PARLAY MODE RESPONSIVE
   ============================================== */
@media (max-width: 768px) {
  .viz-canvas.parlay-mode {
    min-height: auto;
    height: auto;
  }

  .viz-combo {
    gap: 12px;
  }

  .viz-combo-logo {
    width: 32px;
    height: 32px;
  }

  .viz-combo-logo img {
    width: 28px;
    height: 28px;
  }

  .viz-leg-text {
    font-size: 13px;
  }

  .viz-combo-hitrate {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .viz-combo {
    gap: 10px;
  }

  .viz-combo-logo {
    width: 28px;
    height: 28px;
  }

  .viz-combo-logo img {
    width: 24px;
    height: 24px;
  }

  .viz-leg-text {
    font-size: 12px;
  }

  .viz-combo-hitrate {
    font-size: 11px;
  }
}

