/* ==========================================================================
   Nebula AI - Design System & Custom Styling (CSS Variables)
   ========================================================================== */

:root {
  /* Color Palette - Muted Charcoal & Clay Bronze (Inspired by Casabath, Falper, Edone) */
  --bg-main: #141517;
  --bg-sidebar: #1b1c1e;
  --bg-card: rgba(30, 31, 33, 0.65);
  --bg-card-hover: rgba(40, 42, 45, 0.85);
  --border-color: rgba(255, 255, 255, 0.05);
  --border-color-focus: rgba(175, 154, 125, 0.35);
  
  --primary-gradient: linear-gradient(135deg, #a39077 0%, #bca58a 100%);
  --primary-color: #bca58a;
  --primary-glow: transparent;
  
  --text-main: #e8e8eb;
  --text-muted: #8d929a;
  --text-inverse: #111112;
  
  --msg-user: rgba(175, 154, 125, 0.06);
  --msg-assistant: rgba(255, 255, 255, 0.015);
  --msg-system: rgba(220, 38, 38, 0.06);
  
  /* Layout Dimensions */
  --sidebar-width: 320px;
  --navbar-height: 70px;
  
  /* Effects - Flat, Sharp, Minimalist Architectural Linework */
  --card-blur: none;
  --transition-smooth: all 0.2s ease-in-out;
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.4);
  --shadow-glow: none;
}

/* Alternate Style / Natural Muted Sage Olive */
body.visual-alt {
  --bg-main: #131413;
  --bg-sidebar: #1a1c1a;
  --bg-card: rgba(30, 33, 30, 0.65);
  --primary-gradient: linear-gradient(135deg, #6c7866 0%, #7d8a77 100%);
  --primary-color: #7d8a77;
  --primary-glow: transparent;
  --msg-user: rgba(125, 138, 119, 0.06);
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  color: #ffffff;
}

code, pre {
  font-family: 'Fira Code', monospace;
  font-size: 0.9rem;
}

/* ==========================================================================
   Layout Structure
   ========================================================================== */

.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
  background-color: var(--bg-main);
}

/* ==========================================================================
   Sidebar component
   ========================================================================== */

.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: var(--transition-smooth);
}

.sidebar-header {
  height: var(--navbar-height);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.brand-icon {
  color: #a78bfa;
  width: 24px;
  height: 24px;
}

.brand h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(120deg, #ffffff, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-glow {
  position: absolute;
  width: 30px;
  height: 30px;
  background: var(--primary-gradient);
  filter: blur(15px);
  opacity: 0.5;
  top: -5px;
  left: -5px;
  border-radius: 50%;
  pointer-events: none;
}

.sidebar-scroll-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title i {
  width: 14px;
  height: 14px;
}

/* Suggestion Cards */
.suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.suggestion-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: var(--transition-smooth);
}

.suggestion-card span {
  font-size: 0.85rem;
  color: var(--text-main);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggestion-card i {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.suggestion-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(175, 154, 125, 0.3);
  transform: translateY(-1px);
}

.suggestion-card:hover i {
  color: #ffffff;
  transform: translateX(2px);
}

.img-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(236, 72, 153, 0.15);
  border: 1px solid rgba(236, 72, 153, 0.3);
  color: #f472b6 !important;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.7rem !important;
  flex-shrink: 0;
}

/* Settings Form */
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-main);
}

.input-group input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  padding: 10px 12px;
  border-radius: 8px;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.85rem;
  transition: var(--transition-smooth);
}

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

.input-help {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.theme-toggle-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
}

/* Switch styling */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .4s;
  border-radius: 34px;
  border: 1px solid var(--border-color);
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background: var(--primary-gradient);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--border-color);
}

.clear-history-btn {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition-smooth);
}

.clear-history-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #f87171;
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

/* Top Navbar */
.navbar {
  height: var(--navbar-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: var(--card-blur);
  background-color: rgba(6, 7, 13, 0.5);
  z-index: 10;
}

.menu-btn {
  display: none; /* Shown on mobile only */
}

.navbar-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-indicator.online {
  background-color: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.title-details h2 {
  font-size: 1.05rem;
  font-weight: 600;
}

.title-details p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.navbar-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.icon-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary-color);
  color: #ffffff;
}

.close-sidebar-btn {
  display: none; /* Desktop hidden */
}

/* ==========================================================================
   Chat messages & Bubbles
   ========================================================================== */

