:root {
  /* Base theme colors - dark theme default */
  --primary-purple: #8b5cf6;
  --purple-light: #a78bfa;
  --purple-dark: #6d28d9;
  --background: #0b0f19;
  --surface: #151a29;
  --text-primary: #e0e6f0;
  --text-secondary: #cbd5e1;
  --border: #2a3248;
  --card-bg: rgba(255, 255, 255, 0.05);
  --form-bg: rgba(255, 255, 255, 0.03);
  --btn-primary: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
  --btn-hover: #4a8bd2;
  --btn-active: #3d7ab8;
  --input-bg: rgba(255, 255, 255, 0.05);
  --input-border: rgba(255, 255, 255, 0.1);
  --shadow: rgba(0, 0, 0, 0.2);
  --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  --gradient-border: linear-gradient(90deg, var(--purple-light) 0%, #4a90e2 50%, #8b5cf6 100%);
  
  /* Animation speeds */
  --transition-fast: 0.2s;
  --transition-normal: 0.3s;
  --transition-slow: 0.5s;
}

/* Light theme */
[data-theme="light"] {
  --primary-purple: #7c3aed;
  --purple-light: #8b5cf6;
  --purple-dark: #6d28d9;
  --background: #f5f7fa;
  --surface: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --border: #e2e8f0;
  --card-bg: rgba(255, 255, 255, 0.9);
  --form-bg: rgba(255, 255, 255, 0.8);
  --btn-primary: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  --btn-hover: #3b82f6;
  --btn-active: #2563eb;
  --input-bg: rgba(255, 255, 255, 0.9);
  --input-border: rgba(203, 213, 225, 0.5);
  --shadow: rgba(0, 0, 0, 0.1);
  --card-shadow: 0 8px 25px rgba(0, 0, 0, 0.05);
}

/* === Reset & Base === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: linear-gradient(135deg, var(--background) 0%, #16213e 100%);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  margin: 0;
  padding: 20px;
  min-height: 100vh;
  transition: background-color var(--transition-slow) ease, color var(--transition-slow) ease;
}

/* === App Header === */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.theme-toggle {
  position: relative;
}

.theme-toggle button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px var(--shadow);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal) ease;
}

.theme-toggle button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}

.theme-toggle .fa-sun {
  opacity: 0;
  position: absolute;
  transform: scale(0.5);
  transition: all var(--transition-normal) ease;
  color: #f59e0b;
}

.theme-toggle .fa-moon {
  opacity: 1;
  transform: scale(1);
  transition: all var(--transition-normal) ease;
  color: #6366f1;
}

[data-theme="light"] .theme-toggle .fa-sun {
  opacity: 1;
  transform: scale(1);
}

[data-theme="light"] .theme-toggle .fa-moon {
  opacity: 0;
  transform: scale(0.5);
}

/* === Typography === */
h1, h2, h3 {
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 16px;
}

p {
  margin-bottom: 10px;
  color: var(--text-secondary);
}

label {
  font-weight: 500;
  margin-bottom: 8px;
  display: block;
  color: var(--text-secondary);
}

/* === Container Styling (Glassmorphism) === */
.container,
.login-container,
.image-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
  transition: background-color var(--transition-slow) ease, 
              box-shadow var(--transition-normal) ease,
              transform var(--transition-normal) ease;
}

/* === Animated Gradient Border === */
.generation-form,
.result-item {
  position: relative;
  background: var(--form-bg);
  padding: 25px;
  border-radius: 12px;
  border: 1px solid transparent;
  background-clip: padding-box;
  transition: all var(--transition-normal) ease;
  margin-bottom: 25px;
}

.generation-form::before,
.result-item::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: var(--gradient-border);
  z-index: -1;
  border-radius: 14px;
  opacity: 0;
  transition: opacity var(--transition-normal) ease;
  animation: gradientFlow 6s linear infinite;
}

.generation-form:hover::before,
.result-item:hover::before {
  opacity: 0.1;
}

@keyframes gradientFlow {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-weight: 500;
}

.form-help-text {
  font-size: 14px;
  color: var(--text-secondary);
  margin: -2px 0 12px 0;
  line-height: 1.4;
  padding-left: 2px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 16px;
  transition: all var(--transition-normal) ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-purple);
  box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

/* === Buttons (Animated, Glowing) === */
button {
  background: var(--btn-primary);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: all var(--transition-normal) ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}

/* Ripple effect for buttons - micro-interaction */
button::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, #fff 10%, transparent 10.01%);
  background-repeat: no-repeat;
  background-position: 50%;
  transform: scale(10, 10);
  opacity: 0;
  transition: transform 0.5s, opacity 0.8s;
}

button:active::after {
  transform: scale(0, 0);
  opacity: 0.3;
  transition: 0s;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
  background: var(--btn-hover);
}

