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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(-45deg, #ffe6ec, #ffcce6, #ffddee, #fff4f8);
  background-size: 300% 300%;
  animation: gradientBG 8s ease infinite;
  min-height: 100vh;
  overflow-x: hidden;
}

@keyframes gradientBG {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

h1, h2, h3 {
  text-align: center;
  margin: 1rem 0;
  color: #b00f4c;
}

p {
  line-height: 1.5em;
}

/* Inline audio element styling */
audio#bgMusic {
  display: block;
  margin: 10px auto;
  width: 80%;
}

/* Container for the input form */
.slideshow-setup {
  max-width: 800px;
  margin: 2rem auto;
  background: rgba(255,255,255,0.7);
  border-radius: 8px;
  box-shadow: 0 0 8px rgba(0,0,0,0.2);
  padding: 20px;
  backdrop-filter: blur(4px);
}

label {
  display: block;
  margin: 0.8rem 0 0.3rem;
  font-weight: 600;
  color: #7c2f41;
}

input[type="text"],
textarea {
  width: 100%;
  padding: 10px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  margin-bottom: 0.8rem;
  transition: border-color 0.2s;
}

input[type="text"]:focus,
textarea:focus {
  border-color: #b00f4c;
  outline: none;
}

.slide-config {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 1rem;
  margin: 1rem 0;
  /* New pop in animation */
  animation: popIn 0.5s ease;
  position: relative;
}

.slide-config h4 {
  margin-bottom: 0.5rem;
  color: #b00f4c;
}

/* New Remove Button for slide config */
.remove-slide-btn {
  background: #ff4d4d;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  padding: 5px 10px;
  font-size: 0.9rem;
  position: absolute;
  top: 10px;
  right: 10px;
  transition: background 0.2s;
}

.remove-slide-btn:hover {
  background: #cc0000;
}

/* New Duplicate Button */
.duplicate-slide-btn {
  display: inline-block;
  background: #4CAF50;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  padding: 10px 20px;
  font-size: 1rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  transition: background 0.2s;
  margin-right: 5px;
}

.duplicate-slide-btn:hover {
  background: #388E3C;
}

.add-slide-btn, .generate-btn {
  display: inline-block;
  background: #d4145a;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  padding: 10px 20px;
  font-size: 1rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  transition: background 0.2s;
}

.add-slide-btn:hover, .generate-btn:hover {
  background: #b00f4c;
}

/* New Reset Button */
.reset-btn {
  display: inline-block;
  background: #666;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  padding: 10px 20px;
  font-size: 1rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  transition: background 0.2s;
  margin-left: 10px;
}

.reset-btn:hover {
  background: #444;
}

/* New Bulk Convert Button */
.bulk-convert-btn {
  display: inline-block;
  background: #d4145a;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  padding: 10px 20px;
  font-size: 1rem;
  margin-top: 0.5rem;
  margin-bottom: 0.8rem;
  transition: background 0.2s;
}

.bulk-convert-btn:hover {
  background: #b00f4c;
}

/* Slideshow Container (hidden until generated) */
.slideshow-container {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #111;
  z-index: 9999;
}

.slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  justify-content: center;
  align-items: center;
  color: #fff;
  text-align: center;
  padding: 2rem;
  box-sizing: border-box;
  transition: opacity 1s ease, transform 0.6s ease;
}

.slide img {
  max-width: 60vw;
  max-height: 60vh;
  margin-bottom: 1rem;
  border: 2px solid #fff;
  border-radius: 8px;
}

.slide .slide-text {
  font-size: 1.3rem;
  margin-top: 1rem;
  line-height: 1.5em;
  color: #ffffff;
  text-shadow: 1px 1px 2px #ff69b4;
}

/* Updated slide transitions with a subtle zoom effect */
.slide.fade-in {
  animation: fadeIn 1.5s forwards;
}

.slide.fade-out {
  animation: fadeOut 1.5s forwards;
}

