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

.hidden {
  display: none !important;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.container {
  width: 100%;
  max-width: 1400px;
}

/* ============ PANEL ACCESO ============ */
#accessPanel {
  background: white;
  border-radius: 10px;
  padding: 40px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  text-align: center;
  animation: slideIn 0.5s ease;
  max-width: 400px;
  margin: 0 auto;
}

#accessPanel h1 {
  color: #333;
  margin-bottom: 10px;
  font-size: 2.5em;
}

.access-subtitle {
  color: #666;
  margin-bottom: 30px;
  font-size: 1.1em;
}

#accessForm {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

#accessForm input {
  padding: 12px 15px;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 1em;
  transition: border-color 0.3s;
}

#accessForm input:focus {
  outline: none;
  border-color: #667eea;
}

#accessForm button {
  padding: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 1.1em;
  cursor: pointer;
  transition: transform 0.2s;
}

#accessForm button:hover {
  transform: scale(1.02);
}

.error-message {
  color: #d32f2f;
  font-size: 0.95em;
  margin-top: 10px;
  padding: 10px;
  background: #ffebee;
  border-radius: 5px;
  display: block;
}

.error-message.hidden {
  display: none;
}

/* ============ PANEL LOGIN ============ */
#loginPanel {
  background: white;
  border-radius: 10px;
  padding: 40px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  text-align: center;
  animation: slideIn 0.5s ease;
}

#loginPanel h1 {
  color: #333;
  margin-bottom: 30px;
  font-size: 2.5em;
}

#loginForm {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-width: 400px;
  margin: 0 auto;
}

#loginForm input {
  padding: 12px 15px;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 1em;
  transition: border-color 0.3s;
}

#loginForm input:focus {
  outline: none;
  border-color: #667eea;
}

#loginForm button {
  padding: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 1.1em;
  cursor: pointer;
  transition: transform 0.2s;
}

#loginForm button:hover {
  transform: scale(1.02);
}

/* ============ MAIN PANEL ============ */
.main-panel {
  margin-top: 20px;
}

.main-row {
  display: flex;
  gap: 20px;
}

.content {
  flex: 1;
  background: white;
  border-radius: 10px;
  padding: 30px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  max-height: 90vh;
  overflow-y: auto;
}

/* ============ FORMULARIO ============ */
.form-section h2 {
  color: #333;
  margin-bottom: 25px;
  border-bottom: 3px solid #667eea;
  padding-bottom: 10px;
}

.form-group {
  margin-bottom: 30px;
}

.form-group h3 {
  color: #555;
  margin-bottom: 15px;
  font-size: 1.1em;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 15px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
}

.form-group div {
  display: flex;
  flex-direction: column;
}

.form-group label {
  margin-bottom: 5px;
  color: #666;
  font-weight: 600;
  font-size: 0.95em;
}

.form-group select,
.form-group input[type="text"] {
  padding: 10px;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 0.95em;
  transition: border-color 0.3s;
}

.form-group select:focus,
.form-group input[type="text"]:focus {
  outline: none;
  border-color: #667eea;
}

.submit-btn {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 1.1em;
  font-weight: bold;
  cursor: pointer;
  margin-top: 20px;
  transition: transform 0.2s;
}

.submit-btn:hover {
  transform: scale(1.02);
}

/* ============ RANKING PANEL ============ */
.ranking-panel {
  width: 320px;
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  height: fit-content;
  position: sticky;
  top: 20px;
}

.ranking-panel h2 {
  color: #333;
  margin-bottom: 20px;
  border-bottom: 2px solid #667eea;
  padding-bottom: 10px;
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 80vh;
  overflow-y: auto;
}

.ranking-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 5px;
  border-left: 4px solid #667eea;
  cursor: pointer;
  transition: background 0.3s;
}

.ranking-item:hover {
  background: #e9ecef;
}

.ranking-item-name {
  font-weight: 600;
  color: #333;
  flex: 1;
}

.ranking-item-points {
  background: #667eea;
  color: white;
  padding: 5px 10px;
  border-radius: 15px;
  font-weight: bold;
  font-size: 0.9em;
}

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

.modal.hidden {
  display: none;
}

.modal-content {
  background-color: white;
  padding: 30px;
  border-radius: 10px;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  position: relative;
}

.close {
  position: absolute;
  right: 20px;
  top: 20px;
  font-size: 28px;
  font-weight: bold;
  color: #aaa;
  cursor: pointer;
}

.close:hover {
  color: #000;
}

#modalTitle {
  color: #333;
  margin-bottom: 20px;
}

#modalBody {
  color: #666;
}

.modal-section {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.modal-section h4 {
  color: #667eea;
  margin-bottom: 10px;
  font-size: 0.95em;
}

.modal-section p {
  color: #555;
  margin: 5px 0;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  .main-row {
    flex-direction: column;
  }

  .ranking-panel {
    width: 100%;
    position: static;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============ TABS ============ */
.tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid #667eea;
}

.tab-btn {
  padding: 8px 14px;
  background: #f0f0f5;
  border: 2px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 600;
  color: #666;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.tab-btn:hover {
  background: #e8e8f8;
  border-color: #667eea;
  color: #667eea;
}

.tab-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: #667eea;
}

.tab-count {
  display: inline-block;
  background: rgba(255,255,255,0.25);
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 0.8em;
  margin-left: 4px;
}

.tab-btn:not(.active) .tab-count {
  background: rgba(102,126,234,0.15);
  color: #667eea;
}

.tab-section {
  min-height: 200px;
}

/* ============ SCROLLBAR ============ */
.content::-webkit-scrollbar,
.ranking-list::-webkit-scrollbar {
  width: 8px;
}

.content::-webkit-scrollbar-track,
.ranking-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.content::-webkit-scrollbar-thumb,
.ranking-list::-webkit-scrollbar-thumb {
  background: #667eea;
  border-radius: 10px;
}

.content::-webkit-scrollbar-thumb:hover,
.ranking-list::-webkit-scrollbar-thumb:hover {
  background: #764ba2;
}

/* ============ ACIERTOS EN VERDE/ROJO ============ */
.prediction-result {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 5px;
  margin: 3px;
  font-size: 0.9em;
  font-weight: 500;
  border-left: 4px solid;
}

.prediction-correct {
  background: #e8f5e9;
  color: #2e7d32;
  border-left-color: #4caf50;
}

.prediction-wrong {
  background: #ffebee;
  color: #c62828;
  border-left-color: #f44336;
}

.prediction-neutral {
  background: #f5f5f5;
  color: #666;
  border-left-color: #999;
}

.predictions-view {
  display: none;
  margin-top: 20px;
}

.predictions-view.active {
  display: block;
}

.predictions-view h3 {
  color: #333;
  margin-bottom: 15px;
  font-size: 1.1em;
}

.predictions-section {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.predictions-section h4 {
  color: #667eea;
  margin-bottom: 10px;
  font-size: 1em;
}

.predictions-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prediction-stat {
  margin-top: 10px;
  padding: 10px;
  background: #f8f9fa;
  border-radius: 5px;
  font-size: 0.95em;
}

.stat-label {
  font-weight: 600;
  color: #333;
}

.stat-value {
  color: #667eea;
  font-weight: bold;
}

/* ============ LOGOUT ============ */
.logout-bar {
  background: white;
  padding: 15px 30px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
  border-radius: 10px;
  text-align: right;
}

.logout-btn {
  padding: 8px 16px;
  background: #f44336;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.9em;
  transition: background 0.3s;
}

.logout-btn:hover {
  background: #d32f2f;
}
