/* Shared styles extracted from fdm.html */
body {
  margin: 0;
  padding: 10px;
  font-family: sans-serif;
  background-color: #f5f5f5;
  min-height: 100vh;
  box-sizing: border-box;
}
.header {
  text-align: center;
  margin-bottom: 20px;
}
.header h1 {
  margin: 0;
  color: #333;
  font-size: clamp(1.5rem, 4vw, 2rem);
}
.header p {
  margin: 5px 0;
  color: #666;
  font-size: clamp(0.8rem, 2.5vw, 1rem);
}
.header a {
  word-break: break-word;
}
.instructions {
  text-align: center;
  margin-bottom: 20px;
  color: #666;
  font-size: clamp(0.9rem, 2.5vw, 1rem);
  padding: 0 10px;
}
#image-container {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.canvas-wrapper {
  text-align: center;
  flex: 1;
  min-width: 200px;
  max-width: 300px;
}
.canvas-wrapper h3 {
  margin: 0 0 10px 0;
  color: #333;
  font-size: clamp(0.9rem, 3vw, 1.1rem);
}
canvas {
  width: 100%;
  max-width: 300px;
  height: auto;
  object-fit: contain;
  border: 2px solid #333;
  box-sizing: border-box;
  cursor: pointer;
  background-color: white;
  touch-action: manipulation;
}
canvas:hover {
  border-color: #666;
}
.controls {
  text-align: center;
  margin-top: 20px;
  padding: 0 10px;
}
#match-button {
  padding: 12px 24px;
  font-size: clamp(1rem, 3vw, 1.1rem);
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  min-height: 44px;
  touch-action: manipulation;
}
#match-button:hover {
  background-color: #0056b3;
}
#match-button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}
#time {
  margin-top: 10px;
  color: #666;
  font-size: clamp(0.8rem, 2.5vw, 1rem);
}

/* Mobile-specific styles */
@media (max-width: 768px) {
  body {
    padding: 5px;
  }
  #image-container {
    flex-direction: column;
    gap: 15px;
  }
  .canvas-wrapper {
    width: 100%;
    max-width: 90vw;
  }
  canvas {
    max-width: 90vw;
  }
  .header {
    margin-bottom: 15px;
  }
  .instructions {
    margin-bottom: 15px;
    font-size: 0.9rem;
  }
  #match-button {
    width: 90%;
    max-width: 300px;
  }
}

/* Very small screens */
@media (max-width: 480px) {
  .header h1 {
    font-size: 1.3rem;
  }
  .header p {
    font-size: 0.8rem;
  }
  .canvas-wrapper h3 {
    font-size: 1rem;
  }
  #image-container {
    gap: 10px;
  }
}

/* Legacy styles for backward compatibility */
#form {
  width: 300px;
  margin: 10px;
}

#video {
  position: absolute;
}

#canvas-webcam {
  border: 1px dashed black;
  vertical-align: center;
  width: 640px;
  height: auto;
  left: 0px;
  top: 0px;
  max-width: none;
  cursor: default;
}

#canvas-perlin {
  border: 1px solid black;
}

#canvas-container {
  position: relative;
  display: inline-block;
}

#canvas-seam{
  border: 1px solid black;
  max-width: 90vw;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

#seam-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* Button styles - unified across all examples (excluding copy buttons) */
button:not(.copy-button), #toggle-button, #align-button, #remove-button, #webcamToggleButton, #toggleButton {
  padding: 12px 24px;
  font-size: clamp(1rem, 3vw, 1.1rem);
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  min-height: 44px;
  touch-action: manipulation;
  margin: 5px;
}

button:not(.copy-button):hover, #toggle-button:hover, #align-button:hover, #remove-button:hover, #webcamToggleButton:hover, #toggleButton:hover {
  background-color: #0056b3;
}

button:not(.copy-button):disabled, #toggle-button:disabled, #align-button:disabled, #remove-button:disabled, #webcamToggleButton:disabled, #toggleButton:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

#toggle-button {
  margin: 20px;
}

input {
  font-size: 20px;
  width: 150px;
}

/* Do not force width on checkboxes/radios */
input[type="checkbox"],
input[type="radio"] {
  width: auto;
}

#validation-message {
  color: #bf616a;
}

#color {
  width: 158px;
}

/* Examples index page styles */
.examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.example-card {
  background: white;
  border: 2px solid #333;
  border-radius: 8px;
  padding: 20px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.example-card:hover {
  border-color: #666;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  transform: translateY(-2px);
}

.example-card h3 {
  margin: 0 0 10px 0;
  color: #333;
  font-size: 1.2rem;
}

.example-card h3 a {
  color: #333;
  text-decoration: none;
}

.example-card h3 a:hover {
  color: #007bff;
}

.example-card p {
  margin: 0;
  color: #666;
  line-height: 1.4;
  font-size: 0.95rem;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .examples-grid {
    grid-template-columns: 1fr;
    gap: 15px;
    padding: 15px;
  }

  .example-card {
    padding: 15px;
  }
}