@keyframes fadeIn {
  0% { opacity: 0; transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes fadeOut {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.05); }
}

/* New keyframe for slide config pop-in animation */
@keyframes popIn {
  0% { opacity: 0; transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1); }
}

.heart-animation {
  pointer-events: none;
  position: absolute;
  top: -10px;
  color: #ff2f7b;
  opacity: 0.8;
  font-size: 24px;
  animation-name: heartFall;
  animation-timing-function: linear;
  animation-iteration-count: 1;
}

@keyframes heartFall {
  0% { transform: translateY(-100vh) rotate(0deg); }
  100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}

.slideshow-controls {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 10001;
  display: flex;
  gap: 10px;
  padding: 10px;
  background: rgba(0,0,0,0.3);
  border-radius: 30px;
  backdrop-filter: blur(5px);
}

.back-btn, .stop-btn, .next-btn, .fullscreen-btn {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.back-btn:hover, .stop-btn:hover, .next-btn:hover, .fullscreen-btn:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.1);
}

.back-btn:active, .stop-btn:active, .next-btn:active, .fullscreen-btn:active {
  transform: scale(0.95);
}

.stop-btn {
  background: rgba(212, 20, 90, 0.5);
}

.stop-btn:hover {
  background: rgba(212, 20, 90, 0.7);
}

#confetti-wrapper {
  pointer-events: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: none;
  z-index: 10002;
}

.confetti-piece {
  position: absolute;
  width: 12px;
  height: 12px;
  opacity: 0.9;
  animation-timing-function: linear;
}

/* For drag and drop feedback */
.slide-config.drag-over {
  border: 2px dashed #b00f4c;
}

/* Enhanced Slide Preview */
.slide-preview {
  margin: 15px 0;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.preview-header {
  background: #f5f5f5;
  padding: 8px;
  font-size: 0.9rem;
  color: #666;
  border-bottom: 1px solid #ddd;
}

.preview-content {
  padding: 15px;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: background-color 0.3s;
}

.preview-text {
  text-align: center;
  transition: all 0.3s;
}

.preview-image {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 50px;
}

.preview-image img {
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Font Selection */
.font-select {
  width: 100%;
  padding: 8px;
  margin-bottom: 15px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
}

.font-select option {
  padding: 8px;
}

/* Updated button styles */
.duplicate-slide-btn, .remove-slide-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.duplicate-slide-btn {
  background: #4CAF50;
  color: white;
}

.duplicate-slide-btn:hover {
  background: #388E3C;
}

.remove-slide-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 8px;
  background: #ff4d4d;
  color: white;
  border-radius: 50%;
  width: 32px;
  height: 32px;
}

.remove-slide-btn:hover {
  background: #cc0000;
  transform: scale(1.1);
}

/* Slide thumbnails navigation */
.slide-thumbnails {
  display: flex;
  gap: 10px;
  padding: 10px;
  overflow-x: auto;
  background: rgba(255,255,255,0.9);
  border-radius: 8px;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  transition: all 0.3s ease;
  max-width: 80vw;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 20, 90, 0.5) rgba(255,255,255,0.1);
}

/* Thumbnails scrollbar styling */
.slide-thumbnails::-webkit-scrollbar {
  height: 6px;
}

.slide-thumbnails::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
}

.slide-thumbnails::-webkit-scrollbar-thumb {
  background-color: rgba(212, 20, 90, 0.5);
  border-radius: 3px;
}

/* Collapsed state */
.slide-thumbnails.collapsed {
  transform: translateX(-50%) translateY(calc(100% - 30px));
}

/* Toggle button for thumbnails */
.thumbnails-toggle {
  position: absolute;
  top: -25px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.9);
  border: none;
  border-radius: 15px 15px 0 0;
  padding: 5px 20px;
  cursor: pointer;
  color: #666;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
}

.thumbnails-toggle:hover {
  color: #d4145a;
}

