/* importing google font - Inter and Outfit */
@import url("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Outfit:wght@100..900&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Inter", sans-serif;
}

:root {
  --color-primary: #5c56e1;
  --color-primary-dark: #5b21b6;
  --color-accent: #8b5cf6;
  --color-card: #ffffff;
  --color-input: #f1f1ff;
  --color-text: #09090e;
  --color-placeholder: #5c5a87;
  --color-border: #d4d4ed;
  --color-gradient: linear-gradient(135deg, #5c56e1, #8b5cf6);
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(#e9e9ff, #c8c7ff);
  color: var(--color-text);
  padding: 15px;
}

body.dark-theme {
  --color-card: #1e293b;
  --color-input: #141b2d;
  --color-text: #f3f4f6;
  --color-placeholder: #a3b6dc;
  --color-border: #334155;

  background: var(--color-card);
  background-image: radial-gradient(
      circle at 15% 50%,
      rgba(99, 102, 241, 0.15) 0%,
      transparent 35%
    ),
    radial-gradient(
      circle at 85% 30%,
      rgba(139, 92, 246, 0.15) 0%,
      transparent 35%
    ),
    radial-gradient(
      circle at 50% 80%,
      rgba(99, 102, 241, 0.1) 0%,
      transparent 40%
    );
}

.container {
  background: var(--color-card);
  padding: 32px;
  border-radius: 23px;
  box-shadow: 0 10px 20px 0 rgba(0, 0, 0, 0.1);
  width: 900px;
  position: relative;
  overflow: hidden;
}

body.dark-theme .container {
  border: 1px solid var(--color-border);
}
.container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: var(--color-gradient);
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header .logo-wrapper {
  display: flex;
  align-items: center;
  gap: 18px;
}

.header .logo-wrapper .logo {
  background: var(--color-gradient);
  color: #fff;
  width: 56px;
  height: 55px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.header .logo-wrapper h1 {
  font-weight: 700;
  font-size: 1.9rem;
}

.header .theme-toggle {
  background: var(--color-input);
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.05rem;
  color: var(--color-placeholder);
  border: 1px solid var(--color-border);
  transition: all 0.3s ease;
}

.header .theme-toggle:hover {
  color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Info Banner */
.info-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--color-input);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: 10px;
  padding: 12px 16px;
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--color-placeholder);
}

.info-banner i {
  color: var(--color-primary);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.info-banner a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}

.info-banner a:hover {
  text-decoration: underline;
}

.main-content {
  margin: 35px 0 5px;
}

.main-content .prompt-container {
  width: 100%;
  margin-bottom: 20px;
  position: relative;
}

.prompt-container .prompt-input {
  width: 100%;
  line-height: 1.6;
  min-height: 120px;
  border-radius: 15px;
  border: 1px solid var(--color-border);
  padding: 16px 20px;
  font-size: 1.05rem;
  color: var(--color-text);
  background: var(--color-input);
  resize: vertical;
  transition: all 0.3s ease;
}

.prompt-container .prompt-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 4px rgba(92, 86, 225, 0.2);
}

.prompt-container .prompt-input::placeholder {
  color: var(--color-placeholder);
  font-weight: 500;
}

.prompt-container .prompt-btn {
  position: absolute;
  bottom: 25px;
  right: 25px;
  background: var(--color-gradient);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  border: none;
  opacity: 0.8;
  transition: all 0.3s ease;
}

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

.main-content .prompt-actions {
  display: grid;
  gap: 15px;
  grid-template-columns: 1.2fr 1fr 1.1fr 1fr;
}

.prompt-actions .select-wrapper {
  position: relative;
}

.prompt-actions .select-wrapper::after {
  content: "\f107";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 0.9rem;
  position: absolute;
  right: 20px;
  top: 50%;
  padding-left: 7px;
  background: var(--color-input);
  color: var(--color-placeholder);
  pointer-events: none;
  transform: translateY(-50%);
}

.prompt-actions :where(.custom-select, .generate-btn) {
  cursor: pointer;
  background: var(--color-input);
  border: 1px solid var(--color-border);
  padding: 12px 20px;
  font-size: 1rem;
  border-radius: 10px;
  transition: all 0.3s ease;
}

.prompt-actions .custom-select {
  width: 100%;
  outline: none;
  height: 100%;
  appearance: none;
  color: var(--color-text);
}

.prompt-actions .custom-select:is(:focus, :hover) {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.prompt-actions .generate-btn {
  background: var(--color-gradient);
  color: #fff;
  border: none;
  margin-left: auto;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 25px;
  gap: 12px;
}

.prompt-actions .generate-btn:disabled {
  opacity: 0.6;
  pointer-events: none;
}

.prompt-actions .generate-btn:hover {
  background: var(--color-primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(109, 40, 217, 0.3);
}

.main-content .gallery-grid:has(.img-card) {
  margin-top: 30px;
}

.main-content .gallery-grid {
  display: grid;
  gap: 15px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.gallery-grid .img-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  border-radius: 16px;
  background: var(--color-input);
  border: 1px solid var(--color-border);
  transition: all 0.5s ease;
}

.gallery-grid .img-card:not(.loading, .error):hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.gallery-grid .img-card .result-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.gallery-grid .img-card:is(.loading, .error) :is(.result-img, .img-overlay) {
  display: none;
}

.gallery-grid .img-card .img-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px;
  display: flex;
  opacity: 0;
  pointer-events: none;
  justify-content: flex-end;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  transition: all 0.3s ease;
}

.gallery-grid .img-card:hover .img-overlay {
  opacity: 1;
  pointer-events: auto;
}

.gallery-grid .img-card .img-download-btn {
  height: 45px;
  width: 45px;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
  background: rgba(255, 255, 255, 0.25);
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.gallery-grid .img-card .img-download-btn:hover {
  transform: scale(1.05);
  background: rgba(255, 255, 255, 0.4);
}

.gallery-grid .img-card .status-container {
  padding: 15px;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 13px;
}

.gallery-grid .img-card:where(.loading, .error) .status-container {
  display: flex;
}

.gallery-grid .img-card.loading .status-container i,
.gallery-grid .img-card.error .spinner {
  display: none;
}

.gallery-grid .img-card.error .status-container i {
  font-size: 1.7rem;
  color: #ef4444;
}

.gallery-grid .img-card.loading .spinner {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  animation: spin 1s linear infinite;
}

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

.gallery-grid .img-card .status-text {
  font-size: 0.85rem;
  text-align: center;
  color: var(--color-placeholder);
}

@media (max-width: 768px) {
  .container {
    padding: 18px;
  }

  .header .logo-wrapper .logo {
    height: 50px;
    width: 51px;
    font-size: 1.25rem;
  }
  .header .logo-wrapper h1 {
    font-size: 1.7rem;
  }
  .main-content .prompt-actions {
    grid-template-columns: 1fr;
    margin-top: -10px;
  }
  .prompt-actions generate-btn {
    margin: 10px 0 0;
  }

  .gallery-grid .img-card .img-overlay{
    opacity: 1;
  }
}
