body {
  background-color: #111;
  background-image: url('https://www.transparenttextures.com/patterns/clean-gray-paper.png');
  color: #fff;
  font-family: Arial, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 2rem 0;
}

.container {
  text-align: center;
  width: 80%;
  max-width: 900px;
}

.content-card {
  background-color: rgba(28, 28, 28, 0.75);
  border: 1px solid #444;
  border-radius: 10px;
  padding: 2rem;
  backdrop-filter: blur(5px);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  animation: fadeIn 0.8s ease-in-out;
}

.title {
  font-family: 'Changa', sans-serif;
  font-size: 3rem;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
}

.subtitle {
  font-size: 1rem;
  color: #ccc;
  margin-top: 0;
  margin-bottom: 2rem;
}

.instructions {
  font-size: 0.9rem;
  color: #aaa;
  margin-top: 1rem;
}

.description {
  padding-bottom: 2rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid #444;
  color: #aaa;
}

/* Upload Box */
.upload-area {
  position: relative;
  /* Needed for z-index on content */
  border: 2px dashed #777;
  border-radius: 10px;
  padding: 2rem;
  cursor: pointer;
  transition: background-color 0.3s, border-color 0.3s;
  
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23444' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3e%3cpolyline points='17 8 12 3 7 8'/%3e%3cline x1='12' y1='3' x2='12' y2='15'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 80px 80px;
}

.upload-area:hover {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: #c0392b;
}

.upload-area.is-dragging {
  border-style: solid;
  border-color: #e74c3c;
  background-color: rgba(231, 76, 60, 0.1);
}

.upload-container .upload-area {
  background-color: #333;
  border: 2px dashed #555;
  border-radius: 10px;
  padding: 2rem;
  cursor: pointer;
  transition: background-color 0.3s;
}

.upload-content {
  position: relative;
  z-index: 2;
}

.upload-content .upload-icon {
  width: 50px;
  margin-bottom: 1rem;
  filter: invert(0.5);
  /* Dims the icon slightly */
}

.upload-content p {
  margin: 0.5rem 0;
}

.select-btn {
  background-color: #c0392b;
  color: #fff;
  border: none;
  padding: 12px 25px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  text-transform: uppercase;
  margin-top: 1rem;
  transition: background-color 0.3s, transform 0.2s;
  animation: pulse 2s infinite;
}

.select-btn:hover {
  background-color: #e74c3c;
  transform: translateY(-2px);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(231, 76, 60, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
  }
}

.file-support {
  font-size: 0.8rem;
  color: #777;
  margin-top: 1rem;
}

/* Editor Box */
#image-preview-container {
  position: relative;
  max-width: 100%;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 5px;
}

#preview-image {
  display: block;
  max-width: 100%;
  filter: grayscale(100%);
}

#draggable-banner {
  position: absolute;
  width: 80%;
  left: 10%;
  top: 50%;
  transform: translateY(-50%);
  cursor: ns-resize;
  user-select: none;
  -webkit-user-drag: none;
}

/* Result Box */
#result-image {
  max-width: 100%;
  border-radius: 5px;
}

#result-image,
#preview-image {
  max-width: 100%;
  border-radius: 5px;
}