/* Navigation arrows for thumbnails */
.thumbnails-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.95);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #d4145a;
  z-index: 1;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.thumbnails-nav:hover {
  color: #fff;
  background: #d4145a;
  transform: translateY(-50%) scale(1.1);
}

.thumbnails-nav.prev {
  left: -16px;
}

.thumbnails-nav.next {
  right: -16px;
}

/* Update slide thumbnails */
.slide-thumbnail {
  min-width: 100px;
  height: 75px;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.slide-thumbnail:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.slide-thumbnail.active {
  border: 2px solid #d4145a;
  transform: translateY(-2px);
}

.slide-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slide-thumbnail div {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.5);
  color: white;
  padding: 2px;
  font-size: 12px;
  text-align: center;
}

/* Update fullscreen styles */
.slideshow-container:fullscreen {
  background: #000;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slideshow-container:fullscreen .slide {
  max-width: 95vw;
  max-height: 95vh;
}

.slideshow-container:fullscreen .slide-thumbnails {
  bottom: 20px;
  background: rgba(255,255,255,0.95);
}

/* Progress indicator */
#slideProgress {
  position: fixed;
  top: 20px;
  left: 20px;
  background: rgba(0,0,0,0.5);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  z-index: 10000;
}

/* Timer overlay */
#slideTimer {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(0,0,0,0.5);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  z-index: 10000;
}

/* Global Settings */
.global-settings {
  background: rgba(255,255,255,0.8);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
  margin-top: 10px;
}

.setting-item {
  padding: 10px;
  background: white;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.setting-item input[type="number"] {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
}

.setting-item label {
  margin-bottom: 5px;
  color: #666;
}

/* Section Headers */
.bulk-input-section,
.manual-slides-section {
  background: rgba(255,255,255,0.8);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
}

h3 {
  color: #d4145a;
  font-size: 1.2rem;
  margin-bottom: 15px;
  border-bottom: 2px solid #ffd1dc;
  padding-bottom: 5px;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: center;
}

.action-buttons button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 1.1rem;
  border-radius: 8px;
  transition: all 0.3s;
}

.action-buttons button i {
  font-size: 1.2rem;
}

/* Updated Slide Container */
.slide {
  width: var(--slide-width, 100%);
  height: var(--slide-height, 100%);
  max-width: 95vw;
  max-height: 95vh;
  margin: auto;
  position: relative;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  overflow: hidden;
}

.slide-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  padding: 10px;
  max-height: 60%;
  overflow-y: auto;
}

.slide-image-container {
  position: relative;
  padding-top: 75%; /* 4:3 Aspect Ratio */
}

.slide-image-container img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

/* Image Upload Area */
.image-upload-area {
  border: 2px dashed #ccc;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  margin: 10px 0;
  background: #f9f9f9;
  cursor: pointer;
  transition: all 0.3s;
}

.image-upload-area:hover {
  border-color: #d4145a;
  background: #fff;
}

.image-upload-area i {
  font-size: 2rem;
  color: #666;
  margin-bottom: 10px;
}

.image-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.image-preview-item {
  position: relative;
  padding-top: 100%;
}

