@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

body {
  font-family: 'Inter', sans-serif;
  background: linear-gradient(135deg, #87CEEB 0%, #4682B4 30%, #1E90FF 70%, #6495ED 100%);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  padding: 20px;
  animation: skyShift 30s ease-in-out infinite;
}

@keyframes skyShift {
  0%, 100% { background: linear-gradient(135deg, #87CEEB 0%, #4682B4 30%, #1E90FF 70%, #6495ED 100%); }
  50% { background: linear-gradient(135deg, #B0E0E6 0%, #5F9EA0 30%, #4169E1 70%, #7B68EE 100%); }
}

/* Animated Cloud Background */
.clouds {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50px;
  opacity: 0.9;
  filter: blur(1px);
}

.cloud:before,
.cloud:after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50px;
}

/* Cloud 1 - Large slow moving */
.cloud1 {
  width: 120px;
  height: 40px;
  top: 15%;
  left: -120px;
  animation: moveCloud 25s linear infinite;
}

.cloud1:before {
  width: 50px;
  height: 50px;
  top: -25px;
  left: 10px;
}

.cloud1:after {
  width: 60px;
  height: 30px;
  top: -15px;
  right: 15px;
}

/* Cloud 2 - Medium speed */
.cloud2 {
  width: 80px;
  height: 30px;
  top: 25%;
  right: -80px;
  animation: moveCloudReverse 18s linear infinite;
  animation-delay: -5s;
}

.cloud2:before {
  width: 40px;
  height: 40px;
  top: -20px;
  left: 15px;
}

.cloud2:after {
  width: 50px;
  height: 25px;
  top: -10px;
  right: 10px;
}

/* Cloud 3 - Large floating */
.cloud3 {
  width: 140px;
  height: 50px;
  top: 60%;
  left: -140px;
  animation: moveCloud 30s linear infinite;
  animation-delay: -10s;
}

.cloud3:before {
  width: 60px;
  height: 60px;
  top: -30px;
  left: 20px;
}

.cloud3:after {
  width: 70px;
  height: 35px;
  top: -20px;
  right: 20px;
}

/* Cloud 4 - Small fast */
.cloud4 {
  width: 60px;
  height: 25px;
  top: 10%;
  right: -60px;
  animation: moveCloudReverse 15s linear infinite;
  animation-delay: -8s;
}

.cloud4:before {
  width: 30px;
  height: 30px;
  top: -15px;
  left: 8px;
}

.cloud4:after {
  width: 35px;
  height: 20px;
  top: -8px;
  right: 8px;
}

/* Cloud 5 - Medium floating */
.cloud5 {
  width: 100px;
  height: 35px;
  top: 45%;
  right: -100px;
  animation: moveCloudReverse 22s linear infinite;
  animation-delay: -15s;
}

.cloud5:before {
  width: 45px;
  height: 45px;
  top: -22px;
  left: 12px;
}

.cloud5:after {
  width: 55px;
  height: 28px;
  top: -12px;
  right: 12px;
}

/* Cloud 6 - Extra large slow */
.cloud6 {
  width: 160px;
  height: 55px;
  top: 75%;
  left: -160px;
  animation: moveCloud 35s linear infinite;
  animation-delay: -20s;
}

.cloud6:before {
  width: 70px;
  height: 70px;
  top: -35px;
  left: 25px;
}

.cloud6:after {
  width: 80px;
  height: 40px;
  top: -25px;
  right: 25px;
}

/* Cloud 7 - Small high */
.cloud7 {
  width: 70px;
  height: 28px;
  top: 5%;
  left: -70px;
  animation: moveCloud 20s linear infinite;
  animation-delay: -12s;
}

.cloud7:before {
  width: 35px;
  height: 35px;
  top: -18px;
  left: 10px;
}

.cloud7:after {
  width: 40px;
  height: 22px;
  top: -10px;
  right: 10px;
}

/* Cloud 8 - Medium mid */
.cloud8 {
  width: 90px;
  height: 32px;
  top: 35%;
  left: -90px;
  animation: moveCloud 28s linear infinite;
  animation-delay: -25s;
}

.cloud8:before {
  width: 42px;
  height: 42px;
  top: -21px;
  left: 14px;
}

.cloud8:after {
  width: 48px;
  height: 26px;
  top: -12px;
  right: 14px;
}

/* Cloud movement animations */
@keyframes moveCloud {
  0% {
    transform: translateX(-200px) translateY(0px);
  }
  50% {
    transform: translateX(50vw) translateY(-10px);
  }
  100% {
    transform: translateX(calc(100vw + 200px)) translateY(5px);
  }
}

@keyframes moveCloudReverse {
  0% {
    transform: translateX(200px) translateY(0px);
  }
  50% {
    transform: translateX(-50vw) translateY(-8px);
  }
  100% {
    transform: translateX(calc(-100vw - 200px)) translateY(3px);
  }
}

/* Main Container */
.container {
  max-width: 100%;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

h1 {
  font-family: "Quicksand", sans-serif;
  text-align: center;
  color: white;
  font-size: 4rem;
  font-weight: 700;
  margin-bottom: 40px;
  text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  letter-spacing: -0.02em;
  animation: titleFloat 6s ease-in-out infinite;
}

@keyframes titleFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-5px); }
}

/* Upload Area */
.upload-wrapper {
  margin-bottom: 30px;
}

.upload-area {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border: 2px dashed #74b9ff;
  border-radius: 20px;
  padding: 60px 40px;
  text-align: center;
  position: relative;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  transform: translateY(0);
}

.upload-area:hover {
  transform: translateY(-8px);
  box-shadow: 
    0 30px 60px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset;
  border-color: #0984e3;
  background: rgba(255, 255, 255, 0.98);
}

.upload-area.drag-over {
  border-color: #6c5ce7;
  background: rgba(108, 92, 231, 0.05);
  transform: translateY(-8px) scale(1.02);
}

.upload-icon {
  color: #74b9ff;
  margin-bottom: 20px;
  animation: iconBounce 3s ease-in-out infinite;
}

@keyframes iconBounce {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-3px); }
}

