/* ===== REUSABLE COMPONENTS ===== */

/* Chat container styles */
.chat-container {
  background-color: #121212;
  color: white;
  border-radius: 10px;
  padding: 20px;
  margin: 20px;
  max-width: 300px;
}

.chat-messages {
  background-color: #2c2c2c;
  border-radius: 10px;
  padding: 10px;
  color: white;
  overflow-y: auto;
  height: 150px;
  margin-bottom: 20px;
}

#chatInput {
  background-color: #2c2c2c;
  border: 1px solid #444;
  border-radius: 10px;
  padding: 10px;
  color: white;
  width: 70%;
  margin-top: 20px;
  margin-bottom: 20px;
}

.send-chat-btn {
  background-color: #17a2b8;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s;
}

.send-chat-btn:hover {
  background-color: #138496;
}

.send-chat-btn:focus {
  outline: none;
}

.send-chat-btn:active {
  background-color: #117a8b;
}

/* Image styles */
#enlargedImageContainer {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
}

#imageResult img {
  max-width: 556px;
  cursor: pointer;
}

#imageGenerationForm {
  margin-bottom: 20px;
  margin-top: 20px;
}

/* Form styles */
.styled-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.styled-select,
.styled-input {
  background-color: #2c2c2c;
  color: #ffffff;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 10px;
  font-size: 16px;
}

.styled-button {
  background-color: #28a745;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s;
}

.styled-button:hover {
  background-color: #218838;
}

.styled-button:focus {
  outline: none;
}

.styled-button:active {
  background-color: #1e7e34;
}

.error-message {
  display: none;  /* Initially hidden */
  padding: 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: #b91c1c;
  background-color: #fee2e2;
  border-radius: 0.5rem;
}

/* Button styles */
.button {
  color: white;
  border: none;
  border-radius: 25px;
  padding: 10px 20px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s;
}

/* Chat Button styles */
.send-chat-btn {
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s;
  background-color: #17a2b8;
}

.send-chat-btn:hover {
  background-color: #138496;
}

.send-chat-btn:focus {
  outline: none;
}

.send-chat-btn:active {
  background-color: #117a8b;
}

/* Progress bar styles */
.loading-container {
  width: 100%;
  max-width: 556px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 20px;
}

.progress-bar {
  width: 80%;
  background-color: #444;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.progress {
  height: 20px;
  background-color: #17a2b8;
  width: 0;
  animation: progressAnimation 2s infinite;
}

@keyframes progressAnimation {
  0% {
      width: 0;
  }
  50% {
      width: 100%;
  }
  100% {
      width: 0;
  }
}

/* Gallery styling */
.gallery-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); /* Default grid layout */
  gap: 10px;
}

/* Media query for larger screens */
@media (min-width: 1200px) {
  .gallery-container {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); /* Larger thumbnails on desktop */
  }
}

/* Media query for mobile portrait mode */
@media (max-width: 600px) {
  .gallery-container {
      grid-template-columns: repeat(2, 1fr); /* Two columns on small screens */
      gap: 8px; /* Adjust gap for smaller screens */
  }
}

/* Gallery item styling */
.gallery-item {
  position: relative;
  overflow: hidden;
}

/* Image inside gallery item */
.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 5px;
  object-fit: cover;
}

/* Thumbnail icons */
.thumbnail-icon {
  position: absolute;
  width: 20px !important;
  height: 20px !important;
  cursor: pointer;
  display: none !important; /* Ensure they are visible for debugging */
}

.thumbnail-download-icon {
  right: 25px;
  top: 5px;
}

.thumbnail-info-icon {
  right: 5px;
  top: 5px;
}

/* Show icons on hover */
.gallery-item:hover .thumbnail-icon {
  display: block !important;
}

/* Enlarged image container */
.enlarged-image-container {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.enlarged-image-wrapper {
  position: relative;
}

.enlarged-image-wrapper img {
  max-width: 100%;
  max-height: 100vh; /* Ensure the image does not exceed the viewport height */
  object-fit: contain; /* Maintain aspect ratio within the viewport */
}

.enlarged-image-icons {
  position: absolute;
  top: 10px;
  right: 10px;
  display: none; /* Hide icons by default */
  gap: 10px;
  z-index: 1001;
}

.enlarged-icon {
  width: 25px;
  height: 25px;
  cursor: pointer;
}

.enlarged-image-wrapper:hover .enlarged-image-icons {
  display: flex; /* Show icons when hovering over the enlarged image wrapper */
}

/* Sort container styling */
.sort-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); /* Responsive grid */
  gap: 10px;
  margin-bottom: 20px;
  align-items: center; /* Ensure vertical alignment */
}

