* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #1a0a2e 0%, #2d1b4e 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.container {
  background: #1a0a2e;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  max-width: 800px;
  width: 100%;
  padding: 40px;
  border: 1px solid #3d2a5e;
}

header {
  text-align: center;
  margin-bottom: 30px;
  position: relative;
}

.logo {
  max-width: 200px;
  width: 100%;
  height: auto;
  margin-bottom: 20px;
}

h1 {
  color: #a0ff00;
  font-size: 2.5em;
  margin-bottom: 15px;
}

.theme-selector {
  display: flex;
  gap: 15px;
  align-items: center;
  justify-content: center;
  margin: 20px 0;
  padding: 15px;
  background: #2d1b4e;
  border-radius: 10px;
  border: 1px solid #3d2a5e;
}

.theme-selector label {
  color: #a0ff00;
  font-weight: 600;
  font-size: 1.1em;
}

.theme-selector {
  position: relative;
}

.theme-selector select {
  padding: 10px 40px 10px 15px;
  border: 2px solid #3d2a5e;
  border-radius: 8px;
  background: #1a0a2e;
  color: #ffffff;
  font-size: 1em;
  cursor: pointer;
  min-width: 200px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0ff00' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 12px;
  transition: all 0.3s ease;
}

.theme-selector select:hover {
  border-color: #a0ff00;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0ff00' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-size: 14px;
}

.theme-selector select:focus {
  outline: none;
  border-color: #a0ff00;
  box-shadow: 0 0 10px rgba(160, 255, 0, 0.3);
}

.stats {
  display: flex;
  justify-content: space-around;
  font-size: 1.1em;
  color: #a0ff00;
  font-weight: 600;
}

.question-card {
  background: #2d1b4e;
  padding: 30px;
  border-radius: 15px;
  margin-bottom: 20px;
  border: 1px solid #3d2a5e;
}

#question-text {
  color: #ffffff;
  font-size: 1.5em;
  margin-bottom: 25px;
  line-height: 1.4;
}

.options {
  display: grid;
  gap: 15px;
  margin-bottom: 20px;
}

.option {
  background: #1a0a2e;
  border: 2px solid #3d2a5e;
  padding: 15px 20px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1.1em;
  color: #ffffff;
}

.option:hover {
  border-color: #a0ff00;
  transform: translateX(5px);
  background: #2d1b4e;
}

.option.selected {
  border-color: #a0ff00;
  background: #2d1b4e;
}

.option.correct {
  border-color: #a0ff00;
  background: #1a3e1a;
}

.option.incorrect {
  border-color: #ff0055;
  background: #3e1a2a;
}

.option.disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.explanation {
  background: #2d1b4e;
  border-left: 4px solid #a0ff00;
  padding: 15px;
  border-radius: 5px;
  margin-top: 20px;
  border: 1px solid #3d2a5e;
}

.explanation h3 {
  color: #a0ff00;
  margin-bottom: 10px;
}

.explanation p {
  color: #cccccc;
  line-height: 1.6;
}

.buttons {
  text-align: center;
  margin-top: 20px;
}

.btn {
  padding: 12px 30px;
  border: none;
  border-radius: 8px;
  font-size: 1.1em;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
}

.btn-primary {
  background: #a0ff00;
  color: #000000;
}

.btn-primary:hover {
  background: #8ee000;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(160, 255, 0, 0.4);
}

.btn-secondary {
  background: #3d2a5e;
  color: #a0ff00;
  border: 2px solid #a0ff00;
}

.btn-secondary:hover {
  background: #a0ff00;
  color: #000000;
}

.results {
  text-align: center;
  padding: 40px;
}

.results h2 {
  color: #a0ff00;
  font-size: 2.5em;
  margin-bottom: 20px;
}

.final-score {
  font-size: 2em;
  color: #ffffff;
  margin: 20px 0;
  font-weight: bold;
}

.percentage {
  font-size: 1.5em;
  color: #a0ff00;
  margin-bottom: 30px;
}

.hidden {
  display: none !important;
}

footer {
  text-align: center;
  margin-top: 20px;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: #1a0a2e;
  padding: 30px;
  border-radius: 15px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  border: 1px solid #3d2a5e;
}

.modal-content h2 {
  color: #a0ff00;
}

.close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 2em;
  cursor: pointer;
  color: #a0ff00;
}

.close:hover {
  color: #8ee000;
}

#add-question-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 20px;
}

#add-question-form input,
#add-question-form select,
#add-question-form textarea {
  padding: 12px;
  border: 2px solid #3d2a5e;
  border-radius: 8px;
  font-size: 1em;
  font-family: inherit;
  background: #2d1b4e;
  color: #ffffff;
}

#add-question-form textarea {
  min-height: 100px;
  resize: vertical;
}

#add-question-form input:focus,
#add-question-form select:focus,
#add-question-form textarea:focus {
  outline: none;
  border-color: #a0ff00;
}

/* Login Page */
.login-container {
  background: #1a0a2e;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  max-width: 400px;
  width: 100%;
  padding: 40px;
  border: 1px solid #3d2a5e;
  text-align: center;
}

.login-logo {
  max-width: 180px;
  width: 100%;
  margin-bottom: 30px;
}

.login-container h2 {
  color: #a0ff00;
  margin-bottom: 30px;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

#login-form input {
  padding: 12px;
  border: 2px solid #3d2a5e;
  border-radius: 8px;
  font-size: 1em;
  background: #2d1b4e;
  color: #ffffff;
}

#login-form input:focus {
  outline: none;
  border-color: #a0ff00;
}

.error-message {
  color: #ff0055;
  font-size: 0.9em;
  margin-top: 10px;
}

