/*
 * Photo2Form - Main Upload Page Styles
 * Specific styles for the index.html upload/processing page
 */

/* Override body for index page */
body.index-page {
  background: #ffffff;
  padding: var(--spacing-2xl) var(--spacing-lg);
}

/* Main form container */
.upload-form {
  max-width: 900px;
  margin: var(--spacing-lg) auto;
  background: #ffffff;
  padding: 20px;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color-light);
}

/* ===============================================
   PROGRESSIVE STEP SYSTEM - Modern UI
   =============================================== */

/* Step container - clean, minimal design */
.step-section {
  padding: 20px;
  background: #ffffff;  /* Clean white background */
  border: none;  /* No border by default - only shown when active */
  border-radius: 8px;
  margin-bottom: 20px;
  transition: all 0.3s ease;
  opacity: 1;
}

/* Step is locked/disabled (not yet accessible) */
.step-section.locked {
  display: none;  /* Completely hidden until unlocked */
}

/* Step is hidden (slides up smoothly) */
.step-section.hidden {
  display: none;
}

/* Step is active (currently being worked on) */
.step-section.active {
  border: 2px solid var(--primary-color);
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1);
}

/* Optional steps (4 & 5) use light blue when active */
#step4.active,
#step5.active {
  border: 2px solid #64B5F6;
  box-shadow: 0 0 0 2px rgba(100, 181, 246, 0.15);
  background: #fafeff;
}

#step4.active h3,
#step5.active h3 {
  color: #1976D2;
}

/* Step is completed */
.step-section.completed {
  border: 1px solid var(--success-color);
  background: #f9fff9;  /* Subtle green tint */
}

/* Step headers - clean typography */
.step-section h3 {
  margin-top: 0;
  font-size: 18px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-section.locked h3 {
  color: var(--text-disabled);
}

.step-section.active h3 {
  color: var(--primary-color);
}

.step-section.completed h3 {
  color: var(--success-color);
}

/* Step descriptions */
.step-description {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 15px;
  line-height: 1.5;
}

/* Step completion badge */
.step-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.step-badge.required {
  background: #fff3e0;
  color: #e65100;
}

.step-badge.optional {
  background: #e3f2fd;
  color: #1565c0;
}

.step-badge.completed {
  background: #e8f5e9;
  color: #2e7d32;
}

/* Locked step overlay message */
.step-locked-message {
  display: none;
  padding: 12px;
  background: #f5f5f5;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 10px;
}

.step-section.locked .step-locked-message {
  display: block;
}

/* Show step-content when step is unlocked, hide when locked */
.step-section .step-content {
  display: block;
}

.step-section.locked .step-content {
  display: none;
}

/* Smooth expand/collapse animations */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step-section.unlocking {
  animation: slideDown 0.4s ease-out;
}

/* Section dividers within steps */
.step-subsection {
  margin: 20px 0;
}

.step-subsection h4 {
  font-size: 14px;
  margin: 15px 0 10px 0;
  color: var(--text-primary);
  font-weight: 600;
}

/* ===============================================
   FILE UPLOAD SECTION
   =============================================== */

.file-upload-section {
  margin-bottom: var(--spacing-xl);
}

.file-input-wrapper {
  position: relative;
  margin: var(--spacing-md) 0;
}

.file-input-label {
  display: inline-block;
  padding: 12px 24px;
  background: var(--primary-color);
  color: white;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition-base);
}

.file-input-label:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

input[type="file"] {
  display: block;
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid var(--border-color-light);
  border-radius: var(--border-radius-sm);
  background: var(--bg-container);
  font-size: var(--font-size-base);
  cursor: pointer;
}

input[type="file"]:disabled {
  background: #f5f5f5;
  cursor: not-allowed;
  opacity: 0.6;
}

.file-name-display {
  display: inline-block;
  margin-left: var(--spacing-md);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-style: italic;
}

/* ===============================================
   PREVIEW IMAGE
   =============================================== */