.sort-container > div {
  display: flex;
  flex-direction: column;
}

.sort-container label {
  margin-bottom: 5px;
  font-weight: bold;
}

.sort-container select,
.sort-container input,
.sort-container button {
  padding: 10px;
  border-radius: 4px;
  border: 1px solid #555;
  background: #444;
  color: #ddd;
  font-size: 14px;
  width: 100%; /* Make all fields take full width */
  box-sizing: border-box;
  height: 40px; /* Set a uniform height */
}

.sort-container button {
  background-color: #007bff;
  color: white;
  border: none;
  cursor: pointer;
  height: 42px; /* Slightly taller than inputs to align vertically */
  align-self: end;
  margin-top: 20px;
}

/* Mobile layout */
@media (max-width: 600px) {
  .sort-container {
    grid-template-columns: 1fr; /* Stack elements vertically on small screens */
  }
}

/* Info container styling */
.info-container {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #1a1919;
  padding: 20px;
  border-radius: 10px;
  color: #dedddd;
  z-index: 1001;
  max-width: 80%;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.info-container p {
  margin: 5px 0;
}

.close-icon {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  cursor: pointer;
}

@media (max-width: 600px) {
  .info-container {
      max-width: 95%;
      padding: 15px;
  }
}

/* Styling for the image result container in game.html */
#imageResult {
  position: relative; /* Make the container position relative to position the icons absolutely inside it */
}

#generatedImage {
  width: 100%;
  height: auto;
}

.image-container {
  position: relative;
}

.image-icon {
  position: absolute;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: none; /* Hide icons by default */
}

.image-container:hover .image-icon {
  display: block; /* Show icons on hover */
}

.download-icon {
  top: 10px;
  right: 60px;
}

.enlarge-icon {
  top: 10px;
  right: 10px;
}

/* ===== ELEGANT ACTION BUTTON SYSTEM ===== */
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 2.75rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

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

.action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.action-btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
}

.action-btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
}

.action-btn-secondary {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    color: white;
}

.action-btn-secondary:hover {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
}

/* Additional styles */
.styled-div {
    background: linear-gradient(to bottom right, #7F00FF, #E100FF);
    padding: 20px;
    border-radius: 15px;
    color: black;
    font-family: 'Comic Sans MS', cursive, sans-serif;
    text-align: center;
}

.styled-div h1 {
  font-size: 1.5em;
  margin-bottom: 10px;
}

.styled-div .highlight {
  color: yellow;
  text-shadow: 2px 2px 4px #000000;
}

.styled-div p {
  font-size: 1.2em;
  margin: 10px 0;
}

.styled-div .small-text {
  font-size: 0.6em;
  margin-top: 20px;
}

/* Flash effect */
.flash-effect {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  opacity: 0;
  pointer-events: none;
}

.flash {
  animation: flash-animation 0.5s ease-in-out forwards;
}

@keyframes flash-animation {
  0% {
      opacity: 0;
  }
  25% {
      opacity: 1;
  }
  50% {
      opacity: 0;
  }
  100% {
      opacity: 0;
  }
}

.explosion {
  position: absolute;
  pointer-events: none; /* Allow clicks to pass through */
  width: 100px;
  height: 100px;
  transform: translate(-50%, -50%);
  }

  .particle {
  transform-origin: center;
  }

  @keyframes explode {
  0% { transform: scale(1); opacity: 1; }
  100% { opacity: 0; transform: scale(0.5); }
  }  

  /* Success message styles */
.success-message {
  display: none; /* Hidden by default */
  padding: 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: #155724;
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
  border-radius: 0.5rem;
  animation: fadeIn 1s ease-in-out forwards;
}

/* Subtle form hover and focus enhancements */
.styled-input:hover,
.styled-select:hover,
.styled-input:focus,
.styled-select:focus {
  border-color: #888;
  background-color: #3a3a3a;
}

/* Optional: smoother input field transitions */
.styled-input,
.styled-select {
  transition: all 0.3s ease;
}
