/* 3. Liga Manager - Professional Styles */

:root {
  --bg-dark: #0f1419;
  --bg-card: #1a1f2e;
  --bg-hover: #252d3d;
  --border-color: #2d3748;
  --text-primary: #f7fafc;
  --text-secondary: #a0aec0;
  --text-muted: #718096;
  --accent-green: #38a169;
  --accent-blue: #3182ce;
  --accent-red: #e53e3e;
  --accent-gold: #d69e2e;
  --radius: 8px;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

/* Header */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.back-to-metaplot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-hover);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s;
}

.back-to-metaplot:hover {
  background: var(--accent-blue);
  color: var(--text-primary);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-brand .logo {
  font-size: 1.75rem;
}

.header-brand h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.header-nav {
  display: flex;
  gap: 0.5rem;
  flex: 1;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.nav-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-btn.active {
  background: var(--accent-blue);
  color: white;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.budget {
  background: var(--accent-green);
  color: white;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.875rem;
}

.username {
  color: var(--text-secondary);
  font-weight: 500;
}

/* Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

/* Views */
.view {
  animation: fadeIn 0.3s ease;
}

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

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.view-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.view-header h2 i {
  color: var(--accent-blue);
}

/* Matchday Navigation */
.matchday-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.matchday-nav .nav-arrow {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.matchday-nav .nav-arrow:hover:not(:disabled) {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
}

.matchday-nav .nav-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

#matchday-indicator {
  font-size: 0.875rem;
  color: var(--text-secondary);
  min-width: 60px;
  text-align: center;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
}

.card-header h3 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-header h3 i {
  color: var(--accent-blue);
}

.card-body {
  padding: 1.25rem;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.dashboard-grid .card.wide {
  grid-column: span 3;
}

.team-name-large {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.team-stats {
  display: flex;
  gap: 2rem;
}

.stat {
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-blue);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Team Selection */
#team-selection .container {
  max-width: 1200px;
}

.selection-header {
  text-align: center;
  margin-bottom: 2rem;
}

.selection-header h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.selection-header p {
  color: var(--text-muted);
}

.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.team-option {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.team-option:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.team-badge {
  width: 50px;
  height: 50px;
  background: var(--accent-blue);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.team-details h4 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.team-details p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Data Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background: var(--bg-card);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.data-table tbody tr {
  transition: background 0.2s;
}

.data-table tbody tr:hover {
  background: var(--bg-hover);
}

.data-table tbody tr.highlight {
  background: rgba(49, 130, 206, 0.15);
}

.data-table tbody tr.highlight:hover {
  background: rgba(49, 130, 206, 0.25);
}

/* Standings Table */
.standings-table td:first-child,
.standings-table td:last-child {
  font-weight: 700;
}

.standings-table td:first-child {
  color: var(--accent-gold);
}

/* Position Badges */
.position-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.pos-TW { background: #805ad5; color: white; }
.pos-IV, .pos-LV, .pos-RV { background: #3182ce; color: white; }
.pos-ZDM, .pos-ZM, .pos-LM, .pos-RM { background: #38a169; color: white; }
.pos-ST { background: #e53e3e; color: white; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

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

.btn-primary:hover {
  background: #2c5282;
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
}

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

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

.btn-danger:hover {
  background: #c53030;
}

/* Match Day */
.matchday-status {
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
}

.matchday-status.pending {
  background: rgba(214, 158, 46, 0.2);
  color: var(--accent-gold);
}

.matchday-status.completed {
  background: rgba(56, 161, 105, 0.2);
  color: var(--accent-green);
}

.matches-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.match-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
}

.match-card.my-match {
  border-color: var(--accent-blue);
  background: rgba(49, 130, 206, 0.1);
}

.match-team {
  display: flex;
  flex-direction: column;
}

.match-team.home {
  text-align: right;
}

.match-team.away {
  text-align: left;
}

.match-team .team-name {
  font-weight: 600;
  font-size: 0.875rem;
}

.match-team .team-short {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.match-score {
  text-align: center;
  min-width: 80px;
}

.match-score .score {
  font-size: 1.25rem;
  font-weight: 700;
}

.match-score .vs {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.waiting-message {
  text-align: center;
  padding: 3rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.waiting-message i {
  font-size: 3rem;
  color: var(--accent-gold);
  margin-bottom: 1rem;
}

.waiting-message h3 {
  margin-bottom: 0.5rem;
}

.waiting-message p {
  color: var(--text-muted);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  width: 100%;
  max-width: 450px;
  transform: scale(0.9);
  transition: transform 0.3s;
}

.modal-overlay.show .modal {
  transform: scale(1);
}

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
}

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

.modal-body {
  padding: 1.25rem;
}

.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Form */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-blue);
}

/* Misc */
.text-muted {
  color: var(--text-muted);
}

.standing-preview {
  font-size: 2rem;
  font-weight: 700;
}

.standing-preview .rank {
  color: var(--accent-gold);
}

.match-preview {
  font-size: 1.25rem;
  font-weight: 600;
}

/* Transfer Items */
.transfer-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
}

.transfer-item:last-child {
  border-bottom: none;
}

.transfer-item .player-name {
  font-weight: 500;
  flex: 1;
}

.transfer-item .transfer-teams {
  color: var(--text-secondary);
  margin: 0 1rem;
}

.transfer-item .transfer-price {
  color: var(--accent-green);
  font-weight: 600;
}

.market-budget {
  font-size: 1rem;
}

.market-budget strong {
  color: var(--accent-green);
}

/* Responsive */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-grid .card.wide {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  .header {
    flex-wrap: wrap;
    height: auto;
    padding: 1rem;
  }

  .header-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-top: 0.5rem;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-grid .card.wide {
    grid-column: span 1;
  }

  .teams-grid {
    grid-template-columns: 1fr;
  }
}

/* Help Button */
.help-btn {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--primary);
  color: var(--primary);
  font-size: 1.25rem;
  font-weight: bold;
  cursor: pointer;
  z-index: 1000;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-btn:hover {
  background: var(--primary);
  color: white;
  transform: scale(1.1);
}

/* Help Modal */
.help-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.help-modal.show {
  display: flex;
}

.help-modal-content {
  background: var(--bg-card);
  border-radius: 1rem;
  padding: 2rem;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  border: 1px solid var(--border);
}

.help-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.3s;
}

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

.help-modal-content h2 {
  margin-bottom: 1.5rem;
  color: var(--primary);
  font-size: 1.5rem;
}

.help-modal-content h3 {
  margin: 1.25rem 0 0.5rem;
  color: var(--text);
  font-size: 1.1rem;
}

.help-modal-content p {
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.help-modal-content a {
  color: var(--primary);
}

/* ========================================
   News Ticker
   ======================================== */
.news-ticker {
  background: linear-gradient(90deg, var(--accent-red) 0%, var(--bg-card) 50%, var(--accent-green) 100%);
  color: white;
  padding: 0.5rem 0;
  overflow: hidden;
  position: relative;
}

.ticker-content {
  display: flex;
  gap: 4rem;
  animation: ticker 30s linear infinite;
  white-space: nowrap;
}

.ticker-item {
  font-size: 0.9rem;
  font-weight: 500;
}

@keyframes ticker {
  0% { transform: translateX(100vw); }
  100% { transform: translateX(-100%); }
}

/* ========================================
   Season Statistics
   ======================================== */
.season-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  text-align: center;
}

.season-stat {
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-radius: 8px;
}

.season-stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.season-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ========================================
   Player Comparison Modal
   ======================================== */
.compare-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.compare-modal.active {
  display: flex;
}

.compare-content {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 2rem;
  max-width: 600px;
  width: 90%;
}

.compare-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.compare-header h3 {
  margin: 0;
}

.compare-close {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
}

.compare-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  text-align: center;
}

.compare-player {
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 8px;
}

.compare-vs {
  display: flex;
  align-items: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.compare-stat-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

.compare-stat-row:last-child {
  border-bottom: none;
}

.compare-stat-value {
  font-weight: 600;
}

.compare-stat-value.winner {
  color: var(--accent-green);
}

.compare-stat-label {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ========================================
   Formation Display
   ======================================== */
.formation-pitch {
  background: linear-gradient(180deg, #2d8a4e 0%, #236b3c 100%);
  border-radius: 8px;
  padding: 1rem;
  aspect-ratio: 3/4;
  position: relative;
  max-width: 300px;
  margin: 0 auto;
}

.formation-line {
  display: flex;
  justify-content: space-around;
  margin-bottom: 1.5rem;
}

.formation-player {
  width: 40px;
  height: 40px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: #1a1a2e;
}
