/* ============================================
   Tema 8: Rectas y Ángulos Study App — 📐
   Principal=#3498db  Geometría=#8e44ad
   Correct=#27ae60    Incorrect=#e74c3c
   ============================================ */

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

body {
  font-family: 'Segoe UI', 'Arial Rounded MT Bold', Arial, sans-serif;
  background: linear-gradient(135deg, #eaf6ff 0%, #fff 50%, #f3e8ff 100%);
  color: #222;
  min-height: 100vh;
  padding: 16px;
  font-size: 18px;
  line-height: 1.5;
}

/* ---- Views ---- */
.view {
  display: none;
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}
.view.active {
  display: block;
}

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

/* ---- Typography ---- */
h1 {
  font-size: 2.2rem;
  text-align: center;
  color: #2c3e50;
  margin-bottom: 8px;
}
h2 {
  font-size: 1.6rem;
  text-align: center;
  color: #2c3e50;
  margin-bottom: 16px;
}
h3 {
  font-size: 1.25rem;
  margin: 20px 0 8px;
  padding-bottom: 4px;
  color: #2c3e50;
}
.subtitle {
  text-align: center;
  font-size: 1.15rem;
  color: #555;
  margin-bottom: 24px;
}

/* ---- Main Menu Grid ---- */
.menu-grid {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
}
.menu-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 220px;
  padding: 24px 16px;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  color: #fff;
}
.menu-btn:hover,
.menu-btn:focus {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  outline: 3px solid #2c3e50;
}
.menu-btn--guide {
  background: linear-gradient(135deg, #3498db, #5dade2);
}
.menu-btn--practice {
  background: linear-gradient(135deg, #8e44ad, #a569bd);
}
.menu-emoji { font-size: 2.5rem; }
.menu-title { font-size: 1.2rem; font-weight: 700; }

/* ---- Exercise Menu Grid ---- */
.exercise-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 8px;
}
.exercise-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 16px;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  color: #fff;
  background: linear-gradient(135deg, #8e44ad, #a569bd);
}
.exercise-btn:hover,
.exercise-btn:focus {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  outline: 3px solid #2c3e50;
}

/* Alternate colors for exercise buttons */
.exercise-btn:nth-child(1) {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
}
.exercise-btn:nth-child(2) {
  background: linear-gradient(135deg, #f39c12, #f1c40f);
}
.exercise-btn:nth-child(3) {
  background: linear-gradient(135deg, #3498db, #5dade2);
}
.exercise-btn:nth-child(4) {
  background: linear-gradient(135deg, #e74c3c, #ec7063);
}
.exercise-btn:nth-child(5) {
  background: linear-gradient(135deg, #1abc9c, #48c9b0);
}
.exercise-btn:nth-child(6) {
  background: linear-gradient(135deg, #e67e22, #f39c12);
}
.exercise-btn:nth-child(7) {
  background: linear-gradient(135deg, #8e44ad, #a569bd);
}

/* ---- Back Button ---- */
.btn-back {
  display: inline-block;
  padding: 8px 16px;
  font-size: 1rem;
  font-family: inherit;
  border: 2px solid #3498db;
  border-radius: 10px;
  background: transparent;
  color: #3498db;
  cursor: pointer;
  margin-bottom: 12px;
  transition: background 0.15s, color 0.15s;
}
.btn-back:hover,
.btn-back:focus {
  background: #3498db;
  color: #fff;
  outline: none;
}

/* ---- Guide Sections ---- */
.guide-section {
  margin-bottom: 24px;
}
.guide-content {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}
.guide-intro {
  font-size: 1.1rem;
  color: #444;
  margin-bottom: 20px;
  padding: 16px;
  background: #eaf4fc;
  border-radius: 12px;
  border-left: 5px solid #3498db;
}

/* Guide concept cards */
.guide-concept {
  margin-bottom: 20px;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 12px;
  border-left: 5px solid #8e44ad;
}
.guide-concept:nth-child(even) {
  border-left-color: #3498db;
}
.guide-concept h4 {
  font-size: 1.15rem;
  color: #2c3e50;
  margin-bottom: 8px;
}
.guide-concept p {
  font-size: 1.05rem;
  color: #444;
  margin-bottom: 12px;
}

/* ---- SVG Diagram Containers ---- */
.diagram-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 16px 0;
  padding: 16px;
  background: #fff;
  border-radius: 12px;
  border: 2px solid #eee;
  min-height: 180px;
}
.diagram-container svg {
  max-width: 100%;
  height: auto;
}

/* Guide diagram containers (smaller, inline) */
.guide-diagram {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 12px 0;
  padding: 12px;
  background: #fafbfc;
  border-radius: 10px;
  border: 1px solid #e8e8e8;
}
.guide-diagram svg {
  max-width: 100%;
  height: auto;
}

/* ---- SVG Specific Styles ---- */
svg .line-main {
  stroke: #2c3e50;
  stroke-width: 3;
  stroke-linecap: round;
}
svg .line-secondary {
  stroke: #3498db;
  stroke-width: 2.5;
  stroke-linecap: round;
}
svg .line-dashed {
  stroke: #8e44ad;
  stroke-width: 2;
  stroke-dasharray: 8, 4;
  stroke-linecap: round;
}
svg .line-highlight {
  stroke: #e74c3c;
  stroke-width: 3;
  stroke-linecap: round;
}
svg .arc {
  fill: none;
  stroke: #27ae60;
  stroke-width: 2.5;
}
svg .arc-fill {
  fill: rgba(39, 174, 96, 0.15);
  stroke: #27ae60;
  stroke-width: 2;
}
svg .point {
  fill: #2c3e50;
}
svg .label {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  fill: #2c3e50;
}
svg .label-small {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 12px;
  fill: #555;
}
svg .label-degrees {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
  fill: #27ae60;
}
svg .right-angle {
  fill: none;
  stroke: #e74c3c;
  stroke-width: 2;
}
svg .axis-symmetry {
  stroke: #e74c3c;
  stroke-width: 2;
  stroke-dasharray: 6, 3;
}
svg .figure-original {
  fill: rgba(52, 152, 219, 0.2);
  stroke: #3498db;
  stroke-width: 2.5;
}
svg .figure-transformed {
  fill: rgba(142, 68, 173, 0.2);
  stroke: #8e44ad;
  stroke-width: 2.5;
}
svg .arrow {
  fill: #e67e22;
  stroke: #e67e22;
  stroke-width: 2;
}
svg .transportador-bg {
  fill: rgba(241, 196, 15, 0.1);
  stroke: #bbb;
  stroke-width: 1.5;
}
svg .transportador-tick {
  stroke: #888;
  stroke-width: 1;
}
svg .transportador-tick-major {
  stroke: #444;
  stroke-width: 1.5;
}

/* ---- Score Display ---- */
.score-display {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
  color: #3498db;
  background: #eaf4fc;
  border-radius: 10px;
  padding: 8px 16px;
  margin-bottom: 16px;
}

/* ---- Exercise Area ---- */
.exercise-area {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

/* ---- Exercise Instruction ---- */
.exercise-instruction {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 16px;
}

/* ---- Completion Message ---- */
.completion-message {
  text-align: center;
  font-size: 1.3rem;
  padding: 24px;
  color: #27ae60;
}

/* ---- Form Inputs ---- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}
.form-group label {
  font-size: 0.95rem;
  font-weight: 600;
  color: #444;
}
.form-input {
  padding: 10px 14px;
  font-size: 1.1rem;
  font-family: inherit;
  border: 2px solid #ccc;
  border-radius: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
  max-width: 200px;
}
.form-input:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52,152,219,0.15);
}

/* Correct / Incorrect field states */
.field-correct {
  border-color: #27ae60 !important;
  background: #eafaf1 !important;
}
.field-incorrect {
  border-color: #e74c3c !important;
  background: #fdedec !important;
}

/* ---- Option Buttons ---- */
.options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
/* 5-option layout for clasificar ángulos */
.options-grid--five {
  grid-template-columns: repeat(3, 1fr);
}
.option-btn {
  padding: 14px 18px;
  font-size: 1.15rem;
  font-family: inherit;
  font-weight: 600;
  border: 2px solid #3498db;
  border-radius: 12px;
  background: #fff;
  color: #3498db;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s, border-color 0.15s;
}
.option-btn:hover,
.option-btn:focus {
  background: #eaf4fc;
  transform: translateY(-2px);
  outline: none;
}
.option-btn:disabled {
  cursor: default;
  transform: none;
  opacity: 0.85;
}
.option-btn.option-correct {
  border-color: #27ae60 !important;
  background: #eafaf1 !important;
  color: #27ae60 !important;
}
.option-btn.option-incorrect {
  border-color: #e74c3c !important;
  background: #fdedec !important;
  color: #e74c3c !important;
}

/* ---- Feedback ---- */
.feedback {
  min-height: 24px;
  margin-bottom: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  border-radius: 10px;
  padding: 8px;
}
.feedback-correct {
  color: #27ae60;
  background: #eafaf1;
}
.feedback-incorrect {
  color: #c0392b;
  background: #fdedec;
}

/* ---- Buttons ---- */
.btn-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn-primary {
  padding: 12px 28px;
  font-size: 1.15rem;
  font-family: inherit;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  background: #3498db;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover,
.btn-primary:focus {
  background: #2980b9;
  outline: none;
}
.btn-primary:active {
  transform: scale(0.97);
}
.btn-next {
  padding: 12px 28px;
  font-size: 1.15rem;
  font-family: inherit;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  background: #27ae60;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-next:hover,
.btn-next:focus {
  background: #1e8449;
  outline: none;
}
.btn-next:active {
  transform: scale(0.97);
}

.hidden {
  display: none !important;
}

/* ============================================
   Responsive Design
   ============================================ */

/* Mobile */
@media (max-width: 600px) {
  body {
    padding: 10px;
    font-size: 16px;
  }
  h1 { font-size: 1.7rem; }
  h2 { font-size: 1.3rem; }
  h3 { font-size: 1.1rem; }

  .menu-grid {
    flex-direction: column;
    align-items: center;
  }
  .menu-btn {
    width: 100%;
    max-width: 300px;
  }

  .exercise-grid {
    grid-template-columns: 1fr;
  }

  .guide-content {
    padding: 14px;
  }
  .guide-concept {
    padding: 12px;
  }

  .diagram-container {
    padding: 10px;
    min-height: 140px;
  }

  .exercise-area {
    padding: 16px;
  }

  .options-grid {
    grid-template-columns: 1fr;
  }
  .options-grid--five {
    grid-template-columns: 1fr;
  }

  .option-btn {
    padding: 12px 14px;
    font-size: 1.05rem;
  }

  .form-input {
    max-width: 100%;
  }

  .btn-row {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-primary,
  .btn-next {
    width: 100%;
    text-align: center;
  }

  .guide-section {
    margin-bottom: 16px;
  }
}

/* Tablet */
@media (min-width: 601px) and (max-width: 900px) {
  .menu-btn {
    width: 180px;
  }
  .exercise-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .options-grid--five {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Desktop (large) */
@media (min-width: 901px) {
  .exercise-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