.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chat-messages {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Message Structure */
.message {
  display: flex;
  gap: 16px;
  animation: fadeInSlide 0.3s ease-out forwards;
}

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

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Avatar styling details */
.message.user-message .message-avatar {
  background: var(--primary-gradient);
  color: var(--text-inverse);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.message.assistant-message .message-avatar {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: #a78bfa;
}

.message.system-message .message-avatar {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
}

/* Content Panel styling */
.message-content {
  flex: 1;
  padding: 16px 20px;
  border-radius: 4px;
  line-height: 1.6;
  font-size: 0.95rem;
  word-break: break-word;
}

.message.user-message .message-content {
  background: var(--msg-user);
  border: 1px solid rgba(175, 154, 125, 0.25);
  color: #ffffff;
}

.message.assistant-message .message-content {
  background: var(--msg-assistant);
  border: 1px solid var(--border-color);
  backdrop-filter: var(--card-blur);
}

.message.system-message .message-content {
  background: var(--msg-system);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

/* Markdown Specific Elements rendering inside message-content */
.message-content p {
  margin-bottom: 12px;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content pre {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  padding: 14px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 12px 0;
}

.message-content code {
  background: rgba(0, 0, 0, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  color: #f472b6;
}

.message-content pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  color: #a78bfa;
}

.message-content h1, 
.message-content h2, 
.message-content h3 {
  margin-top: 16px;
  margin-bottom: 8px;
}

.message-content h1 { font-size: 1.4rem; }
.message-content h2 { font-size: 1.25rem; }
.message-content h3 { font-size: 1.1rem; }

.message-content ul, 
.message-content ol {
  margin-left: 20px;
  margin-bottom: 12px;
}

.message-content li {
  margin-bottom: 6px;
}

/* ==========================================================================
   Generated Image Container & Overlay
   ========================================================================== */

.image-output-container {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  margin-top: 12px;
  border: 1px solid var(--border-color);
  display: inline-block;
  max-width: 100%;
}

.image-output-container img {
  display: block;
  max-width: 100%;
  max-height: 512px;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.image-output-container:hover img {
  transform: scale(1.02);
}

.image-actions-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  backdrop-filter: blur(4px);
  transition: opacity 0.3s ease;
}

.image-output-container:hover .image-actions-overlay {
  opacity: 1;
}

.action-overlay-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-smooth);
}

.action-overlay-btn:hover {
  background: #ffffff;
  color: #000000;
  transform: translateY(-2px);
}

/* ==========================================================================
   Typing & Loader Indicator
   ========================================================================== */

.chat-loading {
  display: none; /* Control in JS */
  align-items: center;
  gap: 16px;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 0 16px;
}

.typing-indicator {
  display: flex;
  gap: 4px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background-color: var(--primary-color);
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}

.loading-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Input / Toolbar Container
   ========================================================================== */

.input-container {
  padding: 12px 24px 24px 24px;
  max-width: 848px;
  width: 100%;
  margin: 0 auto;
}

.input-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  backdrop-filter: var(--card-blur);
  border-radius: 4px;
  padding: 10px 14px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  transition: var(--transition-smooth);
}

.input-wrapper:focus-within {
  border-color: var(--border-color-focus);
  box-shadow: var(--shadow-glow);
  background: var(--bg-card-hover);
}

.mode-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition-smooth);
}

.mode-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

/* Style active image mode */
.mode-toggle-btn.active {
  background: rgba(236, 72, 153, 0.15);
  border: 1px solid rgba(236, 72, 153, 0.3);
  color: #ec4899;
  box-shadow: 0 0 10px rgba(236, 72, 153, 0.2);
}

.input-wrapper textarea {
  flex: 1;
  background: transparent;
  border: none;
  resize: none;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 8px 4px;
  max-height: 200px;
  outline: none;
}

.input-wrapper textarea::placeholder {
  color: var(--text-muted);
}

.send-btn {
  background: var(--primary-gradient);
  color: var(--text-inverse);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
  transition: var(--transition-smooth);
}

.send-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 16px rgba(139, 92, 246, 0.5);
}

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

.footer-note {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 10px;
}

/* ==========================================================================
   Scrollbar & Utilities
   ========================================================================== */

::-webkit-scrollbar {
  width: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}



/* ==========================================================================
   Responsive Media Queries (Mobile layout support)
   ========================================================================== */

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }

  .sidebar {
    position: absolute;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    transform: translateX(-100%);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.8);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .menu-btn {
    display: flex;
  }

  .close-sidebar-btn {
    display: flex;
  }

  .navbar {
    padding: 0 16px;
  }
}

/* ==========================================================================
   Image Upload & Image-to-Image Preview
   ========================================================================== */

.upload-preview-container {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(22, 24, 45, 0.6);
  border: 1px solid var(--border-color);
  backdrop-filter: var(--card-blur);
  padding: 12px 16px;
  border-radius: 14px;
  margin-bottom: 12px;
  animation: fadeInSlide 0.25s ease-out;
  max-width: fit-content;
}

.upload-preview-wrapper {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.upload-preview-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.delete-preview-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  color: #f87171;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.delete-preview-btn:hover {
  background: #ef4444;
  color: #ffffff;
  transform: scale(1.1);
}

.preview-mode-badge {
  font-size: 0.8rem;
  font-weight: 600;
  color: #f472b6;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(236, 72, 153, 0.12);
  border: 1px solid rgba(236, 72, 153, 0.25);
  padding: 4px 10px;
  border-radius: 6px;
}

/* ==========================================================================
   Gallery / Collection Panel
   ========================================================================== */