button:active {
  transform: translateY(0);
}

/* === Login Box === */
.login-container {
  max-width: 400px;
  margin: 100px auto;
  padding: 30px;
  text-align: center;
  position: relative;
  z-index: 1000;
  background: rgba(21, 26, 41, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-container h2 {
  margin-bottom: 20px;
  color: var(--text-primary);
  font-size: 24px;
}

.login-container p {
  margin-bottom: 25px;
  color: var(--text-secondary);
}

.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: stretch;
}

.login-form .form-group {
  margin-bottom: 0;
  width: 100%;
}

.login-form input[type="password"] {
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-size: 16px;
  transition: all 0.3s ease;
  margin-bottom: 10px;
}

.login-form input[type="password"]:focus {
  outline: none;
  border-color: var(--primary-purple);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.login-form button {
  width: 100%;
  padding: 12px;
  background: var(--primary-purple);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: none;
  letter-spacing: normal;
}

.login-form button:hover {
  background: var(--purple-dark);
  transform: translateY(-2px);
}

.login-form button:disabled {
  background: var(--purple-light);
  cursor: not-allowed;
  transform: none;
  opacity: 0.7;
}

/* === Login Error === */
.login-error {
  background-color: rgba(248, 113, 113, 0.1);
  color: #f87171;
  padding: 12px;
  border-radius: 8px;
  margin-top: 10px;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(248, 113, 113, 0.2);
}

/* === Results Grid === */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.result-item {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: transform var(--transition-normal) ease, 
              box-shadow var(--transition-normal) ease;
  perspective: 1000px;
  margin-bottom: 30px;
}

.result-item:hover {
  transform: translate3d(0px, -1px, 2px) rotateX(0deg);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.result-image {
  width: 100%;
  height: auto;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.result-image img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform var(--transition-normal) ease;
}

.result-image:hover img {
  transform: scale(1.01);
}

.result-info {
  padding: 15px;
}

.result-prompt {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 15px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  max-height: 80px;
  overflow-y: auto;
}

.result-inputs {
  margin-bottom: 15px;
}

.input-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 5px;
  display: block;
}

.form-control {
  width: 100%;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 10px;
}

.form-control:focus {
  outline: none;
  border-color: #4a90e2;
  box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.filename-input {
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.regenerate-inputs {
  padding-top: 15px;
  border-top: none;
}

/* Specific spacing overrides for result inputs */
.result-inputs .form-control {
  margin-bottom: 12px !important; /* Consistent spacing between form fields */
}

.result-inputs .input-label {
  margin-bottom: 6px;
}

.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.result-actions button {
  flex: 1;
  min-width: 120px;
  padding: 8px 0;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.download-btn {
  background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
  color: white;
}

.download-btn:hover {
  background: linear-gradient(135deg, #357abd 0%, #2a5f9e 100%);
}

.regenerate-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
}

.regenerate-btn:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.zoom-out-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.zoom-out-btn:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

/* === Image Cards with Animation === */
.image-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  padding: 20px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.image-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 15px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
}

.image-item:hover {
  transform: translateY(-2px);
}

.generated-image {
  width: 100%;
  height: auto;
  border-radius: 4px;
  object-fit: contain;
}

.download-btn {
  padding: 8px 16px;
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s ease;
}

.download-btn:hover {
  background-color: #45a049;
}

.download-all-container {
  margin: 30px 0 20px 0 !important;
  padding: 18px;
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  max-width: 100%;
}

#download-all-container.hidden {
  opacity: 0;
  visibility: hidden;
}

#download-all-btn {
  padding: 12px 24px;
  background-color: #2196F3;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.2s ease;
}

#download-all-btn:hover {
  background-color: #1976D2;
}

/* === Prompt & Filename UI === */
.prompt-text {
  font-size: 14px;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

/* === Model Info Styles === */
.model-info {
  background: #241d3a;
  border-left: 4px solid var(--primary-purple);
  padding: 12px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 10px;
}

.token-usage {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  margin-top: 8px;
}

.token-low {
  background-color: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

.token-medium {
  background-color: rgba(234, 179, 8, 0.2);
  color: #facc15;
}

.token-high {
  background-color: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* === Special Button Variants === */
.download-btn {
  background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
}

.download-btn:hover {
  background: linear-gradient(135deg, #357abd 0%, #2a5f9e 100%);
}

.regenerate-btn {
  background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
  color: white;
}

.regenerate-btn:hover {
  background: linear-gradient(135deg, #27ae60 0%, #219a52 100%);
}

.download-all-btn {
  background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 12px 24px;
  font-size: 16px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.download-all-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  background: linear-gradient(135deg, #357abd 0%, #2a5f9e 100%);
}

/* === Button Icons === */
button i {
  margin-right: 8px;
}

/* === Emoji Buttons === */
.emoji-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.emoji-btn::before {
  font-size: 1.2em;
  line-height: 1;
}

/* === Utility === */
.error {
  background-color: #7f1d1d;
  color: #f8d7da;
  padding: 12px;
  border-radius: 6px;
  margin-top: 15px;
}

.loading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  margin: 2rem 0;
  backdrop-filter: blur(10px);
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

.loading-text {
  color: #fff;
  font-size: 1.1rem;
  margin-bottom: 1rem;
  text-align: center;
}

.loading-progress {
  width: 100%;
  max-width: 300px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-bar {
  width: 0%;
  height: 20px;
  background: #3498db;
  transition: width 0.3s ease;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 0.9rem;
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

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

.hide {
  display: none !important;
}
/* === Floating Particle Background === */
#particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -10;
  pointer-events: none;
  background: transparent;
}

/* === Custom Scrollbar === */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #1a1c2e;
}

::-webkit-scrollbar-thumb {
  background-color: var(--primary-purple);
  border-radius: 10px;
  border: 2px solid #1a1c2e;
}

/* === Optimize Button Fix === */
#optimizePromptBtn {
  padding: 8px 12px;
  font-size: 14px;
  height: 40px;
  line-height: 1;
  white-space: nowrap;
  width: auto !important; /* Force override */
  flex-shrink: 0;
}

/* === Loading Overlay === */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;  /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-content {
    background: rgba(255, 255, 255, 0.05);
    padding: 30px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #4a90e2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loading-message {
    color: #fff;
    font-size: 16px;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Touch Feedback === */
@media (hover: none) {
    .result-item {
        -webkit-tap-highlight-color: transparent;
    }

    button {
        -webkit-tap-highlight-color: transparent;
    }
}

/* === Enhanced Scrollbar for Mobile === */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 6px;
    }

    ::-webkit-scrollbar-track {
        background: transparent;
    }

    ::-webkit-scrollbar-thumb {
        background-color: rgba(74, 144, 226, 0.5);
        border-radius: 3px;
    }

    /* Small screens */
    h1 {
        font-size: 24px;
    }

    .container {
        padding: 15px;
        padding-bottom: 80px; /* Space for mobile nav */
    }

    .generation-form {
        padding: 25px; /* Match the desktop padding */
    }
}

/* === Mobile Navigation === */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    padding: 10px;
    z-index: 1000;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-nav-buttons {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #a8b2d1;
    text-decoration: none;
    font-size: 12px;
    padding: 8px;
    transition: all 0.3s ease;
}

.mobile-nav-btn.active {
    color: #4a90e2;
}

.mobile-nav-btn i {
    font-size: 20px;
    margin-bottom: 4px;
}

/* === Enhanced Button Groups === */
.button-group {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    margin-bottom: 0; /* Ensure no extra margin at bottom */
}

.button-group button {
    flex: 1;
    min-width: 120px;
    position: relative;
    overflow: hidden;
}

.button-group button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.button-group button:active::after {
    width: 300px;
    height: 300px;
}

/* === Interactive Form Elements === */
.form-group {
    position: relative;
}

.form-group label {
    transition: all 0.3s ease;
}

.form-group input:focus + label,
.form-group textarea:focus + label,
.form-group select:focus + label {
    color: #4a90e2;
    transform: translateY(-2px);
}

/* === Enhanced Mobile Styles === */
@media (max-width: 768px) {
    .mobile-nav {
        display: block;
    }

    .container {
        padding: 15px;
        padding-bottom: 80px; /* Space for mobile nav */
    }

    .generation-form {
        padding: 25px; /* Consistent padding on all sides */
    }

    /* Rest of mobile styles */
    .results-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .button-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .button-group button {
        width: 100%;
    }
    
    .result-item {
        margin-bottom: 15px;
    }
    
    .result-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .result-actions button {
        width: 100%;
    }
    
    /* Add touch feedback */
    .result-item:active {
        transform: scale(0.98);
    }
    
    /* Improve form input touch targets */
    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 15px;
        font-size: 16px; /* Prevent iOS zoom */
    }
    
    /* Add pull-to-refresh visual feedback */
    .container {
        min-height: calc(100vh - 80px);
        position: relative;
    }
    
    .container::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: linear-gradient(90deg, #4a90e2, #357abd);
        transform: scaleX(0);
        transform-origin: left;
        transition: transform 0.3s ease;
    }
    
    .container.pulling::before {
        transform: scaleX(1);
    }
}

/* Model Description */
.model-description {
    background: rgba(74, 144, 226, 0.1);
    border: 1px solid rgba(74, 144, 226, 0.2);
    color: #4a90e2;
    padding: 12px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 13px;
    line-height: 1.4;
    opacity: 1;
    visibility: visible;
    display: block;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    max-width: 100%;
}

.model-description.hidden {
    display: none;
    opacity: 0;
    visibility: hidden;
}

/* Token usage indicators */
.token-usage {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    margin-top: 6px;
}

.token-low {
    background-color: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.token-medium {
    background-color: rgba(234, 179, 8, 0.2);
    color: #facc15;
}

.token-high {
    background-color: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* Progress bar styles */
.progress-container {
    width: 100%;
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #4a90e2;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    margin-top: 5px;
    font-size: 14px;
    color: white;
}

/* Image Actions */
.image-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.download-btn,
.regenerate-btn,
.zoom-out-btn {
    padding: 6px 12px;
    font-size: 14px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.download-btn {
    background-color: #4CAF50;
    color: white;
}

.regenerate-btn {
    background-color: #2196F3;
    color: white;
}

.zoom-out-btn {
    background-color: #9C27B0;
    color: white;
}

.download-btn:hover,
.regenerate-btn:hover,
.zoom-out-btn:hover {
    opacity: 0.9;
}

/* Prompt Inputs */
.prompt-inputs {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.prompt-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.prompt-group label {
    font-size: 14px;
    color: var(--text-secondary);
}

.prompt-group input,
.prompt-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: rgba(30, 22, 50, 0.7);
    color: var(--text-primary);
}

.prompt-group input:focus,
.prompt-group textarea:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

/* Prefix Count */
.prefix-count {
    font-size: 14px;
    color: #a8b2d1;
    margin-top: 8px;
}

/* Fix for zoomed out images to ensure same background */
.result-item img {
    background: rgba(255, 255, 255, 0.05);
    display: block;
}

/* === Style Transfer Section === */
.style-transfer-section,
.style-upload-container,
.style-upload-area,
.style-file-input,
.style-upload-placeholder,
.style-upload-placeholder i,
.style-image-preview,
.style-image-preview img,
.style-controls,
.style-strength-slider,
.style-strength-slider::-webkit-slider-thumb,
.style-strength-slider::-webkit-slider-thumb:hover,
#styleStrengthValue,
.style-strength-warning,
.small-btn,
.small-btn:hover,
.style-tag {
  /* These elements will be removed */
  display: none !important;
}

/* === Theme Transition === */
.theme-transition {
  transition: background-color 1s ease, color 1s ease;
}

.theme-transition * {
  transition: background-color 1s ease, 
              color 1s ease,
              border-color 1s ease,
              box-shadow 1s ease !important;
}

/* === Result Item Styling === */
.result-item {
  opacity: 0;
  transform: translateY(10px);
  animation: fadeInUp 0.5s forwards;
}

.result-image {
  width: 100%;
  height: auto;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  transition: transform var(--transition-normal) ease;
}

.result-image:hover img {
  transform: scale(1.01);
}

.result-image img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform var(--transition-normal) ease;
}

/* === Micro-interactions === */
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  transform: translateY(-2px);
}

.download-btn,
.zoom-out-btn {
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.download-btn::before,
.zoom-out-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, var(--primary-purple), transparent);
  opacity: 0;
  z-index: -1;
  transition: opacity var(--transition-normal) ease;
}

.download-btn:hover::before,
.zoom-out-btn:hover::before {
  opacity: 0.3;
}

/* === Loading Animation Enhancement === */
.spinner {
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border-top: 4px solid var(--primary-purple);
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

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

.loading-overlay {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  transition: opacity var(--transition-normal) ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === Custom Confirmation Dialog === */
.custom-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.custom-confirm-dialog {
    background-color: rgba(30, 35, 45, 0.95);
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: dialogSlideIn 0.2s ease-out;
}

@keyframes dialogSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.custom-confirm-header {
    display: flex;
    justify-content: flex-end;
    padding: 10px;
    position: relative;
}

.custom-confirm-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.custom-confirm-close:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.custom-confirm-close:active {
    transform: scale(0.95);
}

.custom-confirm-message {
    padding: 0 20px 20px;
    color: rgba(255, 255, 255, 0.95);
    font-size: 16px;
    line-height: 1.6;
    overflow-y: auto;
    max-height: 60vh;
    font-weight: 400;
}

.custom-confirm-buttons {
    display: flex;
    justify-content: flex-end;
    padding: 15px 20px;
    background-color: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.custom-confirm-button {
    padding: 8px 20px;
    border-radius: 4px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    margin-left: 10px;
}

.custom-confirm-button:hover {
    transform: translateY(-1px);
}

.custom-confirm-button:active {
    transform: translateY(1px);
}

.custom-confirm-cancel {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.custom-confirm-ok {
    background-color: var(--primary-color);
    color: white;
}

.custom-confirm-cancel:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.custom-confirm-ok:hover {
    background-color: var(--primary-color-dark, #357abd);
}

/* Make the last form-group have bottom margin of 0 to ensure even padding */
.generation-form .form-group:last-child {
  margin-bottom: 0;
}