.button-group {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

.action-btn {
  background-color: #333;
  color: #fff;
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  text-transform: uppercase;
  font-size: 1rem;
  text-decoration: none;
  display: inline-block;
  margin: 0 10px;
  transition: background-color 0.3s, transform 0.2s;
}

.action-btn:hover {
  background-color: #555;
  transform: translateY(-2px);
  opacity: 0.9;
}

.action-btn.download {
  background-color: #5cb85c;
  border: none;
}

.action-btn.download:hover {
  background-color: #e74c3c;
}

.action-btn:not(.download) {
  background-color: #007bff;
}

.view {
  width: 100%;
}

/* --- Header & Nav --- */
header {
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header nav a {
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
  text-decoration: none;
  padding: 10px 20px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: background-color 0.3s, color 0.3s;
}

header nav a:hover {
  background-color: #fff;
  color: #111;
}

/* Footer Styles */
.site-footer {
  width: 100%;
  padding: 2rem 0;
  margin-top: 2rem;
  border-top: 1px solid #333;
  color: #aaa;
  font-size: 0.85rem;

  /* Use flexbox to ensure perfect centering */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.site-footer p {
  margin: 0;
  text-align: center;
}

.site-footer a {
  color: #ddd;
  /* A slightly brighter grey to stand out */
  text-decoration: none;
  /* Remove the default underline */
  font-weight: bold;
  transition: color 0.2s ease-in-out;
}

/* Add an underline when the user hovers over the link */
.site-footer a:hover {
  text-decoration: underline;
  color: #fff;
  /* Make it brighter on hover */
}

footer {
  margin-top: 3rem;
  color: #ffffff;
  font-size: 0.8rem;
}

/* --- Public Checkbox --- */
.public-checkbox-container {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

#make-public-checkbox {
  width: 18px;
  height: 18px;
}

/* --- Gallery Grid --- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 15px;
  margin-top: 2rem;
}

.gallery-grid img {
  width: 100%;
  height: auto;
  border-radius: 5px;
  background-color: #333;
}

.gallery-card {
  position: relative;
  overflow: hidden;
  border-radius: 5px;
}

.gallery-card img {
  display: block;
  width: 100%;
  transition: transform 0.3s ease-in-out;
}

.gallery-stats {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  /* Darker overlay */
  color: #fff;
  display: flex;
  flex-direction: column;
  /* Stack stats vertically */
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 1.2rem;
  /* Larger font */
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 5px;
  /* Match the card's radius */
}

.gallery-card:hover .gallery-stats {
  opacity: 1;
}

.gallery-card:hover img {
  transform: scale(1.05);
}

.skeleton-card {
  background-color: #2c2c2c;
  border-radius: 5px;
  height: 250px;
  /* Example height */
  margin-bottom: 15px;
  position: relative;
  overflow: hidden;
}

/* Shimmer animation */
.skeleton-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -150%;
  width: 150%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    left: -150%;
  }

  100% {
    left: 150%;
  }
}

.like-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0;
  line-height: 1;
  transition: transform 0.2s;
}

.like-btn:hover {
  transform: scale(1.2);
}

.like-btn.liked {
  cursor: default;
  filter: saturate(0);
}

/* --- Loading Overlay & Spinner --- */
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  cursor: wait;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 6px solid #555;
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  color: #fff;
  margin-top: 20px;
  font-size: 1.2rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- Client-Side Upload Error --- */
.upload-error {
  color: #e74c3c;
  font-weight: bold;
  margin-top: 15px;
  min-height: 1em;
  /* Prevents layout shift */
}

/* --- Error Modal --- */
#error-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1001;
  /* Higher than loading overlay */
}

.modal-content {
  background-color: #2c2c2c;
  padding: 30px;
  border-radius: 8px;
  text-align: center;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
  margin-top: 0;
  color: #e74c3c;
}

#modal-close-btn {
  margin-top: 20px;
  background-color: #555;
  transition: background-color 0.3s;
}

#modal-close-btn:hover {
  background-color: #777;
}

/* --- Social Share --- */
.social-share-container {
  margin-top: 2rem;
  text-align: center;
  padding-top: 1.5rem;
  color: #ccc;
  border-top: 1px solid #444;
}

.social-share-container p {
  margin-bottom: 1rem;
  color: #aaa;
}

.social-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.5rem;
}

.social-btn {
  background-color: #333;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  width: 35px;
  height: 35px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.2rem;}

.social-btn:hover {
  transform: scale(1.1);
  opacity: 0.9;
}

.social-btn.twitter {
  background-color: #1da1f2;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3e%3cpath d='M22.46 6c-.77.35-1.6.58-2.46.67.88-.53 1.56-1.37 1.88-2.38-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29 0 .34.04.67.11.98C8.28 9.09 5.11 7.38 3 4.79c-.37.63-.58 1.37-.58 2.15 0 1.49.75 2.81 1.91 3.56-.71 0-1.37-.22-1.95-.55v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.93.07 4.28 4.28 0 0 0 4 2.98 8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21 16 21 20.33 14.5 20.33 8.79c0-.19 0-.37-.01-.56.84-.6 1.56-1.36 2.14-2.23z'/%3e%3c/svg%3e");
}

