/* General layout styling */
.content-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 30px;
}

.image-container {
  width: 500px;
  height: 1000px;
  max-width: 500px;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  background-color: #e9ecef;
}

#image {
  width: 100%;
  height: auto;
  display: block;
}

/* LQ Fade Effect */
.lq-fade::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50px;
  background: linear-gradient(transparent, white);
  z-index: 5;
  pointer-events: none;
}

.controls-container {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

/* Slider styling */
.slider-wrapper {
  position: relative;
  width: 100%;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 25px;
  height: 20px;
  position: relative;
}

.slider-day-label {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
}

#slider {
  height: 12px;
  background: #ddd !important;
  border: none !important;
  border-radius: 6px;
}

#slider .ui-slider-handle {
  position: absolute !important;
  width: 24px !important;
  height: 24px !important;
  background: #ff8c00 !important;
  border: 3px solid white !important;
  border-radius: 50% !important;
  top: -7px !important;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Navigation Controls */
.nav-btn {
  background: #ff8c00;
  color: white;
  border: none;
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  border-radius: 5px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  line-height: 1;
}

.nav-unit {
  width: 40px;
}

.nav-label {
  font-size: 0.7rem;
  color: #888;
  margin-top: 2px;
  text-align: center;
  width: 100%;
}

.input-unit {
  margin-top: -2px;
}

#time-input {
  font-weight: bold;
  font-size: 1.1rem;
  padding: 6px 30px 6px 8px;
  /* Extra right padding for custom toggle */
  height: 38px;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: #fff;
}

/* Hide native browser calendar icon aggressively */
#time-input::-webkit-calendar-picker-indicator {
  display: none !important;
  -webkit-appearance: none;
  opacity: 0;
  width: 0;
  height: 0;
}

.picker-container {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.picker-toggle {
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
  border-radius: 50%;
  transition: all 0.2s;
  padding: 0;
  line-height: 1;
}

.icon-calendar {
  display: block;
}

.icon-close {
  display: none;
}

/* Active State (Red X) */
.picker-toggle.active {
  background: #ff4444;
  color: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.picker-toggle.active .icon-calendar {
  display: none;
}

.picker-toggle.active .icon-close {
  display: block;
  font-size: 20px;
  margin-top: -1px;
  /* Optical alignment for X */
}

.picker-toggle:active {
  transform: scale(0.9);
}

#download-mp4 {
  background-color: #007bff;
  border-color: #007bff;
}

#download-mp4:hover {
  background-color: #0056b3;
  border-color: #004085;
}

#download-7z {
  background-color: #6c757d;
  border-color: #6c757d;
}

#download-7z:hover {
  background-color: #5a6268;
  border-color: #4e555b;
}

.download-section a {
  text-decoration: none;
  font-weight: 500;
  color: white;
}

#image-download-link {
  display: block;
  cursor: zoom-in;
}

#image-download-link img {
  transition: opacity 0.2s;
}

#image-download-link:hover img {
  opacity: 0.95;
}

/* Archive Heatmap */
.heatmap-section {
  width: 100%;
  transition: all 0.3s ease;
}

#archive-heatmap {
  background: #ffffff;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.heatmap-header {
  display: flex;
  margin-bottom: 6px;
  padding-left: 45px;
  justify-content: center;
  width: 100%;
}

.month-label {
  width: 31px;
  margin-right: 4px;
  text-align: center;
  font-size: 9px;
  color: #94a3b8;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.heatmap-year-row {
  display: flex;
  align-items: flex-end;
  margin-bottom: 10px;
  justify-content: center;
  width: 100%;
}

.year-label {
  width: 45px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  line-height: 1;
  padding-bottom: 1px;
}

.heatmap-months {
  display: flex;
  gap: 4px;
}

.month-block {
  width: 31px;
  height: 18px;
  background: #f1f5f9;
  position: relative;
  cursor: pointer;
  border-radius: 1.5px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.month-block:hover {
  transform: translateY(-2px);
  background: #e2e8f0;
  z-index: 10;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.day-bar {
  width: 1px;
  position: absolute;
  bottom: 0;
  border-radius: 0.5px;
}

/* Color Palette */
.day-bar.c-90 {
  background-color: #14b8a6;
}

.day-bar.c-80 {
  background-color: #0d9488;
}

.day-bar.c-70 {
  background-color: #64748b;
}

.day-bar.c-60 {
  background-color: #475569;
}

.day-bar.c-low {
  background-color: #b91c1c;
}

/* Mobile Visibility (Heatmap) */
#archive-heatmap-container {
  display: block;
}

@media (max-width: 991.98px) {
  .heatmap-section {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    overflow: hidden;
    height: 0;
    opacity: 0;
  }

  .heatmap-section.heatmap-open {
    height: auto;
    opacity: 1;
    margin-top: 15px !important;
    padding-top: 15px !important;
    border-top: 1px solid #e2e8f0 !important;
  }

  #archive-heatmap-container {
    display: none;
  }

  #archive-heatmap-container.visible {
    display: flex;
    justify-content: center;
  }

  #archive-heatmap {
    padding: 8px;
    overflow-x: auto;
    align-items: flex-start;
  }
}

