/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability. 
 *
 *= require photo_viewer
 *= require components/mobile_nav
 */

/* Base Image Comparison Styles */
.image-comparison {
  max-width: 700px;
  margin: 20px auto;
  border-radius: 20px;
  overflow: hidden;
}

.image-comparison img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left;
}

.image-comparison .images-container {
  position: relative;
  display: block; /* Changed from flex to block for single canvas approach */
  background-color: black;
}

/* Canvas styling for composite image */
.image-comparison canvas#composite-image {
  width: 100%;
  height: 100%;
  display: block;
}

/* Hide the before-image since it's now handled in WebGL */
.image-comparison .images-container .before-image {
  display: none;
}

/* Keep after-image styling for backward compatibility */
.image-comparison .after-image {
  width: 100%;
  height: 100%;
}

.image-comparison .slider {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: ew-resize;
  z-index: 20;
}

.image-comparison .slider-line {
  position: absolute;
  height: 100%;
  width: 4px;
  background: #fff;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  z-index: 10;
}

.image-comparison .slider-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 20px;
  color: #fff;
  background-color: white;
  border-radius: 50%;
  transform: translate(-50%, -50%) rotateZ(90deg);
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Fullscreen Overlay Styles */
.overflow-hidden {
  overflow: hidden;
}

/* Fullscreen Container Styles */
[data-photo-settings-target="fullScreenOverlay"] {
  z-index: 9999;
  background-color: rgba(0, 0, 0, 0.9);
}

[data-photo-settings-target="fullScreenContainer"] {
  display: flex;
  justify-content: center;
  align-items: center;
}

[data-photo-settings-target="fullScreenContainer"] .images-container {
  position: relative;
  display: block; /* Changed from flex to block */
  max-height: 85vh;
  margin: 0 auto;
  background-color: black;
  border-radius: 12px;
  overflow: hidden;
}

/* Fullscreen Image Styles */
[data-photo-settings-target="fullScreenContainer"] .after-image,
[data-photo-settings-target="fullScreenContainer"] canvas#composite-image-fullscreen {
  max-height: 85vh;
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* Hide before image in fullscreen mode since it's handled in WebGL */
[data-photo-settings-target="fullScreenContainer"] .before-image {
  display: none;
}

/* Fullscreen Slider Styles */
[data-photo-settings-target="fullScreenContainer"] .slider {
  position: absolute;
  width: 100%;
  height: 100%;
  inset: 0;
  z-index: 20;
  opacity: 0;
  cursor: ew-resize;
}

[data-photo-settings-target="fullScreenContainer"] .slider-line {
  position: absolute;
  height: 100%;
  width: 4px;
  background-color: white;
  left: 50%;
  top: 0;
  z-index: 10;
}

[data-photo-settings-target="fullScreenContainer"] .slider-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 20px;
  background-color: white;
  border-radius: 50%;
  color: black;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%) rotateZ(90deg);
}

/* Canvas dimensions for fullscreen */
[data-photo-settings-target="fullScreenContainer"] canvas.after-image,
[data-photo-settings-target="fullScreenContainer"] canvas#composite-image,
[data-photo-settings-target="fullScreenContainer"] canvas#composite-image-fullscreen {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Fullscreen Close Button */
[data-photo-settings-target="fullScreenOverlay"] button {
  color: white;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

[data-photo-settings-target="fullScreenOverlay"] button:hover {
  opacity: 1;
}

/* Improve full screen button appearance */
[data-photo-settings-target="fullScreenButton"] {
  position: relative;
  z-index: 10;
  margin-bottom: 10px;
  width: auto;
  padding: 8px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Container for the fullscreen button */
.image-comparison .mt-4 {
  margin-top: 1rem;
  width: 100%;
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 5;
}

.flash-message {
  position: fixed;
  top: 1rem;
  right: 1rem;
  padding: 1rem;
  border-radius: 0.5rem;
  z-index: 50;
}

.flash-message.success {
  background-color: #def7ec;
  color: #03543f;
}

@keyframes fade-in-down {
  0% {
    opacity: 0;
    transform: translateY(-10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in-down {
  animation: fade-in-down 0.5s ease-out;
}

/* ===================== */
/* Temperature Slider UI */
/* ===================== */
.temperature-slider {
  /* Remove default background if any */
  background: transparent !important;
  /* For Safari, Chrome, Edge (Webkit) */
}
.temperature-slider::-webkit-slider-runnable-track {
  height: 0.5rem;
  border-radius: 0.5rem;
  background: linear-gradient(to right, #2196f3 0%, #fff 50%, #ffeb3b 100%);
}
.temperature-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: #666;
  border: 2px solid #fff;
  box-shadow: 0 0 2px rgba(0,0,0,0.2);
  cursor: pointer;
  margin-top: -0.375rem; /* Center thumb on track */
}
.temperature-slider:focus::-webkit-slider-thumb {
  outline: 2px solid #2196f3;
  outline-offset: 2px;
}

/* For Firefox */
.temperature-slider::-moz-range-track {
  height: 0.5rem;
  border-radius: 0.5rem;
  background: linear-gradient(to right, #2196f3 0%, #fff 50%, #ffeb3b 100%);
}
.temperature-slider::-moz-range-thumb {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: #666;
  border: 2px solid #fff;
  box-shadow: 0 0 2px rgba(0,0,0,0.2);
  cursor: pointer;
}
.temperature-slider:focus::-moz-range-thumb {
  outline: 2px solid #2196f3;
  outline-offset: 2px;
}

/* For IE/Edge */
.temperature-slider::-ms-fill-lower {
  background: #2196f3;
  border-radius: 0.5rem 0 0 0.5rem;
}
.temperature-slider::-ms-fill-upper {
  background: #ffeb3b;
  border-radius: 0 0.5rem 0.5rem 0;
}
.temperature-slider::-ms-thumb {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: #666;
  border: 2px solid #fff;
  box-shadow: 0 0 2px rgba(0,0,0,0.2);
  cursor: pointer;
}
.temperature-slider:focus::-ms-thumb {
  outline: 2px solid #2196f3;
  outline-offset: 2px;
}
.temperature-slider::-ms-tooltip {
  display: none;
}

/* Remove outline for all browsers except on focus */
.temperature-slider:focus {
  outline: none;
}

/* Hide the outline for the range input itself */
.temperature-slider::-webkit-input-placeholder { color: transparent; }
.temperature-slider::-moz-placeholder { color: transparent; }
.temperature-slider:-ms-input-placeholder { color: transparent; }
.temperature-slider::placeholder { color: transparent; }