.social-btn.facebook {
  background-color: #1877f2;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3e%3cpath d='M22 12c0-5.52-4.48-10-10-10S2 6.48 2 12c0 4.84 3.44 8.87 8 9.8V15H8v-3h2V9.5C10 7.57 11.57 6 13.5 6H16v3h-2c-.55 0-1 .45-1 1v2h3v3h-3v6.95c5.05-.5 9-4.76 9-9.95z'/%3e%3c/svg%3e");
}

.social-btn.reddit {
  background-color: #ff4500;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3e%3cpath d='M21.5 12a2.5 2.5 0 0 0-2.5-2.5h-3.36c-.2-.63-.5-1.2-1-1.68C14.1 7.4 13.1 7 12 7s-2.1.4-2.65.82c-.5.48-.8 1.05-1 1.68H5a2.5 2.5 0 0 0 0 5h1.28c.07.35.18.68.32 1a2.49 2.49 0 0 0 4.4 2V22l3-2-3-2v-2.12c1.37-.1 2.62-.73 3.5-1.7l.1-.12c.03-.02.05-.05.07-.07.13-.15.25-.3.35-.46l1.28.01a2.5 2.5 0 0 0 2.5-2.5zM12 6c1.65 0 3 1.35 3 3s-1.35 3-3 3-3-1.35-3-3 1.35-3 3-3zM5 13.5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm14 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z'/%3e%3c/svg%3e");
}

/* Add a new style for the copy button */
#copy-link-btn {
  background-color: #555;
  border: none;
}

#image-display-card img {
  display: block;
  max-width: 90%;
  /* Adjust as needed */
  margin: 1rem auto;
  /* Center the image */
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.image-stats-bar {
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 0.5rem 1rem;
  margin: 0.5rem auto;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 5px;
  color: #ccc;
  width: fit-content;
}

.editor-controls {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ccc;
}

#size-slider {
  cursor: pointer;
}

/* --- Sort Controls --- */
.sort-container {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.sort-btn {
  background-color: rgba(255, 255, 255, 0.1);
  color: #ccc;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px 16px;
  border-radius: 20px;
  /* Pill shape */
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s, color 0.3s;
}

.sort-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* Style for the currently active sort button */
.sort-btn.active {
  background-color: #fff;
  color: #111;
  border-color: #fff;
}


.image-viewer {
  position: relative;
  max-width: 90%;
  margin: 1rem auto;
}

.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 2rem;
  padding: 10px;
  border-radius: 50%;
  text-decoration: none;
  display: none;
  /* Hidden by default, shown by JS */
  justify-content: center;
  align-items: center;
  width: 50px;
  height: 50px;
  transition: background-color 0.2s;
  user-select: none;
}

.nav-arrow:hover {
  background-color: rgba(0, 0, 0, 0.7);
}

.nav-arrow.prev {
  left: 10px;
}

.nav-arrow.next {
  right: 10px;
}

/* Admin Styles */
.admin-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.admin-form input {
  padding: 10px;
  border-radius: 5px;
  border: 1px solid #555;
  background: #333;
  color: #fff;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.admin-table th,
.admin-table td {
  padding: 10px;
  border: 1px solid #444;
  text-align: left;
}

.admin-table th {
  background-color: #333;
}

.admin-table a {
  color: #1da1f2;
}

/* --- Responsive Styles --- */

@media (max-width: 768px) {

  header {
    flex-direction: column;
    /* Stack the title and button vertically */
    gap: 1rem;
    /* Add some space between them */
  }

  .title {
    font-size: 2.5rem;
    /* Adjust title size for mobile if needed */
    text-align: center;
  }

  header nav a {
    width: 100%;
    /* Make the gallery button full-width */
    text-align: center;
  }

  .nav-arrow {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
  }
}

