/**
 * Quiniela Liga MX - Componentes
 * Modales, formularios, loading overlays y otros componentes
 */

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  color: white;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--secondary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ===== MODAL ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
}

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: var(--radius-lg);
  max-width: 450px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-xl);
}

.close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}

.close:hover {
  background: var(--bg-light);
  color: var(--text-dark);
}

/* ===== AUTH FORMS ===== */
.auth-form h2 {
  color: var(--primary-color);
  margin-bottom: 1.5rem;
  text-align: center;
}

.form-group {
  margin-bottom: 1.25rem;
}

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

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 0.875rem;
  transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 104, 71, 0.1);
}

.form-group small {
  display: block;
  margin-top: 0.25rem;
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.auth-switch {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--text-secondary);
}

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

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

/* ===== AUTH REQUIRED ===== */
.auth-required {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-secondary);
}

.auth-required i {
  font-size: 4rem;
  color: var(--text-light);
  margin-bottom: 1.5rem;
}

.auth-required p {
  font-size: 1.125rem;
  margin-bottom: 1.5rem;
}

/* ===== PLAYOFF RULES MODAL ===== */
.playoff-rules-modal {
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  background: white;
}

.playoff-rules-modal .modal-header {
  text-align: center;
  padding: 2rem 2rem 1rem;
  border-bottom: 2px solid var(--border-color);
}

.playoff-rules-modal .modal-header h2 {
  margin: 1rem 0 0;
  color: var(--text-dark);
  font-size: 1.75rem;
}

.playoff-rules-content {
  padding: 2rem;
}

.intro-text {
  font-size: 1.05rem;
  color: var(--text-dark);
  text-align: center;
  margin-bottom: 2rem;
  line-height: 1.6;
  padding: 1rem;
  background: var(--bg-light);
  border-radius: 8px;
}

/* System Sections */
.system-section {
  margin-bottom: 2.5rem;
  padding: 1.5rem;
  background: white;
  border: 2px solid var(--border-color);
  border-radius: 12px;
}

.system-section.system-bonus {
  background: linear-gradient(135deg, #f0fdf4, white);
  border-color: var(--primary-color);
}

.system-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1rem;
  color: var(--primary-color);
  font-size: 1.3rem;
}

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

.system-description {
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.points-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1rem 0;
}

.point-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-light);
  border-radius: 8px;
  border-left: 4px solid var(--primary-color);
}

.point-desc {
  font-size: 0.95rem;
  color: var(--text-dark);
}

.point-val {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-color);
}

.system-note {
  margin: 1rem 0 0;
  padding: 0.75rem;
  background: #fff3cd;
  border-left: 4px solid #ffc107;
  border-radius: 6px;
  color: #856404;
  font-size: 0.95rem;
}

/* Total Points Section */
.total-points-section {
  margin: 2.5rem 0;
  padding: 1.5rem;
  background: linear-gradient(135deg, #dbeafe, #e0f2fe);
  border-radius: 12px;
}

.total-points-section h3 {
  margin: 0 0 1.5rem;
  color: var(--text-dark);
  font-size: 1.3rem;
  text-align: center;
}

.points-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.points-table thead {
  background: var(--primary-color);
  color: white;
}

.points-table th {
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
}

.points-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.points-table tbody tr:last-child td {
  border-bottom: none;
}

.points-table td.highlight {
  font-weight: 700;
  color: var(--primary-color);
}

.points-table .total-row {
  background: var(--bg-light);
  font-weight: 700;
}

.points-table .total-highlight {
  font-size: 1.2rem;
  color: var(--primary-color);
  text-align: center;
}

/* Example Section Enhancements */
.example-predictions,
.example-results {
  margin-top: 1rem;
  font-weight: 600;
  color: var(--primary-color);
}

.example-note {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #dbeafe, #e0f2fe);
  border-left: 4px solid #3b82f6;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #1e40af;
  line-height: 1.5;
}

/* Rules Grid */
.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.rule-card {
  background: white;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.3s ease;
}

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

.rule-card.rule-playin {
  border-color: #3b82f6;
}

.rule-card.rule-quarters {
  border-color: #10b981;
}

.rule-card.rule-semis {
  border-color: #f59e0b;
}

.rule-card.rule-final {
  border-color: #ef4444;
  background: linear-gradient(135deg, #fff5f5, white);
}

.rule-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border-color);
}

.rule-icon {
  font-size: 1.75rem;
}

.rule-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-dark);
}

.rule-points {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.point-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: var(--bg-light);
  border-radius: 6px;
}

.point-item.champion-bonus {
  background: linear-gradient(135deg, #fef3c7, #fef9c3);
  border: 1px solid #fbbf24;
}

.point-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.point-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-color);
}

.rule-note {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
}

.rule-note strong {
  color: var(--primary-color);
  font-size: 1.05rem;
}

/* Important Notes */
.important-notes {
  background: #fff3cd;
  border: 2px solid #ffc107;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.important-notes h3 {
  margin: 0 0 1rem;
  color: #856404;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.2rem;
}

.important-notes h3 i {
  color: #ffc107;
}

.important-notes ul {
  margin: 0;
  padding-left: 1.5rem;
}

.important-notes li {
  margin-bottom: 0.75rem;
  color: #856404;
  line-height: 1.5;
}

.important-notes li:last-child {
  margin-bottom: 0;
}

/* Example Section */
.example-section {
  background: var(--bg-light);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.example-section h3 {
  margin: 0 0 1rem;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.2rem;
}

.example-section h3 i {
  color: #fbbf24;
}

.example-box {
  background: white;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem;
}

.example-box p {
  margin: 0.5rem 0;
  color: var(--text-dark);
  line-height: 1.6;
}

.example-result {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem !important;
  padding-top: 1rem;
  border-top: 2px dashed var(--border-color);
}

.example-result span {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--bg-light);
  border-radius: 6px;
}

.example-result .total {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  font-weight: 700;
  font-size: 1.05rem;
}

.highlight-green {
  color: #059669;
}

/* Modal Footer */
.playoff-rules-modal .modal-footer {
  display: flex;
  gap: 1rem;
  justify-content: center;
  padding-top: 1.5rem;
  border-top: 2px solid var(--border-color);
}

/* Responsive */
@media (max-width: 768px) {
  .playoff-rules-modal {
    max-height: 95vh;
    max-width: 98vw;
    width: 98vw;
    margin: 0 auto;
  }

  .playoff-rules-content {
    padding: 1rem 0.5rem;
  }

  .playoff-rules-modal .modal-header {
    padding: 1rem 0.5rem 0.75rem;
  }

  .playoff-rules-modal .modal-header h2 {
    font-size: 1.3rem;
  }

  .rules-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .rule-card {
    padding: 0.75rem;
  }

  .important-notes {
    padding: 0.75rem;
  }

  .example-section {
    padding: 0.75rem;
  }

  .system-section {
    padding: 0.75rem;
  }

  .system-title {
    font-size: 1rem;
  }

  .points-table {
    font-size: 0.8rem;
  }

  .points-table th,
  .points-table td {
    padding: 0.4rem 0.25rem;
  }

  .total-points-section {
    padding: 0.75rem;
  }

  .total-points-section h3 {
    font-size: 1rem;
  }

  .point-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .point-val {
    align-self: flex-end;
  }

  .playoff-rules-modal .modal-footer {
    flex-direction: column;
    padding: 1rem 0.5rem;
  }

  .playoff-rules-modal .modal-footer .btn {
    width: 100%;
  }

  .intro-text {
    padding: 0.75rem;
    font-size: 0.95rem;
  }

  .system-description {
    font-size: 0.9rem;
  }
}
