:root {
  --primary-orange: #ff6b35;
  --light-orange: #ffa07a;
  --hover-orange: #ff8c5a;
  --border-color: #ddd;
  --bg-light: #f8f8f8;
  --bg-main: #f0f0f0;
  --bg-white: #ffffff;
}

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

body {
  background-color: var(--bg-main);
  font-family: Arial, sans-serif;
  line-height: 1.6;
  padding-top: 0;
}

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

/* Panel de Configuración */
.config-panel {
  background-color: var(--bg-white);
  padding: 25px;
  border-radius: 12px;
  margin-bottom: 25px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Formularios y Campos */
.form-group {
  margin-bottom: 15px;
}

.form-control {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
  background-color: var(--bg-light);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.form-control:focus {
  border-color: var(--primary-orange);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
  outline: none;
}

/* Botones */
.btn {
  background-color: var(--primary-orange);
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.btn:hover {
  background-color: var(--hover-orange);
}

/* Preguntas y Respuestas */
.question-container {
  background-color: var(--bg-white);
  padding: 25px;
  margin-bottom: 25px;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

.question-number {
  font-weight: bold;
  color: var(--primary-orange);
  font-size: 1.2em;
}

.question-text {
  font-size: 1.1em;
  margin-bottom: 15px;
}

.answer-option {
  background-color: var(--bg-light);
  border: 2px solid var(--border-color);
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 6px;
  transition: transform 0.2s;
}

.answer-option:hover {
  transform: translateX(5px);
  background-color: #f4f4f4;
}

.answer-option input[type="text"] {
  flex-grow: 1;
}

.answer-option input[type="radio"],
.answer-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.question-controls {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

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

.btn-danger {
  background-color: #dc3545;
}

.correct-answer-indicator {
  color: #28a745;
  margin-left: 10px;
}

/* Vista Previa */
.preview-section {
  padding: 20px;
}

.preview-content {
  width: 21cm; /* Tamaño A4 */
  height: 29.7cm; /* Tamaño A4 */
  margin: 0 auto;
  padding: 2.54cm; /* Márgenes estándar de 1 pulgada */
  background: white;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  border: 1px solid #ddd;
  position: relative;
  overflow-y: auto;
  font-family: var(--font-family);
}

/* Contenedor para simular el papel */
.preview-paper {
  background: #f5f5f5;
  padding: 40px;
  border-radius: 4px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
}

.preview-question {
  margin-bottom: 15px;
}

.preview-answer {
  margin-left: 20px;
  margin-bottom: 5px;
}

/* Estilos para fracciones en la vista previa */
.preview-fraction {
  display: inline-block;
  vertical-align: middle;
  margin: 0 3px;
  text-align: center;
}

.preview-fraction-top {
  border-bottom: 2px solid #000;
  padding: 0 3px;
}

/* Regla para mostrar el tamaño del papel */
.preview-ruler {
  position: absolute;
  font-size: 12px;
  color: #999;
}

.preview-ruler.horizontal {
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
}

.preview-ruler.vertical {
  top: 50%;
  left: -20px;
  transform: translateY(-50%) rotate(-90deg);
}

/* Estilos para el scroll cuando el contenido excede una página */
.preview-content {
  max-height: 80vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-orange) #f1f1f1;
}

.preview-content::-webkit-scrollbar {
  width: 8px;
}

.preview-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.preview-content::-webkit-scrollbar-thumb {
  background: var(--primary-orange);
  border-radius: 4px;
}

/* Indicador de página */
.preview-page-number {
  position: absolute;
  bottom: 20px;
  right: 20px;
  font-size: 12px;
  color: #666;
}

.hidden {
  display: none;
}

.btn-toggle {
  background: none;
  border: none;
  color: var(--primary-orange);
  cursor: pointer;
  padding: 5px 0;
  font-size: 14px;
  margin: 5px 0;
}

.btn-toggle:hover {
  color: var(--hover-orange);
}

.form-group > *:not(:last-child) {
  margin-bottom: 10px;
}

.add-question-container {
  position: sticky;
  bottom: 20px;
  background-color: var(--bg-white);
  padding: 15px;
  border-radius: 12px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  text-align: center;
  margin-top: 20px;
  z-index: 100;
}

.btn-primary {
  background-color: var(--primary-orange);
  color: white;
  padding: 12px 24px;
  font-size: 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary:hover {
  background-color: var(--hover-orange);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.answer-options-container {
  margin: 15px 0;
}

.answer-option {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-light);
  border: 2px solid var(--border-color);
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.answer-option:hover {
  transform: translateX(5px);
  background-color: #f4f4f4;
}

.answer-controls {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.btn-icon {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 5px;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  color: var(--primary-orange);
  transform: scale(1.1);
}

.btn-delete {
  color: #dc3545;
}

.btn-delete:hover {
  color: #bd2130;
}

.question-controls {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  justify-content: space-between;
}

.question-type-container {
  background-color: var(--bg-light);
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 15px;
}

.error-message {
  color: #dc3545;
  font-size: 0.9em;
  margin-top: 5px;
  display: none;
  animation: fadeIn 0.3s ease;
}

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

.form-control.error {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.error-shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

.validation-tooltip {
  position: absolute;
  background-color: #dc3545;
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.9em;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.validation-tooltip::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 10px;
  border-width: 0 5px 5px;
  border-style: solid;
  border-color: transparent transparent #dc3545;
}

.section-header {
  margin-bottom: 15px;
}

.btn-toggle.clean {
  background: none;
  border: none;
  color: #666;
  font-size: 14px;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: color 0.3s ease;
}

.btn-toggle.clean:hover {
  color: var(--primary-orange);
}

.toggle-icon {
  font-size: 18px;
  line-height: 1;
  transition: transform 0.3s ease;
}

.btn-toggle.clean[aria-expanded="true"] .toggle-icon {
  transform: rotate(45deg);
}

.support-text-container {
  margin-top: 15px;
  padding-left: 15px;
  border-left: 2px solid var(--border-color);
}

.text-editor-container {
  margin-top: 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
  background-color: white;
}

.text-editor {
  min-height: 100px;
  padding: 12px;
  font-size: 14px;
  line-height: 1.6;
}

.text-editor[placeholder]:empty:before {
  content: attr(placeholder);
  color: #999;
  font-style: italic;
}

.text-editor:focus {
  outline: none;
}

.image-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1001;
  max-width: 500px;
  width: 90%;
}

.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.image-dialog-content {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.size-controls {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.size-input {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.question-image-container {
  margin: 15px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.btn-remove-image {
  margin-top: 5px;
}

/* Navbar Mejorado */
.navbar {
  background-color: var(--primary-orange);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: padding 0.3s ease;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.5rem;
  font-weight: bold;
  transition: transform 0.3s ease;
}

.nav-brand:hover {
  transform: translateY(-2px);
}

.nav-brand i {
  font-size: 1.8rem;
}

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

.nav-links a {
  color: white;
  font-size: 1.3rem;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.3s ease;
  position: relative;
}

.nav-links a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: white;
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.nav-links a:hover::after {
  transform: scaleX(1);
}

.nav-links a:hover {
  transform: translateY(-2px);
  background-color: rgba(255, 255, 255, 0.1);
}

/* Header */
.header {
  text-align: center;
  padding: 3rem 0;
  background: linear-gradient(
    135deg,
    var(--primary-orange) 0%,
    var(--light-orange) 100%
  );
  color: white;
  border-radius: 12px;
  margin-bottom: 2rem;
}

.main-title {
  font-size: 3rem;
  margin-bottom: 1rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
  font-size: 1.2rem;
  opacity: 0.9;
}

/* Tutorial */
.tutorial {
  background-color: white;
  padding: 2rem;
  border-radius: 12px;
  margin-bottom: 2rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.tutorial h2 {
  text-align: center;
  color: var(--primary-orange);
  margin-bottom: 2rem;
}

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

.step {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.step-number {
  background-color: var(--primary-orange);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: bold;
}

.step-content h3 {
  color: var(--primary-orange);
  margin-bottom: 0.5rem;
}

.step-content p {
  color: #666;
  font-size: 0.9rem;
}

/* Footer Mejorado */
.footer {
  background: linear-gradient(to bottom, #2c2c2c, #1a1a1a);
  color: white;
  padding: 4rem 0 2rem;
  margin-top: 4rem;
  position: relative;
  overflow: hidden;
}

.footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(
    to right,
    var(--primary-orange),
    var(--light-orange)
  );
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 3rem;
  padding: 0 2rem;
}

.footer-section {
  padding: 1rem;
  transition: transform 0.3s ease;
}

.footer-section:hover {
  transform: translateY(-5px);
}

.footer-section h3 {
  color: var(--primary-orange);
  margin-bottom: 1.5rem;
  font-size: 1.4rem;
  position: relative;
  padding-bottom: 10px;
}

.footer-section h3::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 50px;
  height: 3px;
  background: var(--primary-orange);
  border-radius: 2px;
}

.social-links {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.social-links a {
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.05);
}

.social-links a i {
  font-size: 1.2rem;
  width: 25px;
}

.social-links a:hover {
  color: var(--primary-orange);
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(5px);
}

.copyright {
  text-align: center;
  opacity: 0.8;
  font-size: 0.9rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Media Queries para Responsividad */
@media (max-width: 768px) {
  .navbar {
    padding: 0.8rem 1rem;
  }

  .nav-brand {
    font-size: 1.2rem;
  }

  .nav-brand i {
    font-size: 1.4rem;
  }

  .nav-links {
    gap: 15px;
  }

  .nav-links a {
    font-size: 1.1rem;
    padding: 6px 8px;
  }

  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 2rem;
  }

  .footer-section h3::after {
    left: 50%;
    transform: translateX(-50%);
  }

  .social-links {
    align-items: center;
  }

  .social-links a {
    width: 200px;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .navbar {
    flex-direction: column;
    gap: 10px;
    padding: 1rem;
  }

  .nav-links {
    width: 100%;
    justify-content: center;
  }

  .footer {
    padding: 3rem 0 1rem;
  }

  .footer-section {
    padding: 0.5rem;
  }
}

/* Animación para el scroll */
@media (min-width: 769px) {
  .navbar {
    transition: padding 0.3s ease;
  }

  .navbar.scrolled {
    padding: 0.5rem 2rem;
    background-color: rgba(255, 107, 53, 0.95);
    backdrop-filter: blur(10px);
  }
}

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

.tutorial,
.step {
  animation: fadeIn 0.6s ease-out forwards;
}

.step:nth-child(2) {
  animation-delay: 0.2s;
}
.step:nth-child(3) {
  animation-delay: 0.4s;
}
.step:nth-child(4) {
  animation-delay: 0.6s;
}

/* Formulario de error en el footer */
.compact-error-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 15px;
  background: rgba(255, 255, 255, 0.03);
  padding: 15px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-input-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.footer-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 10px 12px;
  color: white;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  width: 100%;
}

.footer-input:focus {
  outline: none;
  border-color: var(--primary-orange);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.2);
}

.footer-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.footer-input option {
  background: #2c2c2c;
  color: white;
  padding: 8px;
}

textarea.footer-input {
  resize: none;
  height: 80px;
  line-height: 1.4;
}

.footer-btn {
  background: var(--primary-orange);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 500;
}

.footer-btn:hover {
  background: var(--hover-orange);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.footer-btn i {
  font-size: 0.9rem;
  transition: transform 0.3s ease;
}

.footer-btn:hover i {
  transform: translateX(3px);
}

/* Ajustes responsivos */
@media (max-width: 768px) {
  .compact-error-form {
    max-width: 100%;
    margin: 15px auto;
  }

  .footer-input-group {
    grid-template-columns: 1fr;
  }
}

/* Media Queries para dispositivos móviles pequeños (iPhone 5 y similares) */
@media (max-width: 640px) {
  /* Ajustes generales */
  .container {
    padding: 1rem;
  }

  /* Header */
  .header {
    padding: 1.5rem 1rem;
  }

  .main-title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  /* Tutorial */
  .tutorial {
    padding: 1rem;
  }

  .tutorial-steps {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .step {
    flex-direction: row;
    align-items: center;
  }

  /* Navbar */
  .navbar {
    padding: 0.8rem;
  }

  .nav-brand {
    font-size: 1rem;
  }

  .nav-brand i {
    font-size: 1.2rem;
  }

  .nav-links {
    gap: 10px;
  }

  .nav-links a {
    font-size: 1.1rem;
    padding: 6px;
  }

  /* Configuración y Preguntas */
  .config-panel,
  .question-container {
    padding: 15px;
    margin-bottom: 15px;
  }

  .format-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .question-header {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }

  .question-type-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .question-controls {
    flex-direction: column;
    gap: 10px;
  }

  .question-controls button {
    width: 100%;
  }

  /* Footer y Formulario de Reporte */
  .footer {
    padding: 2rem 0 1rem;
  }

  .footer-content {
    gap: 2rem;
    padding: 0 1rem;
  }

  .footer-section {
    padding: 0;
  }

  .footer-input-group {
    grid-template-columns: 1fr;
  }

  .compact-error-form {
    padding: 10px;
  }

  .social-links a {
    padding: 8px;
    width: 100%;
  }

  /* Botones y Controles */
  .btn {
    padding: 8px 16px;
    font-size: 0.9rem;
  }

  .add-question-container {
    padding: 10px;
    margin-top: 15px;
  }

  /* Ajustes de texto */
  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.2rem;
  }

  /* Ajustes de espaciado */
  .form-group {
    margin-bottom: 12px;
  }

  .answer-option {
    padding: 8px;
    margin-bottom: 8px;
  }

  /* Preview y Controles */
  .preview-controls {
    flex-direction: column;
    gap: 10px;
  }

  .preview-controls button {
    width: 100%;
  }
}

/* Ajustes específicos para altura pequeña */
@media (max-height: 1136px) {
  .tutorial {
    margin-bottom: 1rem;
  }

  .step {
    padding: 0.5rem 0;
  }

  .step-number {
    width: 30px;
    height: 30px;
    font-size: 1rem;
  }

  .step-content h3 {
    font-size: 1rem;
    margin-bottom: 0.3rem;
  }

  .step-content p {
    font-size: 0.8rem;
  }

  /* Reducir espaciado vertical */
  .form-group,
  .question-container,
  .config-panel {
    margin-bottom: 12px;
  }

  /* Ajustar tamaño de inputs */
  .form-control,
  .footer-input {
    padding: 8px;
    font-size: 0.9rem;
  }

  textarea.footer-input {
    height: 60px;
  }
}

/* Ajustes para prevenir desbordamiento horizontal */
@media (max-width: 320px) {
  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
  }

  .footer-btn {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  .question-type-container select {
    width: 100%;
  }
}