.image-preview-item img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.image-preview-item .remove-image {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff4d4d;
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.image-preview-item .remove-image:hover {
  transform: scale(1.1);
  background: #cc0000;
}

/* Image Filters */
.filter-warm {
  filter: sepia(0.3) brightness(1.1) saturate(1.5);
}

.filter-soft {
  filter: brightness(1.1) contrast(0.9) saturate(0.9) blur(0.3px);
}

.filter-vintage {
  filter: sepia(0.4) brightness(0.9) contrast(1.1) saturate(0.8);
}

.filter-dramatic {
  filter: contrast(1.3) brightness(0.9) saturate(1.4);
}

.filter-grayscale {
  filter: grayscale(1) contrast(1.1);
}

/* Enhanced falling animations */
.falling-animation {
  pointer-events: none;
  position: absolute;
  top: -10px;
  opacity: 0.8;
  font-size: 24px;
  animation-name: fall;
  animation-timing-function: linear;
  animation-iteration-count: 1;
  z-index: 10000;
  /* Ensure falling animations are not affected by filters */
  filter: none !important;
  mix-blend-mode: normal;
}

@keyframes fall {
  0% {
    transform: translateY(-100vh) rotate(0deg) scale(1);
    opacity: 0.8;
  }
  50% {
    transform: translateY(50vh) rotate(180deg) scale(1.2);
    opacity: 0.9;
  }
  100% {
    transform: translateY(100vh) rotate(360deg) scale(1);
    opacity: 0;
  }
}

/* Gradient Presets */
.gradient-romantic {
  background: linear-gradient(45deg, #ff9a9e 0%, #fad0c4 99%, #fad0c4 100%);
}

.gradient-sunset {
  background: linear-gradient(to right, #ff758c 0%, #ff7eb3 100%);
}

.gradient-sweet {
  background: linear-gradient(120deg, #f6d365 0%, #fda085 100%);
}

.gradient-passion {
  background: linear-gradient(to right, #ff0844 0%, #ffb199 100%);
}

/* Bokeh Effect */
.bokeh-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: screen;
}

.bokeh {
  position: absolute;
  border-radius: 50%;
  animation: float 8s infinite;
  opacity: 0.7;
  filter: blur(3px);
  background: radial-gradient(circle at 50% 50%, 
    rgba(255,255,255,0.9) 0%,
    rgba(255,192,203,0.6) 40%,
    rgba(255,255,255,0) 70%
  );
  box-shadow: 0 0 20px rgba(255,255,255,0.8);
}

@keyframes float {
  0%, 100% {
    transform: translateY(0) translateX(0) scale(1);
  }
  25% {
    transform: translateY(-30px) translateX(20px) scale(1.2);
  }
  50% {
    transform: translateY(0) translateX(40px) scale(1);
  }
  75% {
    transform: translateY(30px) translateX(20px) scale(1.2);
  }
}

/* Sparkle Effect */
.sparkle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: white;
  border-radius: 50%;
  pointer-events: none;
  animation: sparklefall 3s linear forwards;
  z-index: 2;
  opacity: 0.8;
  box-shadow: 
    0 0 5px #fff,
    0 0 10px #fff,
    0 0 15px #ffcce6,
    0 0 20px #ff99cc;
}

@keyframes sparklefall {
  0% {
    transform: translateY(-100vh) rotate(0deg) scale(1);
    opacity: 0.8;
  }
  50% {
    transform: translateY(50vh) rotate(360deg) scale(1.5);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg) scale(1);
    opacity: 0;
  }
}

/* Light Rays Effect */
.light-rays {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 60%);
  pointer-events: none;
  mix-blend-mode: overlay;
  z-index: 1;
  animation: pulse 4s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.3;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.1);
  }
}

/* Sparkle Cursor */
body.sparkle-cursor {
  cursor: none;
}

.sparkle-cursor .custom-cursor {
  width: 20px;
  height: 20px;
  position: fixed;
  pointer-events: none;
  z-index: 10000;
  mix-blend-mode: difference;
  animation: sparkle 1s infinite;
}

@keyframes sparkle {
  0%, 100% {
    transform: scale(1) rotate(0deg);
  }
  50% {
    transform: scale(1.2) rotate(180deg);
  }
}

/* Font size input styling */
input[type="number"] {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  transition: all 0.2s ease;
}

input[type="number"]:focus {
  border-color: #d4145a;
  box-shadow: 0 0 5px rgba(212, 20, 90, 0.3);
  outline: none;
}

/* Preview text size adjustments */
.preview-text {
  font-size: calc(1vw * var(--font-multiplier, 6));
  transition: font-size 0.2s ease;
  color: #ffffff;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.slide-text {
  font-size: calc(1vw * var(--font-multiplier, 6));
  transition: font-size 0.2s ease;
  color: #ffffff;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
} 