/* Compact Mobile UX */
@media (max-width: 575.98px) {
  .container {
    padding-left: 4px !important;
    padding-right: 4px !important;
  }

  .content-container {
    gap: 10px;
    width: 100% !important;
    padding: 0 !important;
  }

  #image {
    max-width: 100% !important;
    height: auto;
  }

  .slider-wrapper {
    margin-bottom: 0.5rem !important;
    padding: 0 !important;
    width: 100% !important;
    box-sizing: border-box;
  }

  #slider {
    margin-left: 10px;
    margin-right: 10px;
  }
}

/* Mobile ordering (Controls top) */
@media (max-width: 1100px) {
  .content-container {
    flex-direction: column-reverse;
    align-items: center;
  }

  .controls-container {
    width: 100% !important;
    max-width: 100% !important;
  }
}

.reset-link-wrapper a {
  text-decoration: none;
  transition: color 0.2s;
}

.reset-link-wrapper a:hover {
  color: #4A5568 !important;
  text-decoration: underline;
}

#heatmap-toggle-btn {
  border-radius: 4px;
  font-weight: 500;
  transition: all 0.2s;
}

/* Landing Page Grid */
.landing-card {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
  background: white;
  border: 1px solid #e2e8f0;
}

.landing-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1) !important;
}

.card-thumb-container {
  width: 100%;
  height: 500px;
  overflow: hidden;
  background-color: #f8fafc;
}

.card-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: opacity 0.3s ease;
}

.landing-card:hover .card-thumb-img {
  opacity: 0.9;
}

.text-slate {
  color: #334155;
}

.landing-hero h1 {
  letter-spacing: -0.02em;
}

@media (max-width: 767.98px) {
  .card-thumb-container {
    height: 400px;
    /* Slightly shorter on mobile to fit screen better */
  }
}


/* Legacy Mode Overrides */
.legacy-hide {
  display: none !important;
}


/* Heatmap Refinements */
.month-block.selected-month {
  border: 2px solid #0dcaf0;
  /* Cyan highlight */
  box-sizing: border-box;
}

.month-block.disabled {
  opacity: 0.3;
  pointer-events: none;
  cursor: default;
}


/* Revised Heatmap Styles */
.month-block.selected-month {
  border: 3px solid #dc3545 !important;
  /* Red contrast */
  z-index: 10;
  position: relative;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

/* Ensure legacy-hide is NOT forced via CSS if we want JS control, 
   but previously I added it via append. I should remove that block. 
   Since I cannot easily remove with basic logic without regex multiline, 
   I will just overwrite it with a benign rule */
.legacy-hide {
  /* controlled by JS */
}


/* Phase 21 Fixes */
.legacy-hide {
  /* Let JS handle visibility to avoid persistent hiding in valid ranges */
  display: initial;
  /* or allow flex/block from parent */
}

/* Heatmap High Visibility */
.month-block.selected-month {
  border: 3px solid #dc3545 !important;
  /* Red */
  z-index: 10;
  position: relative;
  box-shadow: 0 0 0 1px #fff;
  /* outline contrast */
}
/* Phase 21 Round 2 Fixes */

/* Remove legacy-hide override - let JS handle it completely */
.legacy-hide {
  /* Removed display override to allow flexbox participation */
}

/* Enhanced border visibility for selected month */
.month-block.selected-month {
  border: 4px solid #ff0000 !important; /* Bright red, thicker */
  background-color: rgba(220, 53, 69, 0.15) !important; /* Semi-transparent red background */
  z-index: 10;
  position: relative;
  box-shadow: 0 0 0 2px #fff, 0 0 10px rgba(220, 53, 69, 0.5); /* Double border effect + glow */
}


/* Fix for hour/minute button visibility */
/* Default: buttons are visible (flex to participate in layout) */
body:not(.legacy-mode) .legacy-hide {
  display: flex !important;
}

/* Only hide when explicitly in legacy mode */
body.legacy-mode .legacy-hide {
  display: none !important;
}

