/* LineUpAI Hockey Team Management CSS - Wealthsimple Inspired Design */

/* Wealthsimple Color Palette */
:root {
  /* Primary Colors */
  --ws-primary: #00C29B;
  --ws-primary-dark: #00B3A6;
  --ws-primary-light: #E6FAF7;
  
  /* Neutrals */
  --ws-black: #0A0A0A;
  --ws-gray-900: #1F2937;
  --ws-gray-800: #374151;
  --ws-gray-700: #4B5563;
  --ws-gray-600: #6B7280;
  --ws-gray-500: #9CA3AF;
  --ws-gray-400: #D1D5DB;
  --ws-gray-300: #E5E7EB;
  --ws-gray-200: #F3F4F6;
  --ws-gray-100: #F9FAFB;
  --ws-white: #FFFFFF;
  
  /* Surface Colors */
  --ws-surface: #FEFEFE;
  --ws-surface-elevated: #F6F7F8;
  
  /* Semantic Colors */
  --ws-success: #10B981;
  --ws-warning: #F59E0B;
  --ws-error: #EF4444;
  --ws-info: #3B82F6;
  
  /* Typography */
  --ws-font-size-xs: 12px;
  --ws-font-size-sm: 14px;
  --ws-font-size-base: 16px;
  --ws-font-size-lg: 18px;
  --ws-font-size-xl: 20px;
  --ws-font-size-2xl: 24px;
  --ws-font-size-3xl: 30px;
  
  /* Spacing */
  --ws-spacing-xs: 4px;
  --ws-spacing-sm: 8px;
  --ws-spacing-md: 16px;
  --ws-spacing-lg: 24px;
  --ws-spacing-xl: 32px;
  --ws-spacing-2xl: 48px;
  --ws-spacing-3xl: 64px;
  
  /* Shadows */
  --ws-shadow-sm: 0 1px 2px 0 rgba(10, 10, 10, 0.05);
  --ws-shadow-md: 0 4px 6px -1px rgba(10, 10, 10, 0.1);
  --ws-shadow-lg: 0 10px 15px -3px rgba(10, 10, 10, 0.1);
  
  /* Border Radius */
  --ws-radius-sm: 4px;
  --ws-radius-md: 8px;
  --ws-radius-lg: 12px;
  --ws-radius-xl: 16px;
}

/* Base Reset & Typography */
* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ws-gray-900);
  background-color: var(--ws-surface);
  line-height: 1.5;
  font-size: var(--ws-font-size-base);
}

/* Desktop Drag & Drop Optimization */
@media (min-width: 1024px) {
  .drag-friendly-layout {
    position: relative;
    min-height: 100vh;
  }
  
  .player-pool-fixed {
    position: fixed;
    top: 6rem;
    left: 1.5rem;
    width: 20rem;
    max-height: calc(100vh - 8rem);
    z-index: 20;
  }
  
  .lineup-area-spaced {
    margin-left: 22rem;
    margin-right: 1.5rem;
  }
  
  /* Enhanced drag feedback for desktop */
  .player-card.dragging {
    transform: rotate(3deg) scale(1.05);
    z-index: 1000;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  }
  
  .position-slot.drag-over {
    transform: scale(1.02);
    border-width: 3px;
    border-color: #10b981;
    background-color: #ecfdf5;
  }
}

