/* --- CONFIGURATION & SETUP --- */
:root {
  --primary: #667eea;
  --secondary: #764ba2;
  --bg-dark: #0f0f23;
  --bg-medium: #1a1a2e;
  --bg-light: #2a2a3a;
  --text-primary: #ffffff;
  --text-secondary: #aaaaaa;
  --success: #48bb78;
  --error: #f56565;
  --border: rgba(255, 255, 255, 0.1);
}

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

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* --- MAIN LAYOUT & HEADER --- */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

.header {
  text-align: center;
  margin-bottom: 2rem;
  position: relative;
}

h1 {
  font-size: 2.5rem;
  font-weight: 600;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 0.5rem;
}

.tagline {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

/* --- LANGUAGE SWITCHER --- */
.language-switcher {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 100;
}

.lang-switcher-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-medium);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.lang-switcher-toggle:hover {
  border-color: var(--primary);
}

.lang-switcher-toggle .arrow {
  font-size: 0.8em;
  transition: transform 0.2s;
}

.lang-switcher-toggle.open .arrow {
  transform: rotate(180deg);
}

.lang-switcher-menu {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.5rem;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: all 0.2s ease-out;
}

.lang-switcher-menu.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.lang-switcher-option {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.lang-switcher-option:hover {
  background: var(--primary);
  color: var(--text-primary);
}

.lang-switcher-option.active {
  color: var(--primary);
}

/* --- CONTROL PANEL & FORM --- */
.control-panel {
  background: var(--bg-medium);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.prompt-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-group {
  position: relative;
}

.input-group input {
  width: 100%;
  background: var(--bg-light);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* --- NEW TOOLBOX STYLES --- */
.toolbox-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.toolbox-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toolbox-item label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.toolbox-item input {
  width: 80px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
  color: var(--text-primary);
  text-align: center;
}

.toolbox-item input:focus {
  outline: none;
  border-color: var(--primary);
}

.toolbox-actions {
  display: flex;
  gap: 0.75rem;
  margin-left: auto;
  /* Push buttons to the right */
}

/* --- BUTTONS --- */
.btn {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
  padding: 0.625rem 1.5rem;
  /* Adjust padding for border */
}

.btn-outline:hover {
  background: var(--primary);
  color: white;
}

.btn-danger {
  background: transparent;
  border: 1px solid var(--error);
  color: var(--error);
  padding: 0.5rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
}

.btn-danger:hover {
  background: var(--error);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}


.btn-action {
  background: transparent;
  border: 1px solid #667EEA;
  color: #667EEA;
  padding: 0.5rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
}

.btn-action:hover {
  background: #667EEA;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* --- TOOLBAR, TABS & BANNER --- */
.gallery-toolbar {


}

.banner {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 500;
}

.banner-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.banner-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.2rem;
  cursor: pointer;
  transition: color 0.2s;
  padding: 0.25rem;
  line-height: 1;
}

.banner-close:hover {
  color: white;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: 0.75rem 1.25rem;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text-secondary);
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}

.tab:hover {
  background: var(--bg-light);
}

.tab.active {
  font-weight: 600;
  color: var(--text-primary);
  border-bottom-color: var(--primary);
}

/* --- GALLERY & IMAGES --- */
.image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.image-card {
  background: var(--bg-medium);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
  display: flex;
  flex-direction: column;
  position: relative;
}

.image-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.image-card.featured {
  grid-column: span 2;
}

.image-display {
  aspect-ratio: 1/1;
  position: relative;
  background: var(--bg-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-display img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s;
}

.image-info {
  padding: 1rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.image-prompt {
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  display: -webkit-box;

  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-grow: 1;
}

.image-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.image-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 0.5rem;
  z-index: 10;
}

.action-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn:hover {
  transform: scale(1.1);
  background: rgba(0, 0, 0, 0.8);
}

.action-btn.delete:hover {
  background: rgba(255, 0, 0, 0.8);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  position: relative;

}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1rem;
  padding: 3rem;
  grid-column: 1 / -1;
  color: var(--text-secondary);
  border: 2px dashed var(--border);
  border-radius: 16px;
}

.empty-state-icon {
  font-size: 3rem;
}

/* --- OVERLAYS (TOASTS & LIGHTBOX) --- */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.toast {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-radius: 10px;
  background: var(--bg-medium);
  border-left: 4px solid var(--primary);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  transform: translateX(calc(100% + 20px));
  opacity: 0;
  animation: toast-in 0.5s forwards cubic-bezier(0.25, 1, 0.5, 1);
}

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--error);
}

.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.lightbox.active {
  opacity: 1;
  pointer-events: all;
}

.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
}

.lightbox-image {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: -10px;
  right: -10px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  color: white;
  font-size: 1.2rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s;
}

.lightbox-close:hover {
  transform: scale(1.1);
}

/* --- ANIMATIONS & MEDIA QUERIES --- */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes toast-in {
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@media (max-width: 860px) {
  .language-switcher {
    position: static;
    justify-content: center;
    margin-bottom: 1.5rem;
  }

  .header {
    padding-top: 0;
  }



  .toolbox-actions {
    margin-left: 0;
    width: 100%;
  }

  .toolbox-actions .btn {
    flex-grow: 1;
  }
}

@media (max-width: 768px) {
  .app-layout {
    padding: 1rem;
  }

  .image-gallery {
    grid-template-columns: 1fr;
  }


  .image-card.featured {
    grid-column: span 1;
  }
}