.admin-gear-btn {
  background: transparent;
  border: 1px solid #3d2a5e;
  color: #a0ff00;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  font-size: 1.3em;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.admin-gear-btn:hover {
  background: #2d1b4e;
  border-color: #a0ff00;
  transform: rotate(90deg);
  box-shadow: 0 0 15px rgba(160, 255, 0, 0.3);
}

.admin-section {
  text-align: center;
  margin: 15px 0;
  padding: 15px;
  background: #1a0a2e;
  border-radius: 10px;
  border: 1px solid #3d2a5e;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.btn-danger {
  background: #ff0055;
  color: #ffffff;
}

.btn-danger:hover {
  background: #cc0044;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(255, 0, 85, 0.4);
}

.help-modal-content {
  max-width: 700px;
  max-height: 80vh;
  overflow-y: auto;
}

.help-content {
  text-align: left;
  color: #ffffff;
}

.help-content h3 {
  color: #a0ff00;
  margin-top: 20px;
  margin-bottom: 10px;
}

.help-content ol, .help-content ul {
  margin-left: 20px;
  line-height: 1.8;
}

.help-content li {
  margin-bottom: 8px;
}

.code-block {
  background: #0a0a1a;
  border: 1px solid #3d2a5e;
  border-radius: 5px;
  padding: 15px;
  margin: 10px 0;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  white-space: pre-wrap;
  color: #a0ff00;
}


.user-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 15px;
  background: #2d1b4e;
  border-radius: 10px;
  border: 1px solid #3d2a5e;
  gap: 15px;
}

.user-name {
  color: #a0ff00;
  font-weight: 600;
}

.logout-btn {
  background: transparent;
  border: 1px solid #ff0055;
  color: #ff0055;
  padding: 8px 15px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.9em;
}

.logout-btn:hover {
  background: #ff0055;
  color: #ffffff;
}

.progreso-info {
  background: #2d1b4e;
  border: 1px solid #3d2a5e;
  padding: 15px;
  border-radius: 10px;
  margin: 15px 0;
  color: #ffffff;
}

.progreso-text {
  font-size: 1em;
  text-align: center;
  margin-bottom: 10px;
  font-weight: 600;
}

.progreso-bar-container {
  width: 100%;
  height: 30px;
  background: #1a0a2e;
  border-radius: 15px;
  overflow: hidden;
  border: 1px solid #3d2a5e;
  position: relative;
}

.progreso-bar {
  height: 100%;
  background: linear-gradient(90deg, #a0ff00 0%, #7acc00 100%);
  border-radius: 15px;
  transition: width 0.5s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 0 20px rgba(160, 255, 0, 0.5);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(160, 255, 0, 0.5);
  }
  50% {
    box-shadow: 0 0 30px rgba(160, 255, 0, 0.8);
  }
}

.progreso-bar-text {
  color: #000000;
  font-weight: bold;
  font-size: 0.9em;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
  z-index: 1;
}

/* Estilos para formularios en modales */
#create-theme-form,
#add-question-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 20px;
}

#create-theme-form input,
#add-question-form input,
#add-question-form select,
#add-question-form textarea {
  padding: 12px;
  border: 2px solid #3d2a5e;
  border-radius: 8px;
  font-size: 1em;
  font-family: inherit;
  background: #2d1b4e;
  color: #ffffff;
  width: 100%;
}

#add-question-form textarea {
  min-height: 100px;
  resize: vertical;
}

#create-theme-form input:focus,
#add-question-form input:focus,
#add-question-form select:focus,
#add-question-form textarea:focus {
  outline: none;
  border-color: #a0ff00;
}

#create-theme-form label,
#add-question-form label {
  color: #a0ff00;
  font-weight: 600;
  margin-top: 10px;
}

#create-theme-message,
#add-question-message {
  margin-top: 10px;
}

.close-modal {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 2em;
  cursor: pointer;
  color: #a0ff00;
  transition: color 0.3s ease;
}

.close-modal:hover {
  color: #8ee000;
}

/* Responsive Design */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .container {
    padding: 20px;
    border-radius: 15px;
  }

  .logo {
    max-width: 150px;
  }

  .theme-selector {
    flex-direction: column;
    gap: 10px;
  }

  .theme-selector select {
    width: 100%;
    min-width: unset;
  }

  .theme-selector label {
    font-size: 1em;
  }

  #start-test-btn {
    width: 100%;
  }

  .stats {
    flex-direction: column;
    gap: 10px;
    font-size: 1em;
  }

  .question-card {
    padding: 20px;
  }

  #question-text {
    font-size: 1.2em;
  }

  .option {
    padding: 12px 15px;
    font-size: 1em;
  }

  .user-info {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }

  .admin-section {
    flex-direction: column;
  }

  .admin-section .btn {
    width: 100%;
  }

  .modal-content {
    width: 95%;
    padding: 20px;
    max-height: 95vh;
  }

  .help-modal-content {
    max-width: 95%;
  }

  .results h2 {
    font-size: 2em;
  }

  .final-score {
    font-size: 1.5em;
  }

  .percentage {
    font-size: 1.2em;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 15px;
  }

  .logo {
    max-width: 120px;
  }

  h1 {
    font-size: 2em;
  }

  #question-text {
    font-size: 1.1em;
  }

  .option {
    padding: 10px 12px;
    font-size: 0.95em;
  }

  .btn {
    padding: 10px 20px;
    font-size: 1em;
  }

  .modal-content {
    padding: 15px;
  }

  .help-content {
    font-size: 0.9em;
  }
}

/* Mejoras adicionales para select en móviles */
@media (max-width: 768px) {
  .theme-selector select {
    font-size: 16px; /* Evita zoom en iOS */
  }
}
