/* Microservices Monopoly - Polished Styles */

:root {
  --primary: #4F46E5;
  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;
  --secondary: #6B7280;
  --dark: #1F2937;
  --light: #F3F4F6;
  --border: #E5E7EB;

  --team-alpha: #FF6B6B;
  --team-beta: #4ECDC4;
  --team-gamma: #45B7D1;
  --team-delta: #FFA07A;

  --auth: #3B82F6;
  --commerce: #9333EA;
  --communication: #F97316;
  --data: #EF4444;
  --features: #EAB308;
  --fulfillment: #22C55E;
  --management: #06B6D4;
  --infrastructure: #92400E;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: var(--dark);
  min-height: 100vh;
  padding: 20px;
}

/* Header - Enhanced */
.game-header {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  padding: 25px 35px;
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  margin-bottom: 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 2px solid rgba(79, 70, 229, 0.1);
}

.game-header h1 {
  font-size: 36px;
  font-weight: 800;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.game-info {
  display: flex;
  gap: 20px;
  align-items: center;
  font-weight: 600;
}

.turn-counter, .bonus-pool {
  background: var(--light);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
}

/* Main Layout */
.game-main {
  display: grid;
  grid-template-columns: 280px 1fr 300px;
  gap: 20px;
  min-height: 700px;
}

/* Team Panel - Enhanced */
.team-panel {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 16px;
  padding: 25px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  border: 2px solid rgba(79, 70, 229, 0.1);
}

.team-panel h2 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 20px;
  color: var(--primary);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.teams-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.team-card {
  background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
  border-radius: 12px;
  padding: 18px;
  border: 3px solid transparent;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.team-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.2), 0 4px 12px rgba(79, 70, 229, 0.3);
  transform: scale(1.03);
  background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
}