/* Mobile responsive adjustments */
@media (max-width: 1023px) {
  .player-pool-fixed {
    position: static !important;
    width: auto !important;
    max-height: 24rem !important;
  }
  
  .lineup-area-spaced {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

/* Custom hockey-themed styling */
.hockey-rink {
  background: linear-gradient(45deg, #e3f2fd 0%, #f8f9fa 50%, #e3f2fd 100%);
  border: 2px solid #1565c0;
  border-radius: 50px;
}

.player-card {
  transition: all 0.3s ease;
  cursor: grab;
}

.player-card:hover {
  transform: translateY(-2px);
  shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.player-card.dragging {
  cursor: grabbing;
  opacity: 0.8;
  transform: rotate(5deg);
}

.position-slot {
  min-height: 60px;
  border: 2px dashed #cbd5e0;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.position-slot.drag-over {
  border-color: #3b82f6;
  background-color: #eff6ff;
}

.position-slot.occupied {
  border: 2px solid #059669;
  background-color: #f0fdf4;
}

/* Position-specific colors */
.position-forward { background-color: #fef3c7; border-color: #f59e0b; }
.position-defense { background-color: #dbeafe; border-color: #3b82f6; }
.position-goalie { background-color: #fde68a; border-color: #d97706; }

/* Skill level indicators */
.skill-level {
  display: inline-flex;
  gap: 2px;
}

.skill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #e5e7eb;
}

.skill-dot.filled { background-color: #10b981; }
.skill-dot.high { background-color: #f59e0b; }
.skill-dot.elite { background-color: #dc2626; }

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .lineup-builder {
    grid-template-columns: 1fr;
  }
  
  .player-card {
    padding: 8px;
    font-size: 14px;
  }
  
  .position-slot {
    min-height: 50px;
  }
}

/* Animation for AI recommendations */
.ai-suggestion {
  animation: pulse 2s infinite;
}

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

/* Loading states */
.loading-spinner {
  border: 3px solid #f3f4f6;
  border-top: 3px solid #3b82f6;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 1s linear infinite;
  display: inline-block;
  margin-right: 8px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Enhanced Lineup Builder Styles */
.player-card.assigned {
  opacity: 0.6;
  border-style: dashed !important;
}

.player-card.dragging {
  opacity: 0.8;
  transform: rotate(5deg) scale(0.95);
  z-index: 1000;
}

.position-slot {
  min-height: 70px;
  min-width: 90px;
  border: 1px dashed var(--ws-gray-300);
  border-radius: var(--ws-radius-md);
  padding: var(--ws-spacing-sm);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  transition: all 0.15s ease;
  background-color: var(--ws-gray-100);
}

.position-slot.drag-over {
  border-color: var(--ws-primary);
  background-color: var(--ws-primary-light);
  transform: scale(1.02);
  box-shadow: var(--ws-shadow-md);
  border-style: solid;
}

.position-slot.occupied {
  border: 1px solid var(--ws-primary);
  background-color: var(--ws-primary-light);
  border-style: solid;
}

.forward-slot {
  background: var(--ws-white);
  border-color: var(--ws-warning);
}

.defense-slot {
  background: var(--ws-white);
  border-color: var(--ws-info);
}

.goalie-slot {
  background: var(--ws-white);
  border-color: var(--ws-error);
  min-height: 80px;
  min-width: 100px;
}

.position-slot.occupied.forward-slot {
  background: var(--ws-primary-light);
  border-color: var(--ws-primary);
}

.position-slot.occupied.defense-slot {
  background: var(--ws-primary-light);
  border-color: var(--ws-primary);
}

.position-slot.occupied.goalie-slot {
  background: var(--ws-primary-light);
  border-color: var(--ws-primary);
}

.player-in-slot {
  text-align: center;
  width: 100%;
  position: relative;
}

.remove-player-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: #ef4444;
  color: white;
  border: none;
  cursor: pointer;
  font-size: 10px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.remove-player-btn:hover {
  background-color: #dc2626;
  transform: scale(1.1);
}

.hockey-rink {
  background: linear-gradient(145deg, #e0f2fe 0%, #f8fafc 25%, #f1f5f9 50%, #f8fafc 75%, #e0f2fe 100%);
  border: 4px solid #1565c0;
  border-radius: 80px;
  position: relative;
  overflow: hidden;
}

.hockey-rink::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background-color: #dc2626;
  transform: translateY(-50%);
  z-index: 1;
}

.hockey-rink::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120px;
  height: 120px;
  border: 2px solid #dc2626;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
}

.position-filter.active {
  background-color: #2563eb !important;
  color: white !important;
}

/* Enhanced Mobile-Optimized Lineup Builder */
.mobile-slot {
  min-height: 80px;
  padding: 12px;
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  background: #f9fafb;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.mobile-slot:hover {
  border-color: #6366f1;
  background: #eef2ff;
}

.mobile-slot.drag-over {
  border-color: #3b82f6;
  background: #eff6ff;
  transform: scale(1.02);
}

.mobile-slot.occupied {
  border: 2px solid #059669;
  background: #f0fdf4;
}

.position-label {
  font-size: 10px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.player-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 40px;
}

.player-in-slot-mobile {
  text-align: center;
  width: 100%;
  padding: 8px 4px;
}

.jersey-icon {
  width: 24px;
  height: 24px;
  background: #3b82f6;
  color: white;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: bold;
  margin: 0 auto 4px;
}

.player-name-mobile {
  font-size: 11px;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.2;
  margin-bottom: 2px;
}

.player-stats-mobile {
  font-size: 8px;
  color: #6b7280;
  line-height: 1;
}

.lineup-line {
  transition: all 0.3s ease;
}

.lineup-line:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Export/Print Optimizations */
@media print {
  body { 
    background: white !important; 
  }
  
  .no-print {
    display: none !important;
  }
  
  #lineup-display {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 20px !important;
  }
  
  .lineup-line {
    break-inside: avoid;
    margin-bottom: 15px;
  }
  
  .position-slot {
    border: 1px solid #333 !important;
    background: white !important;
  }
  
  .mobile-slot {
    min-height: 60px;
    padding: 8px;
  }
  
  .player-name-mobile {
    font-size: 10px;
    color: #000 !important;
  }
  
  .jersey-icon {
    background: #333 !important;
    color: white !important;
  }
}

/* Mobile Touch Improvements */
@media (max-width: 768px) {
  .mobile-slot {
    min-height: 90px;
    padding: 16px 8px;
    margin: 2px;
  }
  
  .position-label {
    font-size: 11px;
  }
  
  .player-name-mobile {
    font-size: 12px;
  }
  
  .jersey-icon {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }
  
  .lineup-line {
    margin-bottom: 16px;
  }
  
  .grid {
    gap: 8px;
  }
}

@media (max-width: 640px) {
  .mobile-slot {
    min-height: 85px;
    padding: 12px 6px;
  }
  
  .player-name-mobile {
    font-size: 11px;
  }
  
  .jersey-icon {
    width: 26px;
    height: 26px;
    font-size: 10px;
  }
  
  .grid-cols-3 {
    gap: 6px;
  }
  
  .grid-cols-2 {
    gap: 8px;
  }
}

/* Export Modal Styles */
.export-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.export-content {
  background: white;
  border-radius: 12px;
  padding: 24px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  position: relative;
}

.export-lineup {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  max-width: 400px;
  margin: 0 auto;
}

.export-header {
  text-align: center;
  background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
  color: white;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.export-team-name {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 4px;
}

.export-game-info {
  font-size: 12px;
  opacity: 0.9;
}

/* Jersey Colors for Export */
.jersey-forward { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.jersey-defense { background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%); }
.jersey-goalie { background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); }

/* Wealthsimple-Style Player Selection Modal */
.player-selection-item {
  display: flex;
  align-items: center;
  padding: var(--ws-spacing-md) var(--ws-spacing-lg);
  border: 1px solid var(--ws-gray-300);
  border-radius: var(--ws-radius-lg);
  background: var(--ws-white);
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: var(--ws-shadow-sm);
}

.player-selection-item:hover {
  border-color: var(--ws-primary);
  background: var(--ws-primary-light);
  transform: translateY(-1px);
  box-shadow: var(--ws-shadow-md);
}

.player-selection-item.selected {
  border-color: var(--ws-primary);
  background: var(--ws-primary-light);
  box-shadow: var(--ws-shadow-md);
}

.player-selection-item.unavailable {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--ws-gray-100);
}

.player-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--ws-white);
  margin-right: var(--ws-spacing-md);
  font-size: var(--ws-font-size-sm);
}

.player-avatar.forward { background: linear-gradient(135deg, var(--ws-warning) 0%, #D97706 100%); }
.player-avatar.defense { background: linear-gradient(135deg, var(--ws-info) 0%, #1D4ED8 100%); }
.player-avatar.goalie { background: linear-gradient(135deg, var(--ws-error) 0%, #B91C1C 100%); }

.player-info {
  flex: 1;
}

.player-name {
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 2px;
}

.player-details {
  font-size: 12px;
  color: #6b7280;
}

.player-status {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.player-status.roster {
  background: #dcfce7;
  color: #15803d;
}

.player-status.spare {
  background: #fef3c7;
  color: #d97706;
}

.selection-checkmark {
  width: 24px;
  height: 24px;
  border: 2px solid #d1d5db;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.player-selection-item.selected .selection-checkmark {
  background: #10b981;
  border-color: #10b981;
  color: white;
}

/* Enhanced Position Slots - BenchApp Style */
.position-slot {
  cursor: pointer;
  position: relative;
}

.position-slot:hover {
  transform: scale(1.02);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.position-slot.tap-enabled {
  border-style: solid !important;
  border-width: 2px;
}

.position-slot.tap-enabled:hover {
  border-color: #3b82f6 !important;
  background-color: #eff6ff !important;
}

/* Mobile-specific tap indicators */
@media (max-width: 768px) {
  .position-slot .tap-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #3b82f6;
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    opacity: 0.8;
  }
  
  .position-slot.occupied .tap-indicator {
    background: #059669;
  }
}

/* Wealthsimple-inspired lineup cards */
.lineup-line {
  box-shadow: var(--ws-shadow-sm);
  border-radius: var(--ws-radius-lg);
  transition: all 0.15s ease;
  background: var(--ws-white);
  border: 1px solid var(--ws-gray-200);
}

.lineup-line:hover {
  box-shadow: var(--ws-shadow-md);
  transform: translateY(-2px);
  border-color: var(--ws-gray-300);
}

/* Clean Wealthsimple-style headers */
.section-header {
  display: flex;
  align-items: center;
  padding: var(--ws-spacing-md) 0;
  border-bottom: 1px solid var(--ws-gray-200);
  margin-bottom: var(--ws-spacing-lg);
}

.section-header i {
  margin-right: var(--ws-spacing-sm);
  font-size: var(--ws-font-size-lg);
  color: var(--ws-primary);
}

/* Clean position labels */
.position-label {
  font-weight: 600 !important;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  color: var(--ws-gray-700) !important;
  font-size: var(--ws-font-size-xs) !important;
}

/* BenchApp-style player cards in pool */
.player-card {
  background: linear-gradient(to right, #ffffff 0%, #fafafa 100%);
  border-radius: 8px;
  border: 2px solid #e5e7eb;
  transition: all 0.2s ease;
}

.player-card:not(.assigned):hover {
  border-color: #3b82f6;
  background: linear-gradient(to right, #eff6ff 0%, #dbeafe 100%);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.player-card.assigned {
  background: linear-gradient(to right, #f3f4f6 0%, #e5e7eb 100%);
  border-color: #9ca3af;
  border-style: dashed;
}

/* Professional game info header */
.game-info-header {
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.25);
}

/* Enhanced statistics cards */
.stat-card {
  background: linear-gradient(to bottom, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Mobile responsiveness enhancements */
@media (max-width: 768px) {
  .lineup-line {
    margin-bottom: 12px;
  }
  
  .position-slot {
    min-height: 60px !important;
    border-radius: 8px;
  }
  
  .compact-slot {
    min-height: 55px !important;
    padding: 8px !important;
  }
}

/* Animation for modal */
#player-selection-modal {
  animation: fadeIn 0.2s ease-out;
}

#player-selection-modal .bg-white {
  animation: slideUp 0.3s ease-out;
}

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

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

/* Compact Layout for All-Visible Positions */
.compact-slot {
  min-height: 50px !important;
  min-width: 70px !important;
  padding: 4px !important;
  font-size: 10px;
  border-radius: 6px;
}

.compact-slot .position-label {
  font-size: 9px !important;
  font-weight: 600;
  margin-bottom: 2px;
}

.compact-slot .player-placeholder {
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.compact-slot .player-in-slot {
  padding: 2px !important;
  font-size: 9px;
  line-height: 1.1;
}

.compact-slot .jersey-icon {
  width: 18px !important;
  height: 18px !important;
  font-size: 8px !important;
  margin-bottom: 1px;
}

.compact-slot .player-name-mobile {
  font-size: 9px !important;
  line-height: 1.1;
  margin-bottom: 0;
}

.compact-slot .player-stats-mobile {
  font-size: 7px !important;
  display: none; /* Hide stats in compact mode to save space */
}

.compact-slot .remove-player-btn {
  width: 14px !important;
  height: 14px !important;
  top: -4px;
  right: -4px;
  font-size: 8px !important;
}

/* Compact lineup lines */
.lineup-line.compact {
  padding: 8px 6px !important;
  margin-bottom: 8px;
}

.lineup-line.compact .text-xs {
  font-size: 10px !important;
  margin-bottom: 6px !important;
}

/* Ensure all positions fit in viewport */
@media (min-width: 1280px) {
  .compact-layout-container {
    max-height: calc(100vh - 200px);
    overflow: visible;
  }
  
  .compact-slot {
    min-height: 45px !important;
    min-width: 65px !important;
  }
}

@media (min-width: 1536px) {
  .compact-slot {
    min-height: 55px !important;
    min-width: 75px !important;
  }
}