/* QuiniMasters Web App - Global Styles */

@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@300;400;500;600;700&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css');

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

body {
  font-family: 'Quicksand', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:
    repeating-linear-gradient(
      0deg,
      #1a4d2e 0px,
      #1a4d2e 60px,
      #2d5016 60px,
      #2d5016 120px
    ),
    linear-gradient(135deg, #1a3a0f 0%, #1a4d2e 50%, #0d2818 100%);
  min-height: 100vh;
  padding: 20px;
  background-attachment: fixed;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0px,
      transparent 50px,
      rgba(255, 255, 255, 0.015) 50px,
      rgba(255, 255, 255, 0.015) 100px
    );
  pointer-events: none;
  z-index: 0;
}

body > * {
  position: relative;
  z-index: 1;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

.card {
  background: white;
  border-radius: 10px;
  padding: 30px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.card h2 {
  font-family: 'Quicksand', sans-serif;
  color: #1a4d2e;
  margin-bottom: 20px;
  font-size: 32px;
  letter-spacing: 1px;
}

.card h3 {
  font-family: 'Quicksand', sans-serif;
  color: #2d5016;
  margin-bottom: 15px;
  font-size: 24px;
  letter-spacing: 0.5px;
}

.card h4 {
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  color: #1a4d2e;
}

/* Buttons */
.btn {
  background: #3d7c1f;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.3s;
  text-decoration: none;
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn:hover {
  background: #2d5016;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-secondary {
  background: #6c757d;
}

.btn-secondary:hover {
  background: #5a6268;
}

.btn-danger {
  background: #dc3545;
}

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

.btn-success {
  background: #28a745;
}

.btn-success:hover {
  background: #218838;
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: white;
  color: #444;
  border: 2px solid #ddd;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s;
  text-decoration: none;
  text-transform: none;
  letter-spacing: 0;
}

.btn-google:hover {
  background: #f8f9fa;
  border-color: #aaa;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-google i {
  color: #4285f4;
  font-size: 18px;
}

.btn-apple {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #000;
  color: white;
  border: 2px solid #000;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s;
  text-decoration: none;
  text-transform: none;
  letter-spacing: 0;
}

.btn-apple:hover {
  background: #1a1a1a;
  border-color: #1a1a1a;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  color: white;
}

.btn-apple i {
  font-size: 18px;
}

/* Navbar */
.navbar {
  background: white;
  border-radius: 10px;
  padding: 30px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.nav-brand {
  font-family: 'Quicksand', sans-serif;
  font-size: 32px;
  font-weight: bold;
  color: #4ade80;
  letter-spacing: 2px;
}

.nav-links {
  display: flex;
  gap: 15px;
  align-items: center;
}

.nav-links a {
  color: #2d5016;
  text-decoration: none;
  padding: 8px 15px;
  border-radius: 5px;
  transition: all 0.3s;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 18px;
  letter-spacing: 0.5px;
}

.nav-links a i {
  font-size: 20px;
}

.nav-links a:hover,
.nav-links a.active {
  background: #e8f5e9;
  color: #1a4d2e;
}

.nav-points {
  background: linear-gradient(135deg, #3d7c1f 0%, #2d5016 100%);
  color: #ffd700;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  border: 2px solid #ffd700;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 5px;
  color: #555;
  font-weight: 500;
}

input, select, textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* Alerts */
#alert-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  max-width: 400px;
}

.alert {
  padding: 12px 20px;
  border-radius: 5px;
  margin-bottom: 10px;
  animation: slideIn 0.3s ease-out;
}

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

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

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

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

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: white;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 10px;
  padding: 30px;
}

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

.modal-header h3 {
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
}

/* Grid */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* Quiniela cards */
.quiniela-card, .invitation-card, .match-card {
  background: linear-gradient(135deg, #ffffff 0%, #f1f8f4 100%);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 15px;
  cursor: pointer;
  transition: all 0.3s;
  border-left: 4px solid #3d7c1f;
}

.quiniela-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(45, 80, 22, 0.2);
  border-left-color: #ffd700;
}

.quiniela-card h3, .invitation-card h4 {
  margin: 0 0 10px 0;
  color: #1a4d2e;
  font-family: 'Quicksand', sans-serif;
  font-size: 24px;
  letter-spacing: 1px;
}

.points {
  font-size: 22px;
  font-weight: 700;
  color: #3d7c1f;
  font-family: 'Quicksand', sans-serif;
  letter-spacing: 1px;
}

.quiniela-actions, .invitation-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

/* Match selection */
.match-item {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 5px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.match-item input[type="checkbox"] {
  width: auto;
}

.match-item label {
  margin: 0;
  cursor: pointer;
  flex: 1;
}

/* Prediction controls */
.prediction-group {
  display: flex;
  gap: 10px;
  align-items: center;
}

.prediction-group label {
  margin: 0;
  cursor: pointer;
}

.prediction-group input[type="radio"] {
  width: auto;
}

/* Leaderboard table */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

table th, table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #333;
}

table tr:hover {
  background: #f8f9fa;
}

/* Table wrapper for horizontal scroll on mobile */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Loading spinner */
#loading {
  display: none;
  text-align: center;
  padding: 20px;
}

/* Login/Register page */
.auth-container {
  max-width: 400px;
  margin: 100px auto;
}

.auth-tabs {
  display: flex;
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  padding: 15px;
  background: white;
  border: none;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  color: #666;
  border-radius: 10px 10px 0 0;
}

.auth-tab.active {
  color: #667eea;
  border-bottom: 3px solid #667eea;
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

/* Username availability indicator */
.username-check {
  font-size: 12px;
  margin-top: 5px;
}

.username-check.available {
  color: #28a745;
}

.username-check.taken {
  color: #dc3545;
}

/* Responsive */
@media (max-width: 768px) {
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }

  /* Keep navbar horizontal on mobile */
  .navbar {
    padding: 15px 10px;
    gap: 8px;
    flex-wrap: nowrap;
  }

  .nav-brand {
    font-size: 16px !important;
    gap: 6px !important;
    flex-shrink: 0;
  }

  .nav-brand img {
    height: 35px !important;
  }

  .nav-brand span {
    font-size: 16px !important;
  }

  .nav-links {
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: nowrap;
  }

  .nav-links a {
    padding: 6px 10px;
    font-size: 16px;
  }

  .nav-points {
    padding: 6px 10px !important;
    font-size: 11px !important;
    white-space: nowrap;
  }

  .quiniela-actions, .invitation-actions {
    flex-direction: column;
  }

  .modal-content {
    padding: 20px;
  }

  /* Make tables more compact on mobile */
  table th, table td {
    padding: 8px 6px;
    font-size: 13px;
  }

  table th:first-child, table td:first-child {
    padding-left: 10px;
  }

  table th:last-child, table td:last-child {
    padding-right: 10px;
  }
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px;
  color: #666;
}

.empty-state h3 {
  color: #999;
  margin-bottom: 10px;
}