#preview {
  max-width: 100%;
  max-height: 400px;
  margin: var(--spacing-lg) auto;
  display: block;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
}

/* ===============================================
   PROCESSING STATUS
   =============================================== */

#statusDiv {
  margin: var(--spacing-lg) 0;
  padding: var(--spacing-md);
  background: var(--bg-section);
  border-radius: var(--border-radius);
  border-left: 4px solid var(--primary-color);
}

#progressBar {
  width: 100%;
  height: 24px;
  background: var(--bg-container);
  border-radius: 12px;
  overflow: hidden;
  margin: var(--spacing-sm) 0;
}

#progressBarFill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
  transition: width 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: var(--font-size-sm);
}

/* ===============================================
   SETTINGS GRID
   =============================================== */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-md);
  margin: var(--spacing-md) 0;
}

.setting-item {
  display: flex;
  flex-direction: column;
}

/* ===============================================
   RANGE INPUTS WITH VALUES
   =============================================== */

.range-container {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.range-container input[type="range"] {
  flex: 1;
}

.range-value {
  min-width: 60px;
  text-align: right;
  font-weight: 600;
  color: var(--primary-color);
  font-family: var(--font-family-mono);
}

/* ===============================================
   CHECKBOX GROUPS
   =============================================== */

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin: var(--spacing-sm) 0;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.checkbox-item input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.checkbox-item label {
  margin: 0;
  font-weight: normal;
  cursor: pointer;
}

/* ===============================================
   HELP TEXT
   =============================================== */

.help-text {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-top: var(--spacing-xs);
  line-height: var(--line-height-base);
}

/* ===============================================
   COLLAPSIBLE SECTIONS
   =============================================== */

details {
  margin: var(--spacing-md) 0;
  padding: var(--spacing-md);
  background: #fafafa;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color-light);
}

details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-primary);
  user-select: none;
  padding: var(--spacing-sm);
  margin: calc(var(--spacing-sm) * -1);
  border-radius: var(--border-radius-sm);
}

details summary:hover {
  background: var(--bg-hover);
}

details[open] summary {
  margin-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--border-color-light);
}

/* ===============================================
   SUBMIT BUTTON
   =============================================== */

.submit-section {
  margin-top: var(--spacing-xl);
  text-align: center;
  padding-top: var(--spacing-lg);
  border-top: 2px solid var(--border-color-light);
}

.submit-btn {
  padding: 16px 48px;
  font-size: var(--font-size-lg);
  background: var(--success-color);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition-base);
  box-shadow: var(--shadow-md);
}

.submit-btn:hover:not(:disabled) {
  background: var(--success-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.submit-btn:disabled {
  background: var(--bg-disabled);
  color: var(--text-disabled);
  cursor: not-allowed;
  box-shadow: none;
}

/* ===============================================
   LINKS SECTION
   =============================================== */

.links-section {
  text-align: center;
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--border-color-light);
}

.links-section a {
  margin: 0 var(--spacing-md);
  font-size: var(--font-size-sm);
}

/* ===============================================
   RESPONSIVE ADJUSTMENTS
   =============================================== */

@media (max-width: 768px) {
  body.index-page {
    padding: var(--spacing-lg) var(--spacing-sm);
  }

  .upload-form {
    padding: var(--spacing-lg);
  }

  h1 {
    font-size: 2rem;
  }

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

  .submit-btn {
    width: 100%;
    padding: 14px 24px;
  }

  .links-section a {
    display: block;
    margin: var(--spacing-sm) 0;
  }

  .step-section {
    padding: 15px;
  }
}

/* Responsive layout for preview controls */
@media (max-width: 1200px) {
  /* Stack preview images and controls vertically on smaller screens */
  #heightmapPreview > div[style*="grid-template-columns: 1fr 400px"] {
    grid-template-columns: 1fr !important;
  }

  #controlsSidebar {
    max-height: none !important;
  }
}
