/* =============================================
   AI PAGE HEADER
   ============================================= */
.ai-header {
  text-align: center;
  padding: 100px 24px 20px;
  background: linear-gradient(180deg, #f8fafc 0%, transparent 100%);
}

body.dark-mode .ai-header {
  background: linear-gradient(180deg, #0a0a0a 0%, transparent 100%);
}

.ai-title {
  font-family: 'MuseoModerno', sans-serif;
  font-size: 36px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 12px 0;
}

body.dark-mode .ai-title {
  color: #f1f5f9;
}

.ai-title span {
  color: #55bcc9;
}

.ai-subtitle {
  font-size: 16px;
  color: #64748b;
  margin: 0 auto;
  max-width: 500px;
}

body.dark-mode .ai-subtitle {
  color: #94a3b8;
}

@media (max-width: 768px) {
  .ai-header {
    padding: 24px 16px 16px;
  }
  
  .ai-title {
    font-size: 28px;
  }
  
  .ai-subtitle {
    font-size: 14px;
  }
}

/* =============================================
   AI CONTAINER & CONTENT
   ============================================= */
.ai-text {
  background-color: #000000;
  color: white;
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  margin-top: 100px;
  padding: 10px;
}
.ai-container {
  max-width: 900px;
  margin: 0 auto 28px;
  padding: 20px;
  text-align: center;
}
.ai-description {
  font-size: 16px;
  color: #666;
  margin-bottom: 40px;
  line-height: 1.6;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
.prompt-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-bottom: 40px;
  position: relative;
}
.prompt-input {
  width: 100%;
  max-width: 600px;
  min-height: 50px;
  padding: 15px 20px;
  border: 2px solid #eee;
  border-radius: 12px;
  font-size: 16px;
  transition: all 0.3s ease;
  resize: none;
  overflow-y: hidden; /* Hide vertical scrollbar */
  line-height: 1.5;
  display: block; /* Ensures proper sizing */
}
.prompt-input:focus {
  border-color: #55bcc9;
  outline: none;
  box-shadow: 0 0 10px rgba(85, 188, 201, 0.2);
}
.generate-btn {
  background-color: #000;
  color: white;
  padding: 12px 30px;
  border: none;
  border-radius: 25px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
}
.generate-btn:hover {
  background-color: #55bcc9;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.result-container {
  margin-top: 40px;
}
.generated-image {
  max-width: 100%;
  border-radius: 12px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}
.generated-image:hover {
  transform: scale(1.02);
}
.loading-spinner {
  display: none;
  margin: 20px auto;
}
/* Loading animation */
.loading-dots {
  display: none;
  font-size: 24px;
  letter-spacing: 2px;
  animation: loadingDots 1.5s infinite;
}
@keyframes loadingDots {
  0%,
  20% {
    content: ".";
  }
  40% {
    content: "..";
  }
  60% {
    content: "...";
  }
  80%,
  100% {
    content: "";
  }
}
.input-rounded {
  padding: 10px;
  border: 2px solid #ccc;
  border-radius: 25px;
  width: 100%;
  max-width: 400px;
  margin-bottom: 10px;
}

.button-rounded {
  padding: 10px 20px;
  border: none;
  border-radius: 25px;
  background-color: #000000;
  color: white;
  cursor: pointer;
  transition: background-color 0.3s;
}

.button-rounded:hover {
  background-color: #55bcc9;
}
.image-gallery {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.download-button {
  position: absolute;
  bottom: 10px; /* Adjust this to position the button at the bottom of the image */
  right: 10px; /* Adjust this to position the button at the right of the image */
  background-color: #000000;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 15px;
  cursor: pointer;
  font-size: 14px;
  z-index: 10;
  margin-bottom: 15px;
}

.download-button:hover {
  background-color: #55bcc9;
}
.image-container {
  position: relative;
  display: inline-block;
}
.loading-overlay {
  position: fixed;
  inset: 0; /* shorthand for top/left/width/height */
  display: none; /* Hidden by default */
  align-items: center;
  justify-content: center;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.25); /* subtle dim, transparent */
}

/* Pure CSS spinner (transparent background) */
.spinner {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.35);
  border-top-color: #55bcc9;
  animation: spin 0.9s linear infinite;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.02) inset;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Remove old gif-specific rules */
.loading-gif {
  width: auto;
  height: auto;
  display: none;
}

.aspect-ratio-toggles {
  position: relative;
  display: flex;
  gap: 10px;
}

.ratio-toggle {
  cursor: pointer;
  padding: 8px;
  border: 2px solid #eee;
  border-radius: 8px;
  transition: all 0.3s ease;
  opacity: 0.6;
  background: white;
}

.ratio-toggle img {
  height: 30px;
  width: auto;
}

.ratio-toggle.active {
  border-color: #55bcc9;
  opacity: 1;
  transform: scale(1.05);
}

.ratio-toggle:hover {
  opacity: 1;
}

.button-container {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  width: 100%;
  justify-content: center;
}

/* AI Showcase (top grid) */
.ai-showcase {
  margin: 0 0 22px;
}
.ai-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* 2x2 on all sizes */
  gap: 4px; /* tighter spacing */
}
.ai-card {
  position: relative;
  border-radius: 6px; /* slightly less rounded */
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
  transform: translateY(12px);
  opacity: 0;
  transition: transform 0.55s ease, opacity 0.55s ease, box-shadow 0.25s ease;
  line-height: 0; /* remove any line-box space under images */
}
.ai-card.in-view {
  transform: none;
  opacity: 1;
}
.ai-card:nth-child(1) {
  transition-delay: 0.05s;
}
.ai-card:nth-child(2) {
  transition-delay: 0.12s;
}
.ai-card:nth-child(3) {
  transition-delay: 0.19s;
}
.ai-card:nth-child(4) {
  transition-delay: 0.26s;
}

.ai-card img {
  display: block;
  width: 100%;
  height: 260px; /* default size */
  object-fit: cover;
  transition: transform 0.45s ease;
}
.ai-card:hover img {
  transform: scale(1.05);
}

/* Remove default figure margins causing extra space */
.ai-showcase figure,
.ai-card {
  margin: 0;
}

/* Larger on big screens */
@media (min-width: 1200px) {
  .ai-container {
    max-width: 1100px;
  }
  .ai-card img {
    height: 300px;
  }
}
@media (min-width: 1440px) {
  .ai-container {
    max-width: 1200px;
  }
  .ai-card img {
    height: 320px;
  }
}

/* Stay 2x2 but scale down images on smaller screens */
@media (max-width: 992px) {
  .ai-container {
    margin: 24px auto 24px; /* pull content up when top navbar is hidden on mobile */
  }
  .ai-card img {
    height: 220px;
  }
}
@media (max-width: 576px) {
  .ai-container {
    margin: 12px auto 20px; /* tighter on small phones */
  }
  .ai-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .ai-card img {
    height: 180px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-card {
    transition: none;
    transform: none;
    opacity: 1;
  }
  .ai-card img {
    transition: none;
  }
}