.upload-area h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 8px;
}

.upload-area p {
  color: #718096;
  font-size: 1rem;
  margin-bottom: 4px;
}

.browse-link {
  color: #74b9ff;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.browse-link:hover {
  color: #0984e3;
}

.file-info {
  font-size: 0.875rem;
  color: #a0aec0;
  margin-top: 12px;
}

#imageInput {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  cursor: pointer;
}

/* Caption Button */
.caption-btn {
  width: 100%;
  background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
  color: white;
  border: none;
  border-radius: 16px;
  padding: 18px 24px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 32px rgba(108, 92, 231, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 30px;
}

.caption-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(108, 92, 231, 0.4);
}

.caption-btn:active {
  transform: translateY(0);
}

.caption-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-icon {
  font-size: 1.2rem;
  animation: sparkle 2s infinite;
}

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

/* Caption Area */
.caption-area {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.caption-area h2 {
  color: #2d3748;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 16px;
}

#output {
  font-family: 'Quicksand', sans-serif;
  color: white;
  line-height: 1.6;
  font-size: 2rem;
  min-height: 60px;
  width: 50%;
  padding: 1px;
  background: rgba(247, 250, 252, 0.8);
}

/* Loading State */
.loading #output {
  position: relative;
  color: #74b9ff;
}

.loading #output:after {
  content: '';
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: 2px solid #e2e8f0;
  border-top: 2px solid #74b9ff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: translateY(-50%) rotate(0deg); }
  100% { transform: translateY(-50%) rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
  body {
    padding: 15px;
  }
  
  h1 {
    font-size: 2.5rem;
    margin-bottom: 30px;
  }
  
  .upload-area {
    padding: 40px 20px;
  }
  
  .upload-area h3 {
    font-size: 1.25rem;
  }
  
  .caption-btn {
    padding: 16px 20px;
    font-size: 1rem;
  }
  
  .caption-area {
    padding: 25px 20px;
  }
  
  /* Reduce cloud animations on mobile for performance */
  .cloud {
    animation-duration: 40s !important;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 2rem;
  }
  
  .upload-area {
    padding: 30px 15px;
  }
  
  /* Further reduce animations on very small screens */
  .cloud {
    opacity: 0.6;
    animation-duration: 50s !important;
  }
}
