/* style.css */

body {
  min-height: 100vh;
  margin: 0;
  font-family: 'Roboto', Arial, sans-serif;
  color: #222;
  background: linear-gradient(120deg, #e3f0ff 0%, #f9f9f9 100%);
  background-size: 400% 400%;
  animation: gradientMove 30s linear infinite;
}

@keyframes gradientMove {
  0% {
    background-position: 0% 50%;
    background: linear-gradient(120deg, #e3f0ff 0%, #f9f9f9 100%, #c3eaff 100%);
  }

  25% {
    background-position: 50% 100%;
    background: linear-gradient(120deg, #c3eaff 0%, #f9f9f9 60%, #e3f0ff 100%);
  }

  50% {
    background-position: 100% 50%;
    background: linear-gradient(120deg, #f9f9f9 0%, #b3e0ff 60%, #e3f0ff 100%);
  }

  75% {
    background-position: 50% 0%;
    background: linear-gradient(120deg, #e3f0ff 0%, #c3eaff 60%, #f9f9f9 100%);
  }

  100% {
    background-position: 0% 50%;
    background: linear-gradient(120deg, #e3f0ff 0%, #f9f9f9 100%, #c3eaff 100%);
  }
}

h1 {
  margin-bottom: 10px;
}

/* 🔵 Highlighting Progress Bar */
#progress-bar-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background-color: #ddd;
  z-index: 999;
}

#progress-bar {
  height: 100%;
  width: 0%;
  background-color: #0077ff;
  transition: width 0.3s ease-in-out;
}

/* 🖼️ Image Grid */
#image-grid {
  margin-top: 50px;
  margin-bottom: 30px;
  width: 90%;
  max-width: 90%;
  margin-left: auto;
  margin-right: auto;
}

.image-row {
  display: flex;
  flex-direction: row;
  justify-content: center;
  /* Center images horizontally */
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: nowrap;
  width: 90%;
  max-width: 90%;
  overflow-x: auto;
  overflow-y: visible;
  overflow: visible;
  padding-bottom: 8px;
  margin-left: auto;
  margin-right: auto;
}

/* 🟩 Positive and 🟥 Negative Training Images */
.thumb {
  width: calc(30vw - 40px);
  /* responsive: 3 images per row max */
  max-width: 220px;
  min-width: 120px;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  flex: 1 1 auto;
  transition: transform 0.10s cubic-bezier(.4, 2, .2, 1);
  z-index: 1;
  position: relative;
}

.thumb:hover {
  transform: scale(1.5);
  z-index: 10;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.train-positive {
  border: 3px solid #4caf50;
  /* Green border */
  background-color: #e8f5e9;
  /* Light green bg */
}

.train-negative {
  border: 3px solid #f44336;
  /* Red border */
  background-color: #ffebee;
  /* Light red bg */
}

/* ✨ Test image interaction */
.thumb,
.selectable-image {
  transition: transform 0.07s cubic-bezier(.4, .2, .2, 1), box-shadow 0.01s cubic-bezier(.4, .2, .2, 1);
  z-index: 1;
  position: relative;

  /* border: 3px solid transparent;
  cursor: pointer;
  transition: border 0.2s ease, transform 0.2s ease; */
}

.selectable-image:hover {
  transform: scale(1.5);
  z-index: 10;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.selected {
  border: 3px solid #0077ff;
  box-shadow: 0 0 10px #0077ff;
}

/* 🔘 Button styling */
button {
  padding: 10px 20px;
  font-size: 16px;
  background-color: #0077ff;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  margin: 10px;
}

button:hover {
  background-color: #005ecc;
}

/* 📝 Final result display */
#result {
  display: none;
}

/* Result Table Wrapper */
.result-table-wrapper {
  width: 100%;
  max-width: 900px;
  margin: 32px auto 24px auto;
  overflow-x: auto;
  background: none;
  border-radius: 8px;
  /* Ensure the wrapper does not exceed the viewport */
  box-sizing: border-box;
}

/* Result Table Styling */
.result-table {
  width: 100%;
  min-width: 600px;
  max-width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 1em;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
  border-radius: 8px;
  overflow: hidden;
  margin: 0;
  table-layout: auto;
  /* Prevent table from exceeding its container */
  box-sizing: border-box;
  display: block;
  overflow-x: auto;
}

.result-table th,
.result-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #e0e0e0;
  text-align: center;
}

.result-table th {
  background: #e3f2fd;
  color: #1565c0;
  font-weight: bold;
}

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

.result-table tr:hover {
  background: #f1f8ff;
}

.result-table td.correct {
  color: #388e3c;
  font-weight: bold;
}

.result-table td.incorrect {
  color: #d32f2f;
  font-weight: bold;
}

#principle-title {
  position: fixed;
  top: 24px;
  left: 32px;
  font-size: 2em;
  font-weight: bold;
  color: #1976d2;
  letter-spacing: 0.03em;
  text-shadow: 0 2px 12px #e3f2fd;
  text-align: left;
  font-family: 'Montserrat', Arial, sans-serif;
  background: rgba(255, 255, 255, 0.85);
  padding: 8px 24px;
  border-radius: 8px;
  z-index: 1000;
  margin-bottom: 0;
}

#lang-select,
.lang-select-container {
  position: relative;
  z-index: 1000;
  background: #fff;
}

.training-title {
  margin-top: 150px;
  text-align: center;
  width: 100%;
}

.test-title {
  margin-top: 50;
  text-align: center;
  width: 100%;
}



.result-btn-row,
.center-btn-row {
  display: flex;
  flex-direction: row;
  gap: 24px;
  justify-content: center;
  align-items: center;
  width: 100%;
}

/* .center-btn-row {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 24px;
} */




.lang-btn {
  background: none;
  border: none;
  outline: none;
  color: #0077ff;
  font-family: 'Montserrat', Arial, sans-serif;
  font-weight: 700;
  font-size: 1em;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.2s;
}

.lang-btn.active,
.lang-btn:hover {
  color: #ff9800;
  text-decoration: underline;
}

.lang-sep {
  color: #888;
  padding: 0 2px;
  user-select: none;
}

.lang-select-container {
  min-width: 180px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 4px 12px;
  border-radius: 8px;
  background: transparent;
  box-shadow: 0 2px 8px #b3c6e344;
}


#result-title {
  font-size: 2em;
  font-weight: bold;
  color: #1976d2;
  margin-bottom: 32px;
  /* More space below the title */
  margin-top: 32px;
  /* More space above the title */
  text-align: left;
}

.result-performance {
  font-size: 1.3em;
  color: #388e3c;
  /* Use a different color for performance */
  margin-bottom: 24px;
  margin-top: 24px;
  font-weight: 600;
}

.fixed-btn {
  position: fixed;
  bottom: 32px;
  right: 32px;
  padding: 16px 36px;
  font-size: 1.2em;
  border-radius: 8px;
  z-index: 2000;
}


@media (max-width: 700px) {

  body,
  .intro-container,
  .citation-container,
  #principle-title,
  .image-row,
  .center-btn-row,
  #result,
  .result-table {
    max-width: 100vw !important;
    padding: 0 4vw !important;
    font-size: 1em !important;
    box-sizing: border-box;
  }

  #principle-title {
    font-size: 1.1em !important;
    padding: 0 6px !important;
  }

  .image-row {
    flex-direction: column !important;
    align-items: center !important;
    gap: 12px !important;
  }

  .thumb,
  .static-image,
  .selectable-image {
    max-width: 90vw !important;
    height: auto !important;
  }

  /* .center-btn-row,
  .result-btn-row {
    flex-direction: column !important;
    gap: 12px !important;
    width: 100% !important;
  } */

  .result-table th,
  .result-table td {
    font-size: 0.9em !important;
    padding: 4px !important;
  }


  textarea#user-feedback {
    font-size: 1em !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  #lang-select-placeholder {
    position: static !important;
    display: flex;
    justify-content: flex-end;
    width: 100%;
    margin: 12px 0 0 0;
    top: unset !important;
    right: unset !important;
  }

  .intro-title {
    margin-top: 32px;
  }

  /* Feedback container and textarea */
  #result textarea,
  textarea#user-feedback {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }

  #result label[for="user-feedback"] {
    font-size: 1em !important;
    padding-left: 2px;
    padding-right: 2px;
    word-break: break-word;
  }

  #result div[style*="max-width: 480px"] {
    max-width: 98vw !important;
    min-width: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
  }

  .hardness-btn {
    padding: 12px 0 !important;
    font-size: 1.1em !important;
    width: 48vw !important;
    min-width: 120px;
    max-width: 90vw;
    margin: 0 2vw;
    box-sizing: border-box;
    text-align: center;
    align-items: center !important;
    justify-content: center !important;
  }

  #hardness-feedback>div[style*="gap"] {
    flex-direction: column !important;
    gap: 12px !important;
    width: 100%;
    align-items: center !important;
    /* Center items horizontally */
    justify-content: center !important;
    /* Center items vertically if needed */
  }

  .result-btn-row,
  .center-btn-row {
    flex-direction: column !important;
    gap: 12px !important;
    width: 100% !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .result-btn-row button,
  .center-btn-row button,
  #download-results-btn,
  #upload-results-btn,
  #more-tests-btn {
    width: 90vw !important;
    max-width: 320px;
    min-width: 0;
    box-sizing: border-box;
    padding: 14px 0 !important;
    font-size: 1.1em !important;
    margin: 0 auto !important;
    display: block !important;
    text-align: center;
  }
    /* Force flex column for any flex row with gap: 24px (matches your resultSummary div) */
  #result div[style*="display: flex"][style*="gap: 24px"] {
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    width: 100% !important;
  }
    .citation-container {
    max-width: 98vw !important;
    width: 100% !important;
    margin: 24px auto 0 auto !important;
    padding: 12px 4vw !important;
    box-sizing: border-box !important;
    border-radius: 10px;
    background: #f5f7fa;
    font-size: 0.7em;
    word-break: break-word;
  }
  #citation-title {
    font-size: 1em !important;
    margin-bottom: 8px !important;
    text-align: left !important;
  }
  #citation-authors {
    font-size: 0.8em !important;
    margin-bottom: 8px !important;
    text-align: left !important;
    word-break: break-word;
  }
  #citation-bib {
    font-size: 0.7em !important;
    padding: 8px 0 !important;
    background: #f0f4ff;
    border-radius: 6px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
  }

}