* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f5f5f5;
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

h1 {
  color: #333;
  margin-bottom: 30px;
  text-align: center;
}

/* Main controls */
.main-controls {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 30px;
}

.add-decade-btn {
  background-color: #2196F3;
  color: white;
  padding: 15px 30px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 600;
  transition: background-color 0.3s, transform 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.add-decade-btn:hover {
  background-color: #1976D2;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.start-slideshow-btn {
  background-color: #00BCD4;
  color: white;
  padding: 15px 30px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 600;
  transition: background-color 0.3s, transform 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.start-slideshow-btn:hover {
  background-color: #0097A7;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Sections container */
.decades-container {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.empty-state {
  text-align: center;
  color: #999;
  font-size: 18px;
  padding: 80px 20px;
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Individual section */
.section-item {
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 3px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s, box-shadow 0.3s;
}

.section-item:hover {
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

/* Section header with label and controls */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}

.section-label-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-label {
  font-size: 28px;
  color: #333;
  padding: 8px 12px;
  border-radius: 6px;
  transition: background-color 0.3s;
  min-width: 150px;
}

.section-label.editing {
  background-color: rgba(255, 255, 255, 0.9);
  outline: 2px solid #2196F3;
}

.edit-label-btn {
  background-color: #FF9800;
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s;
}

.edit-label-btn:hover {
  background-color: #F57C00;
}

/* Section controls */
.section-controls {
  display: flex;
  align-items: center;
  gap: 15px;
}

.speed-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #555;
  font-weight: 500;
  background-color: rgba(255, 255, 255, 0.6);
  padding: 6px 12px;
  border-radius: 6px;
}

.speed-input {
  width: 50px;
  padding: 6px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  text-align: center;
  transition: border-color 0.3s;
}

.speed-input:hover {
  border-color: #2196F3;
}

.speed-input:focus {
  outline: none;
  border-color: #2196F3;
}

.speed-unit {
  color: #777;
  font-size: 13px;
}

.remove-section-btn {
  background-color: #f44336;
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s;
}

.remove-section-btn:hover {
  background-color: #da190b;
}

/* Description container */
.description-container {
  margin-bottom: 20px;
  padding: 15px;
  background-color: rgba(255, 255, 255, 0.6);
  border-radius: 8px;
}

.description-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #555;
  margin-bottom: 8px;
}

.section-description {
  width: 100%;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  resize: vertical;
  transition: border-color 0.3s;
  background-color: white;
}

.section-description:focus {
  outline: none;
  border-color: #2196F3;
}

.section-description::placeholder {
  color: #999;
}

/* Upload container */
.upload-container {
  margin-bottom: 20px;
  text-align: center;
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.section-file-input,
.section-audio-input,
.section-bg-input {
  display: none;
}

.file-input-label {
  display: inline-block;
  background-color: #4CAF50;
  color: white;
  padding: 12px 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: background-color 0.3s, transform 0.2s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.file-input-label:hover {
  background-color: #45a049;
  transform: translateY(-2px);
}

.audio-input-label {
  display: inline-block;
  background-color: #FF5722;
  color: white;
  padding: 12px 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: background-color 0.3s, transform 0.2s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.audio-input-label:hover {
  background-color: #E64A19;
  transform: translateY(-2px);
}

.bg-input-label {
  display: inline-block;
  background-color: #9C27B0;
  color: white;
  padding: 12px 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: background-color 0.3s, transform 0.2s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.bg-input-label:hover {
  background-color: #7B1FA2;
  transform: translateY(-2px);
}

/* Audio container */
.section-audio-container {
  margin-bottom: 20px;
  padding: 15px;
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  min-height: 60px;
}

.audio-placeholder {
  text-align: center;
  color: #777;
  padding: 15px;
  font-size: 14px;
}

.audio-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background-color: white;
  border-radius: 6px;
  margin-bottom: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
}

.audio-item:hover {
  transform: translateX(5px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.audio-icon {
  font-size: 24px;
  color: #FF5722;
  font-weight: bold;
}

.audio-name {
  flex: 1;
  color: #333;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-audio-btn {
  background-color: #2196F3;
  color: white;
  padding: 6px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  transition: background-color 0.3s;
}

.play-audio-btn:hover {
  background-color: #1976D2;
}

.remove-audio-btn {
  background-color: #f44336;
  color: white;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s, transform 0.2s;
  font-weight: bold;
}

.remove-audio-btn:hover {
  background-color: #da190b;
  transform: scale(1.1);
}

/* Background images container */
.section-bg-container {
  margin-bottom: 20px;
  padding: 15px;
  background-color: rgba(156, 39, 176, 0.1);
  border-radius: 8px;
  min-height: 60px;
  border: 2px dashed rgba(156, 39, 176, 0.3);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 15px;
}

.bg-placeholder {
  text-align: center;
  color: #777;
  padding: 15px;
  font-size: 14px;
  grid-column: 1 / -1;
}

.bg-image-container {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s, box-shadow 0.3s;
  background-color: #fff;
  aspect-ratio: 1;
}

.bg-image-container:hover {
  transform: translateY(-3px);
  box-shadow: 0 3px 10px rgba(156, 39, 176, 0.3);
}

.bg-image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.remove-bg-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background-color: rgba(156, 39, 176, 0.95);
  color: white;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s, background-color 0.3s;
  font-weight: bold;
}

.bg-image-container:hover .remove-bg-btn {
  opacity: 1;
}

.remove-bg-btn:hover {
  background-color: rgba(156, 39, 176, 1);
  transform: scale(1.1);
}

/* Section gallery */
.section-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  padding: 20px;
  background-color: rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  min-height: 250px;
}

.placeholder {
  grid-column: 1 / -1;
  text-align: center;
  color: #777;
  padding: 40px;
  font-size: 16px;
}

/* Image containers */
.image-container {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s, box-shadow 0.3s;
  background-color: #fff;
  aspect-ratio: 1;
}

.image-container:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

.image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-container .remove-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: rgba(244, 67, 54, 0.95);
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s, background-color 0.3s;
  font-weight: bold;
}

.image-container:hover .remove-btn {
  opacity: 1;
}

.image-container .remove-btn:hover {
  background-color: rgba(244, 67, 54, 1);
  transform: scale(1.1);
}

/* Slideshow Modal */
.slideshow-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.95);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.slideshow-container {
  width: 90%;
  max-width: 1200px;
  height: 95vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* Slideshow background photos */
.slideshow-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.4;
  filter: blur(3px);
}

.bg-photo {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.8s ease-in-out;
}

.bg-photo.active {
  opacity: 1;
}

.bg-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.slideshow-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  border: 2px solid white;
  border-radius: 50%;
  font-size: 32px;
  cursor: pointer;
  transition: all 0.3s;
  z-index: 1002;
  line-height: 1;
  padding: 5px;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slideshow-close:hover {
  background-color: #ff4444;
  transform: scale(1.1);
}

.slideshow-toggle-controls {
  position: fixed;
  top: 70px;
  left: 0;
  background-color: rgba(0, 0, 0, 0.3);
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0 6px 6px 0;
  border-left: none;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  transition: all 0.3s;
  z-index: 1002;
  opacity: 0.6;
}

.slideshow-toggle-controls:hover {
  background-color: rgba(33, 150, 243, 0.7);
  color: white;
  opacity: 1;
  border-color: rgba(255, 255, 255, 0.6);
}

.slideshow-toggle-caption {
  position: fixed;
  top: 70px;
  right: 0;
  background-color: rgba(0, 0, 0, 0.3);
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px 0 0 6px;
  border-right: none;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  transition: all 0.3s;
  z-index: 1002;
  opacity: 0.6;
}

.slideshow-toggle-caption:hover {
  background-color: rgba(76, 175, 80, 0.7);
  color: white;
  opacity: 1;
  border-color: rgba(255, 255, 255, 0.6);
}

.slideshow-content {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-height: 0;
  padding: 60px 20px 10px 20px;
  transition: padding 0.3s;
  position: relative;
  z-index: 1;
}

.slideshow-content.controls-hidden {
  padding: 60px 20px 20px 20px;
}

.slideshow-image-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
  transition: all 0.5s ease;
  max-width: calc(100% - 340px);
}

.slideshow-content:has(.slideshow-info.caption-hidden) .slideshow-image-container {
  max-width: 100%;
}

.slideshow-image-container img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.slideshow-info {
  text-align: left;
  color: white;
  padding: 20px;
  background-color: rgba(0, 0, 0, 0.7);
  border-radius: 8px;
  min-width: 280px;
  max-width: 320px;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  transition: opacity 0.3s, transform 0.3s, min-width 0.3s, max-width 0.3s, padding 0.3s;
  flex-shrink: 0;
  overflow: hidden;
}

.slideshow-info.caption-hidden {
  opacity: 0;
  transform: translateX(20px);
  pointer-events: none;
  min-width: 0;
  max-width: 0;
  padding: 0;
}

.slideshow-info h2 {
  margin: 0 0 10px 0;
  font-size: 24px;
  color: #fff;
}

.slideshow-info p {
  margin: 0;
  font-size: 16px;
  color: #ddd;
}

.slideshow-description {
  margin-top: 12px;
  font-size: 15px;
  color: #E0E0E0;
  font-style: italic;
  line-height: 1.5;
  max-width: 600px;
}

.slideshow-music-info {
  margin-top: 8px;
  font-style: italic;
  color: #FFD54F;
}

/* Caption stays visible when controls are hidden, unless explicitly hidden by caption toggle */

.slideshow-controls-wrapper {
  transition: all 0.3s;
  flex-shrink: 0;
  overflow: hidden;
  max-height: 500px;
  position: relative;
  z-index: 1;
}

.slideshow-controls-wrapper.hidden {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  padding: 0;
}

.slideshow-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  padding: 12px 20px;
  flex-shrink: 0;
  transition: padding 0.3s;
}

.slideshow-controls-wrapper.hidden .slideshow-controls {
  padding: 0;
}

.slideshow-nav-btn,
.slideshow-play-btn {
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid white;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: background-color 0.3s, transform 0.2s;
}

.slideshow-nav-btn:hover,
.slideshow-play-btn:hover {
  background-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
}

.slideshow-play-btn {
  background-color: #2196F3;
  border-color: #2196F3;
  min-width: 100px;
}

.slideshow-play-btn:hover {
  background-color: #1976D2;
  border-color: #1976D2;
}

.slideshow-music-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background-color: rgba(0, 0, 0, 0.5);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
  transition: padding 0.3s;
}

.slideshow-controls-wrapper.hidden .slideshow-music-controls {
  padding: 0;
}

.slideshow-music-btn {
  background-color: rgba(255, 152, 0, 0.8);
  color: white;
  border: 2px solid #FF9800;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background-color 0.3s, transform 0.2s;
}

.slideshow-music-btn:hover:not(:disabled) {
  background-color: rgba(255, 152, 0, 1);
  transform: translateY(-2px);
}

.slideshow-music-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.slideshow-volume-control {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
}

.slideshow-volume-control label {
  color: white;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.slideshow-volume-control input[type="range"] {
  width: 120px;
  cursor: pointer;
}

.slideshow-volume-control span {
  color: white;
  font-size: 13px;
  min-width: 40px;
  text-align: right;
}

.slideshow-section-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  padding: 12px 20px;
  background-color: rgba(0, 0, 0, 0.4);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
  transition: padding 0.3s;
}

.slideshow-controls-wrapper.hidden .slideshow-section-controls {
  padding: 0;
}

.slideshow-section-btn {
  background-color: rgba(76, 175, 80, 0.8);
  color: white;
  border: 2px solid #4CAF50;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: background-color 0.3s, transform 0.2s;
}

.slideshow-section-btn:hover:not(:disabled) {
  background-color: rgba(76, 175, 80, 1);
  transform: translateY(-2px);
}

.slideshow-section-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-controls {
    width: 100%;
    justify-content: space-between;
  }

  .section-gallery {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
  }

  .slideshow-content {
    flex-direction: column;
  }

  .slideshow-image-container {
    max-width: 100%;
    width: 100%;
  }

  .slideshow-info {
    width: 100%;
    max-width: 100%;
    align-self: auto;
  }

  .slideshow-toggle-controls {
    top: 65px;
    left: 0;
  }

  .slideshow-toggle-caption {
    top: 95px;
    right: 0;
  }

  .slideshow-controls,
  .slideshow-music-controls,
  .slideshow-section-controls {
    flex-direction: column;
    gap: 10px;
  }

  .slideshow-nav-btn,
  .slideshow-play-btn,
  .slideshow-music-btn,
  .slideshow-section-btn {
    width: 200px;
  }

  .slideshow-volume-control {
    flex-direction: row;
    width: auto;
  }

  .slideshow-info h2 {
    font-size: 20px;
  }

  .slideshow-info p {
    font-size: 14px;
  }
}