.team-card.in-trap {
  border-color: var(--danger);
  background: linear-gradient(135deg, #FEF2F2 0%, #FEE2E2 100%);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.team-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.team-name {
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.team-token {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-block;
}

.team-resources {
  font-size: 18px;
  font-weight: 700;
  color: var(--success);
}

.team-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 12px;
  margin-top: 8px;
}

.team-stat {
  background: white;
  padding: 6px;
  border-radius: 4px;
  text-align: center;
}

.team-stat-label {
  color: var(--secondary);
  display: block;
}

.team-stat-value {
  font-weight: 700;
  font-size: 14px;
  color: var(--dark);
}

/* Board Section */
.board-section {
  background: white;
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.game-board-container {
  position: relative;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

.game-board {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  grid-template-rows: repeat(11, 1fr);
  gap: 4px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: 6px solid var(--dark);
  border-radius: 12px;
  aspect-ratio: 1;
  max-width: 1400px;
  max-height: 1400px;
  margin: 0 auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  position: relative;
}

.board-space {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 16px;
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 3px solid transparent;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  min-height: 0;
}

.board-space:hover {
  background: linear-gradient(135deg, #f0f4ff 0%, #e0e7ff 100%);
  transform: scale(1.08);
  z-index: 10;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
  border-color: var(--primary);
}

.board-space.service {
  border-top: 10px solid;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.board-space.owned {
  background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.board-space.special {
  background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
  font-weight: 700;
}

.board-space.corner {
  font-size: 16px;
  font-weight: 800;
  padding: 8px;
}

.space-name {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.1;
  margin-bottom: 3px;
  word-wrap: break-word;
  max-width: 100%;
  hyphens: auto;
}

.space-cost {
  font-size: 13px;
  color: var(--secondary);
  font-weight: 600;
}

.space-owner {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.space-tokens {
  position: absolute;
  bottom: 3px;
  left: 3px;
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  max-width: 80%;
}

.token-on-space {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.space-lbs {
  position: absolute;
  top: 3px;
  left: 3px;
  background: var(--success);
  color: white;
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 4px;
  font-weight: 700;
}

/* Turn Controls - Centered on Board */
.turn-controls-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.95);
  padding: 20px 30px;
  border-radius: 16px;
  text-align: center;
  z-index: 50;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  border: 3px solid var(--primary);
  max-width: 380px;
  backdrop-filter: blur(20px);
}

/* Old turn controls (deprecated but keeping for fallback) */
.turn-controls {
  background: var(--light);
  padding: 20px;
  border-radius: 8px;
  text-align: center;
}

.current-team-display h3 {
  font-size: 24px;
  margin-bottom: 8px;
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.current-team-display p {
  color: var(--secondary);
  margin-bottom: 15px;
  font-size: 14px;
  font-weight: 500;
}

.dice-controls {
  margin: 15px 0;
}

.dice-result {
  margin-top: 15px;
}

.dice {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-bottom: 12px;
}

.die {
  width: 60px;
  height: 60px;
  background: linear-gradient(145deg, #ffffff, #f0f0f0);
  border: 3px solid var(--primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  box-shadow: 0 6px 12px rgba(79, 70, 229, 0.3), inset 0 2px 4px rgba(255, 255, 255, 0.8);
  transition: all 0.3s ease;
}

.die:hover {
  transform: rotate(5deg);
}

.dice-total {
  font-size: 18px;
  font-weight: 800;
  color: var(--dark);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 15px;
  width: 100%;
}

.action-buttons button {
  width: 100%;
}

/* Buttons - Enhanced Quality */
.btn {
  padding: 14px 28px;
  border: none;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.btn:active {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #4F46E5 100%);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #7c8ef0 0%, #6366F1 100%);
}

.btn-success {
  background: linear-gradient(135deg, #34D399 0%, #10B981 100%);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-success:hover {
  background: linear-gradient(135deg, #4ADE80 0%, #22C55E 100%);
}

.btn-danger {
  background: linear-gradient(135deg, #F87171 0%, #EF4444 100%);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #FCA5A5 0%, #F87171 100%);
}

.btn-warning {
  background: linear-gradient(135deg, #FBBF24 0%, #F59E0B 100%);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-warning:hover {
  background: linear-gradient(135deg, #FCD34D 0%, #FBBF24 100%);
}

.btn-secondary {
  background: linear-gradient(135deg, #9CA3AF 0%, #6B7280 100%);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
  background: linear-gradient(135deg, #D1D5DB 0%, #9CA3AF 100%);
}

.btn-large {
  padding: 14px 28px;
  font-size: 18px;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* Log Panel - Enhanced */
.log-panel {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 16px;
  padding: 25px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  border: 2px solid rgba(79, 70, 229, 0.1);
  max-height: 800px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.log-panel h2 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 20px;
  color: var(--primary);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.game-log {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log-entry {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  border-left: 5px solid;
  animation: slideIn 0.3s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  font-weight: 500;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.log-entry.info {
  background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
  border-color: var(--primary);
}

.log-entry.success {
  background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
  border-color: var(--success);
}

.log-entry.warning {
  background: linear-gradient(135deg, #FEF3C7 0%, #FEF08A 100%);
  border-color: var(--warning);
}

.log-entry.error {
  background: linear-gradient(135deg, #FEF2F2 0%, #FEE2E2 100%);
  border-color: var(--danger);
}

.log-time {
  font-size: 11px;
  color: var(--secondary);
  margin-right: 8px;
}

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.2s ease;
}

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

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 16px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  position: relative;
  animation: slideUp 0.3s ease;
}

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

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 30px;
  cursor: pointer;
  color: var(--secondary);
  line-height: 1;
  padding: 0;
  width: 30px;
  height: 30px;
}

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

/* Card Modal */
.card-modal {
  text-align: center;
  max-width: 500px;
}

.card-emoji {
  font-size: 80px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 28px;
  margin-bottom: 15px;
  color: var(--primary);
}

.card-description {
  font-size: 16px;
  margin-bottom: 20px;
  color: var(--dark);
  line-height: 1.6;
}

.card-effect {
  background: var(--light);
  padding: 15px;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
}

.card-lesson {
  background: #FEF3C7;
  padding: 15px;
  border-radius: 8px;
  text-align: left;
  margin-bottom: 20px;
  border-left: 4px solid var(--warning);
}

.card-lesson strong {
  display: block;
  margin-bottom: 8px;
  color: var(--warning);
}

.card-lesson p {
  margin: 0;
  line-height: 1.5;
  color: var(--dark);
}

/* Property Modal */
.property-details {
  margin: 20px 0;
}

.property-details p {
  margin: 10px 0;
  font-size: 16px;
}

.property-cost, .property-rent {
  font-weight: 700;
}

.modal-actions {
  display: flex;
  gap: 15px;
  margin-top: 20px;
}

.modal-actions button {
  flex: 1;
}

/* Build Modal */
.buildable-services {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px 0;
  max-height: 400px;
  overflow-y: auto;
}

.buildable-service {
  background: var(--light);
  padding: 15px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.buildable-service-info h4 {
  margin-bottom: 5px;
}

.buildable-service-info p {
  font-size: 14px;
  color: var(--secondary);
}

/* Rules Modal */
.rules-modal {
  max-width: 700px;
}

.rules-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.rules-content h3 {
  color: var(--primary);
  margin-bottom: 10px;
}

.rules-content ul, .rules-content ol {
  margin-left: 20px;
  line-height: 1.8;
}

/* Scoring Modal */
.scoring-modal {
  max-width: 800px;
}

.final-scores {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin: 20px 0;
}

.score-card {
  background: var(--light);
  padding: 20px;
  border-radius: 8px;
  border: 3px solid transparent;
}

.score-card.winner {
  border-color: var(--success);
  background: #F0FDF4;
}

.score-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.score-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  font-size: 14px;
}

.score-item {
  display: flex;
  justify-content: space-between;
  padding: 8px;
  background: white;
  border-radius: 4px;
}

.score-total {
  font-size: 32px;
  font-weight: 700;
  color: var(--success);
}

/* Utility Classes */
.hidden {
  display: none !important;
}

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

/* Responsive */
@media (max-width: 1800px) {
  .game-main {
    grid-template-columns: 250px 1fr 250px;
  }

  .game-board {
    max-width: 1100px;
    max-height: 1100px;
  }

  .turn-controls-center {
    max-width: 340px;
    padding: 18px 25px;
  }
}

@media (max-width: 1400px) {
  .game-main {
    grid-template-columns: 220px 1fr 220px;
  }

  .game-board {
    max-width: 900px;
    max-height: 900px;
  }

  .turn-controls-center {
    max-width: 300px;
    padding: 15px 20px;
  }

  .current-team-display h3 {
    font-size: 20px;
  }

  .die {
    width: 50px;
    height: 50px;
    font-size: 28px;
  }
}

@media (max-width: 1200px) {
  .game-main {
    grid-template-columns: 1fr;
  }

  .team-panel, .log-panel {
    max-height: 300px;
  }

  .game-board {
    max-width: 800px;
    max-height: 800px;
  }
}
