:root {
  --primary: #9c27b0;
  --primary-dark: #7b1fa2;
  --secondary: #ff1493;
  --accent: #00bcd4;
  --accent-light: #4dd0e1;
  --success: #4caf50;
  --warning: #ff9800;
  --danger: #f44336;
  --dark: #1a1a1a;
  --light: #f5f5f5;
  --gray: #757575;
  --border: #e0e0e0;
  --white: #ffffff;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: var(--dark);
  line-height: 1.6;
  min-height: 100vh;
}

/* ========== HEADER ========== */
header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--white);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.8rem;
  font-weight: bold;
  text-decoration: none;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  font-size: 2rem;
}

nav a {
  color: var(--white);
  text-decoration: none;
  margin-left: 2rem;
  transition: opacity 0.3s ease;
}

nav a:hover {
  opacity: 0.8;
}

/* ========== CONTAINER ========== */
.container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* ========== CARDS ========== */
.card {
  background: var(--white);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  margin-bottom: 1.5rem;
}

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

.card-title {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--primary);
  border-bottom: 3px solid var(--secondary);
  padding-bottom: 0.5rem;
}

/* ========== FORMS ========== */
.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--dark);
}

input, textarea, select {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
  font-family: inherit;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(156, 39, 176, 0.1);
}

input[type="number"] {
  max-width: 150px;
}

/* ========== BUTTONS ========== */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--white);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(156, 39, 176, 0.4);
}

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

.btn-secondary:hover {
  opacity: 0.9;
}

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

.btn-success:hover {
  opacity: 0.9;
}

.btn-block {
  width: 100%;
  margin-top: 1rem;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

/* ========== TABLES ========== */
.matches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.match-card {
  background: var(--white);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-left: 5px solid var(--accent);
  transition: transform 0.3s ease;
}

.match-card:hover {
  transform: translateY(-2px);
}

.match-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--gray);
}

.match-teams {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
}

.flag {
  font-size: 2.5rem;
}

.vs {
  color: var(--primary);
  font-weight: bold;
  margin: 0 0.5rem;
}

.match-result {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--primary);
}

.result-input {
  width: 60px;
  text-align: center;
  font-size: 1.1rem;
}

.match-status {
  text-align: center;
  padding: 0.5rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.status-pending {
  background: #fff3cd;
  color: #856404;
}

.status-finished {
  background: #d4edda;
  color: #155724;
}

/* ========== RANKING TABLE ========== */
.ranking-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
}

.ranking-table thead {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--white);
}

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

.ranking-table tr:hover {
  background: #f9f9f9;
}

.ranking-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-weight: bold;
  color: var(--white);
}

.rank-1 {
  background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
  color: var(--dark);
}

.rank-2 {
  background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%);
}

.rank-3 {
  background: linear-gradient(135deg, #cd7f32 0%, #daa520 100%);
}

.rank-other {
  background: var(--gray);
}

/* ========== TABS ========== */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--border);
}

.tab-btn {
  background: none;
  border: none;
  padding: 1rem 1.5rem;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray);
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ========== AUTH PAGES ========== */
.auth-container {
  max-width: 400px;
  margin: 3rem auto;
}

.auth-card {
  background: var(--white);
  border-radius: 12px;
  padding: 2.5rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

.auth-title {
  font-size: 2rem;
  text-align: center;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.auth-subtitle {
  text-align: center;
  color: var(--gray);
  margin-bottom: 2rem;
}

.auth-link {
  text-align: center;
  margin-top: 1rem;
  color: var(--gray);
}

.auth-link a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.auth-link a:hover {
  text-decoration: underline;
}

/* ========== GROUPS LAYOUT ========== */
.groups-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.group {
  background: var(--white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.group-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: var(--white);
  padding: 1rem;
  font-size: 1.5rem;
  font-weight: bold;
  text-align: center;
}

.group-body {
  padding: 1.5rem;
}

.group-match {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.group-match:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

/* ========== ALERTS ========== */
.alert {
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert-warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

.alert-info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    gap: 1rem;
  }

  nav {
    display: flex;
    gap: 1rem;
  }

  nav a {
    margin-left: 0;
  }

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

  .match-teams {
    font-size: 0.95rem;
  }

  .flag {
    font-size: 2rem;
  }

  .tabs {
    overflow-x: auto;
  }

  .tab-btn {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

  .ranking-table th,
  .ranking-table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.9rem;
  }

  .groups-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 0.95rem;
  }

  .card {
    padding: 1.5rem 1rem;
  }

  .match-card {
    padding: 1rem;
  }

  .logo {
    font-size: 1.3rem;
  }

  .logo-icon {
    font-size: 1.5rem;
  }

  .auth-card {
    padding: 1.5rem 1rem;
  }

  .btn {
    padding: 0.65rem 1.25rem;
    font-size: 0.95rem;
  }

  .flag {
    font-size: 1.5rem;
  }

  .team {
    font-size: 0.85rem;
  }
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(156, 39, 176, 0.3);
  border-radius: 50%;
  border-top-color: var(--primary);
  animation: spin 1s linear infinite;
}

/* ========== UTILITIES ========== */
.text-center {
  text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.hidden { display: none; }

.text-muted {
  color: var(--gray);
}

.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger);
}