.gallery-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 400px;
  height: 100%;
  background-color: var(--bg-sidebar);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 101;
  transform: translateX(100%);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.6);
  transition: var(--transition-smooth);
}

.gallery-panel.active {
  transform: translateX(0);
}

.gallery-header {
  height: var(--navbar-height);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: var(--card-blur);
}

.gallery-header h2 {
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(120deg, #ffffff, #f472b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.close-gallery-btn {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-color);
}

.gallery-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.gallery-empty {
  grid-column: span 2;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 40px;
}

/* Gallery Item Card */
.gallery-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  aspect-ratio: 1;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  transition: var(--transition-smooth);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.gallery-item:hover img {
  transform: scale(1.08);
}

.gallery-item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.3) 60%, transparent 100%);
  opacity: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px;
  backdrop-filter: blur(2px);
  transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-item-overlay {
  opacity: 1;
}

.gallery-item-prompt {
  font-size: 0.72rem;
  color: #ffffff;
  line-height: 1.3;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-item-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gallery-item-date {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.gallery-download-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.gallery-download-btn:hover {
  background: #ffffff;
  color: #000000;
  transform: scale(1.1);
}

.gallery-download-btn i {
  width: 12px;
  height: 12px;
}

/* Responsive adjustment for Mobile */
@media (max-width: 768px) {
  .gallery-panel {
    width: 100%;
  }
}

/* ==========================================================================
   Strength Slider & Gallery Source Controls
   ========================================================================== */

.strength-control {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 200px;
}

.strength-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-main);
  font-weight: 500;
}

.strength-control input[type="range"] {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
}

.strength-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary-color);
  box-shadow: 0 0 5px var(--primary-color);
  transition: transform 0.1s ease;
}

.strength-control input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.strength-help {
  font-size: 0.65rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.gallery-source-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-right: auto;
  margin-left: 8px;
  transition: var(--transition-smooth);
}

.gallery-source-btn:hover {
  background: #ffffff;
  color: #000000;
  transform: scale(1.1);
}

.gallery-source-btn i {
  width: 12px;
  height: 12px;
}

/* ==========================================================================
   Comparison Modal Dialog Overlay styling
   ========================================================================== */

.comparison-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 4, 8, 0.85);
  backdrop-filter: blur(10px);
}

.modal-container {
  position: relative;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  width: 100%;
  max-width: 900px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  z-index: 10;
  max-height: 90vh;
  overflow: hidden;
  animation: modalScaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

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

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.15rem;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.close-modal-btn {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-color);
}

.modal-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Modal Split layout for images comparison */
.modal-images-split {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.modal-image-box {
  position: relative;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  aspect-ratio: 16/10;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-image-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.img-type-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 6px;
  z-index: 2;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.img-type-badge.source {
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #60a5fa;
}

.img-type-badge.generated {
  background: rgba(236, 72, 153, 0.2);
  border: 1px solid rgba(236, 72, 153, 0.4);
  color: #f472b6;
}

/* Modal Prompt Details display styling */
.modal-prompts {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.prompt-detail-group h4 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.prompt-text-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #ffffff;
}

.prompt-text-box.optimized {
  border-color: rgba(139, 92, 246, 0.25);
  background: rgba(139, 92, 246, 0.05);
  color: #c084fc;
}

.modal-footer {
  padding: 18px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.15);
}

/* Media Query Responsive for Modal */
@media (max-width: 640px) {
  .modal-images-split {
    grid-template-columns: 1fr;
  }
  
  .modal-image-box {
    aspect-ratio: 16/11;
  }
}

/* ==========================================================================
   Advanced Prompt Preview & Settings Styling
   ========================================================================== */

/* Settings Select input styling */
.select-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 12px;
  border-radius: 8px;
  outline: none;
  font-size: 0.85rem;
  transition: var(--transition-smooth);
  cursor: pointer;
}

.select-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.15);
}

/* Prompt Preview Overlay Card above footer */
.prompt-preview-overlay {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(22, 24, 45, 0.92);
  border: 1px solid rgba(139, 92, 246, 0.3);
  backdrop-filter: var(--card-blur);
  padding: 16px;
  border-radius: 16px;
  margin-bottom: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: fadeInSlide 0.25s ease-out;
  width: 100%;
  max-width: 600px;
}

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

.preview-badge {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #c084fc;
  display: flex;
  align-items: center;
  gap: 6px;
}

.close-preview-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.close-preview-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.close-preview-btn i {
  width: 14px;
  height: 14px;
}

#optimized-prompt-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: var(--transition-smooth);
}

#optimized-prompt-input:focus {
  border-color: rgba(139, 92, 246, 0.5);
}

.prompt-preview-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.preview-action-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-smooth);
}

.preview-action-btn.cancel {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.preview-action-btn.cancel:hover {
  background: rgba(255, 255, 255, 0.12);
}

.preview-action-btn.confirm {
  background: var(--primary-gradient);
  border: none;
  color: #ffffff;
}

.preview-action-btn.confirm:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.preview-action-btn i {
  width: 14px;
  height: 14px;
}
