:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #f6f7fb;
  --card: #ffffff;
  --border: #dbe0eb;
  --text: #1d1f2a;
  --muted: #5d6372;
  --accent: #1f66ff;
  --accent-solid: #1f66ff;
  --lime: #1f66ff;
  --magenta: #1f66ff;
  font-family: 'Poppins', sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.gradient-overlay {
  display: none;
}

.container {
  width: min(1080px, 92vw);
  margin: 0 auto;
}

.site-header {
  padding: 24px 0 12px 0;
}

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

.logo {
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 600;
  color: var(--text);
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  margin-right: 20px;
}

.nav-links a:last-child {
  margin-right: 0;
}

.nav-links a:hover {
  color: var(--accent);
}

.cta-pill {
  padding: 6px 16px;
  border-radius: 999px;
  background: #eef1ff;
  color: var(--accent);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: center;
  gap: 32px;
  padding: 36px 0 24px 0;
}

.hero-copy h1 {
  font-size: clamp(2.4rem, 4vw, 3rem);
  line-height: 1.1;
  margin-bottom: 16px;
}

.hero-copy p {
  color: var(--muted);
  max-width: 520px;
  line-height: 1.6;
}

.hero-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 24px 48px rgba(15, 33, 70, 0.08);
}

.hero-card p.card-subtitle {
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.hero-card ol {
  margin: 0;
  padding-left: 20px;
  line-height: 1.6;
  color: var(--muted);
}

.panel {
  margin-top: 40px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 26px 52px rgba(18, 32, 75, 0.1);
}

.studio-form .form-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-card h2 {
  margin: 0;
  font-size: 1.2rem;
}

label {
  font-size: 0.9rem;
  font-weight: 500;
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  font-size: 0.95rem;
}

input[type="file"] {
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: #ffffff;
  color: var(--muted);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
}

textarea {
  resize: vertical;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
  margin-top: -8px;
}

.upload-previews {
  margin-top: 16px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.upload-previews figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  position: relative;
}

.upload-previews img {
  width: 96px;
  height: 96px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.upload-previews figcaption {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.delete-upload {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e74c3c;
  color: white;
  border: 2px solid white;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.delete-upload:hover {
  background: #c0392b;
  transform: scale(1.1);
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox input {
  width: auto;
}

.scene-presets {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scene-presets .preset-label {
  margin: 0;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.scene-presets .preset-hint {
  margin: 0;
  font-size: 0.78rem;
  color: #7a8190;
}

.scene-options {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.scene-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #f2f4fb;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.scene-option:hover {
  border-color: var(--accent);
  box-shadow: 0 10px 20px rgba(31, 102, 255, 0.08);
}

.scene-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.scene-option .scene-thumb {
  width: 70px;
  height: 70px;
  border-radius: 12px;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  border: 2px solid transparent;
  transition: border-color 0.2s ease;
}

.scene-option .scene-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.scene-option .scene-title {
  font-weight: 600;
  color: var(--text);
}

.scene-option p {
  margin: 0;
  font-size: 0.78rem;
  color: #6a7284;
  line-height: 1.4;
}

.scene-option input:checked + .scene-thumb {
  border-color: var(--accent);
}

.scene-option input:checked + .scene-thumb + .scene-info .scene-title {
  color: var(--accent);
}

.scene-thumb--custom {
  background-image: linear-gradient(135deg, #e8ecf9, #f6f7fb);
}

.scene-thumb--studio {
  background-image: linear-gradient(135deg, #d8d9dd, #f4f4f7);
}

.scene-thumb--lifestyle {
  background-image: linear-gradient(135deg, #efe5d6, #f9f5ed);
}

.scene-thumb--flatlay {
  background-image: linear-gradient(135deg, #fbeee6, #f7e8e0);
}

.scene-thumb--outdoor {
  background-image: linear-gradient(135deg, #dbece3, #f0f6f2);
}

.scene-thumb--abstract {
  background-image: radial-gradient(circle at 60% 40%, #5c6fde, #1f1f35 70%);
}

.scene-thumb--person {
  background-image: linear-gradient(135deg, #ffe0d6, #fff2ec);
}

.scene-thumb--product {
  background-image: linear-gradient(135deg, #e6f4f8, #f5fcff);
}

.credit-counter {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 500;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.credit-counter #credit-count {
  font-weight: 700;
  font-size: 16px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logout-btn {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: background 0.2s ease;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-group.compact {
  gap: 8px;
}

.radio {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f2f4fb;
  border: 1px solid var(--border);
}

.radio input {
  accent-color: var(--accent);
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}

.chip {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  display: inline-block;
}

.chip-lime,
.chip-magenta {
  background: var(--accent);
}

.custom-size {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.primary-btn {
  margin-top: 16px;
  background: var(--accent);
  border: none;
  color: #ffffff;
  font-weight: 400;
  padding: 14px 20px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(31, 102, 255, 0.25);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.action-btn,
.secondary-btn {
  background: var(--accent);
  border: none;
  color: #ffffff;
  font-weight: 400;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-size: 1.2rem;
  margin: 4px;
  min-width: 48px;
}

.action-btn:hover,
.secondary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(31, 102, 255, 0.2);
}

.action-btn--danger {
  background: #f47b7b;
}

.action-btn--danger:hover {
  box-shadow: 0 12px 24px rgba(244, 123, 123, 0.25);
}

/* Prompt library styles */
.prompt-library {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.prompt-library h3 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 1rem;
  font-weight: 500;
}

.saved-prompts {
  margin-bottom: 20px;
}

.saved-prompt-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin-bottom: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: background 0.2s ease;
}

.saved-prompt-item:hover {
  background: #f8f9ff;
}

.prompt-name {
  font-size: 0.95rem;
  color: var(--text);
  flex: 1;
}

.prompt-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  position: relative;
  z-index: 10;
}

.prompt-action-btn {
  background: var(--accent);
  border: none;
  color: #ffffff;
  font-weight: 400;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1.1rem;
  min-width: 40px;
}

.prompt-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(31, 102, 255, 0.2);
}

.prompt-delete-btn {
  background: #f47b7b;
  min-width: 36px;
  font-size: 1.2rem;
  padding: 6px 10px;
}

.prompt-delete-btn:hover {
  box-shadow: 0 8px 16px rgba(244, 123, 123, 0.25);
}

.save-prompt-form {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 16px;
}

.save-prompt-form input {
  flex: 1;
}

.login-panel {
  max-width: 480px;
  margin: 120px auto;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-form h1 {
  margin: 0;
  font-size: 1.8rem;
}

.login-copy {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-top: -6px;
}

.flash-stack {
  margin-bottom: 24px;
  display: grid;
  gap: 12px;
}

.flash {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.9rem;
  background: #f1f4ff;
  border: 1px solid var(--border);
  color: var(--text);
}

.flash-error {
  border-color: #f47b7b;
  background: #fdecec;
}

.flash-warning {
  border-color: #f5c26b;
  background: #fff5e4;
}

.output-panel {
  margin-bottom: 60px;
}

.output-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.preview-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  min-height: 260px;
}

.preview-card h3 {
  margin-top: 0;
}

.preview-card img {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border);
  margin-top: 8px;
}

.preview-card.featured {
  background: #f1f4ff;
  grid-column: 1 / -1;
}

.preview-card.featured img {
  max-height: 600px;
  object-fit: contain;
  margin-left: auto;
  margin-right: auto;
  background: #ffffff;
  border: 1px solid var(--border);
}

.gallery-card {
  grid-column: 1 / -1;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 12px;
}

.gallery-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gallery-preview {
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.gallery-preview .gallery-main {
  display: block;
  width: 100%;
  border-radius: 12px;
  border: none;
}

.gallery-hover-action {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 6px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.gallery-preview:hover .gallery-hover-action {
  opacity: 1;
  pointer-events: auto;
}

.hover-action-btn {
  background: var(--accent);
  border: none;
  color: #ffffff;
  font-weight: 400;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hover-action-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 16px rgba(31, 102, 255, 0.3);
}

.hover-action-link {
  text-decoration: none;
  display: inline-block;
}

.gallery-source {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f6f7fb;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}

.gallery-source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gallery-source img {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  border: 1px solid var(--border);
  object-fit: cover;
}

.gallery-source-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* Gallery crop highlight */
.gallery-crop-highlight {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fff4e6;
  border: 2px dashed #ff9800;
  border-radius: 12px;
  padding: 10px 12px;
  position: relative;
}

.crop-highlight-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #e65100;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.crop-highlight-preview {
  position: relative;
  display: inline-block;
  max-width: fit-content;
}

.crop-highlight-preview img {
  max-width: 150px;
  max-height: 150px;
  border-radius: 10px;
  border: 2px solid #ff9800;
  object-fit: contain;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background: white;
}

.crop-highlight-preview img:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(255, 152, 0, 0.3);
}

.crop-info-overlay {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(230, 81, 0, 0.9);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  pointer-events: none;
}

.gallery-delete {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

.delete-btn {
  background: transparent;
  border: 1px solid #e08a8a;
  color: #d04a4a;
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.delete-btn:hover {
  background: #ffe3e3;
  color: #b53030;
}

.gallery-meta {
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.gallery-prompt {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.4;
}

.gallery-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* Retry versions section */
.gallery-retries {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f6f7fb;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}

.retry-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

.retry-versions-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.retry-versions-list img {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  border: 1px solid var(--border);
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.retry-versions-list img:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(31, 102, 255, 0.15);
  border-color: var(--accent);
}

/* Gallery source images */
.gallery-source-list img {
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-source-list img:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(31, 102, 255, 0.15);
}

.gallery-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 28, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 350;
  padding: 40px;
}

.gallery-overlay.visible {
  display: flex;
}

.gallery-overlay__content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 30px 60px rgba(12, 24, 58, 0.4);
}

.gallery-overlay__img {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  border-radius: 12px;
}

.gallery-overlay__close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  color: #1d1f2a;
  font-size: 1.5rem;
  padding: 4px 8px;
  cursor: pointer;
}

/* Batch Management Styles */
.batch-selector {
  display: flex;
  gap: 8px;
  align-items: center;
}

.batch-selector select {
  flex: 1;
  min-width: 0;
}

.batch-selector .secondary-btn {
  flex-shrink: 0;
  padding: 8px 14px;
  font-size: 1.1rem;
  line-height: 1;
  min-width: 40px;
}

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 24px;
  padding: 20px;
  background: #f6f7fb;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 200px;
  flex: 1;
}

.filter-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-group select {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 102, 255, 0.1);
}

.gallery-filters .secondary-btn {
  align-self: flex-end;
  white-space: nowrap;
}

/* Batch management buttons in gallery items */
.batch-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.batch-actions button {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.batch-actions button:hover {
  background: #f6f7fb;
  border-color: var(--accent);
  color: var(--accent);
}

.batch-badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  background: #e6eeff;
  color: var(--accent);
  text-transform: none;
  letter-spacing: 0.05em;
  margin-left: 8px;
  vertical-align: middle;
}

.category-badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
  margin-left: 6px;
}

.category-badge.pending {
  background: #fff3cd;
  color: #856404;
}

.category-badge.approved {
  background: #d4edda;
  color: #155724;
}

.category-badge.rejected {
  background: #f8d7da;
  color: #721c24;
}

.category-badge.favorite {
  background: #e6eeff;
  color: #1f66ff;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .gallery-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-group {
    min-width: 100%;
  }

  .batch-selector {
    flex-direction: row;
  }

  .batch-selector select {
    flex: 1;
  }
}

/* Crop Modal Styles */
.crop-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 28, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 400;
  padding: 20px;
}

.crop-modal.visible {
  display: flex;
}

.crop-modal__content {
  background: #ffffff;
  border-radius: 16px;
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 80px rgba(12, 24, 58, 0.5);
}

.crop-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.crop-modal__header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}

.crop-modal__close {
  background: transparent;
  border: none;
  color: #1d1f2a;
  font-size: 1.75rem;
  padding: 0;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.crop-modal__close:hover {
  background: #f6f7fb;
}

.crop-modal__instruction {
  background: linear-gradient(135deg, #e3f2fd 0%, #f1f8ff 100%);
  border-left: 4px solid #1976d2;
  padding: 16px 24px;
  margin: 0;
  border-bottom: 1px solid #bbdefb;
}

.crop-instruction-text {
  margin: 0;
  color: #0d47a1;
  font-size: 0.9rem;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.instruction-icon {
  font-size: 1.1rem;
  margin-right: 8px;
  vertical-align: middle;
}

.crop-instruction-text strong {
  color: #0d47a1;
  font-weight: 600;
}

.instruction-detail {
  font-size: 0.85rem;
  color: #1565c0;
  padding-left: 30px;
  font-style: italic;
}

.crop-modal__body {
  flex: 1;
  overflow: hidden;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.crop-container {
  max-width: 100%;
  max-height: 60vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.crop-container img {
  max-width: 100%;
  max-height: 60vh;
  display: block;
}

.crop-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid var(--border);
}

.crop-modal__footer .secondary-btn,
.crop-modal__footer .primary-btn {
  margin: 0;
}

/* Crop button for upload previews */
.crop-upload-btn {
  position: absolute;
  bottom: 8px;
  left: 8px;
  padding: 6px 12px;
  font-size: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  backdrop-filter: blur(4px);
}

.crop-upload-btn:hover {
  background: #ffffff;
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(31, 102, 255, 0.2);
}

/* Make upload preview figures relative for absolute crop button */
[data-upload-previews] figure {
  position: relative;
}

/* Crop applied badge */
.crop-applied-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 4px;
  background: rgba(76, 175, 80, 0.95);
  color: white;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  z-index: 10;
}

/* Responsive crop modal */
@media (max-width: 768px) {
  .crop-modal__content {
    width: 95%;
    max-height: 95vh;
  }

  .crop-modal__header {
    padding: 16px;
  }

  .crop-modal__instruction {
    padding: 12px 16px;
  }

  .crop-instruction-text {
    font-size: 0.85rem;
  }

  .instruction-detail {
    padding-left: 20px;
    font-size: 0.8rem;
  }

  .crop-modal__body {
    padding: 16px;
  }

  .crop-container {
    max-height: 50vh;
  }

  .crop-container img {
    max-height: 50vh;
  }

  .crop-modal__footer {
    padding: 16px;
    flex-direction: column-reverse;
  }

  .crop-modal__footer .secondary-btn,
  .crop-modal__footer .primary-btn {
    width: 100%;
  }
}

.caption {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 10px;
}

.placeholder {
  color: #9aa1b3;
  font-size: 0.9rem;
  line-height: 1.5;
}

.context-card {
  margin-top: 16px;
  padding: 16px;
  border-radius: 14px;
  background: #f1f4ff;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.5;
}

.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
  color: var(--text);
}

.timeline li::before {
  content: '▸';
  margin-right: 8px;
  color: var(--accent);
}

.download-btn {
  display: inline-block;
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--accent);
  color: #ffffff;
  text-decoration: none;
  font-weight: 500;
  transition: box-shadow 0.2s ease;
}

.download-btn:hover {
  box-shadow: 0 12px 24px rgba(31, 102, 255, 0.2);
}

.site-footer {
  padding: 32px 0 48px 0;
  color: #5d6372;
  font-size: 0.85rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.footer-meta {
  opacity: 0.6;
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-copy p {
    margin: 0 auto;
  }

  .hero-card {
    text-align: left;
  }

  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-links {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

.input-panel.hidden {
  display: none;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(3px);
  transition: opacity 0.25s ease;
}

.loading-overlay.visible {
  display: flex;
}

.loading-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: 0 30px 60px rgba(18, 32, 75, 0.15);
}

.spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 4px solid rgba(31, 102, 255, 0.2);
  border-top-color: var(--accent);
  border-right-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
  .preview-card.featured {
    grid-column: 1 / -1;
  }

/* Pagination styles */
.pagination {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.pagination-info {
  font-size: 14px;
  color: var(--muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.pagination-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.pagination-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(31, 102, 255, 0.2);
}

.pagination-btn.pagination-current {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  cursor: default;
  font-weight: 700;
}

.pagination-btn.pagination-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: #f5f5f5;
}

.pagination-btn.pagination-disabled:hover {
  background: #f5f5f5;
  color: var(--text);
  border-color: var(--border);
  transform: none;
  box-shadow: none;
}

.pagination-ellipsis {
  padding: 0 8px;
  color: var(--muted);
}

@media (max-width: 768px) {
  .pagination-controls {
    gap: 4px;
  }

  .pagination-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    font-size: 13px;
  }
}

/* EAN Search Styles */
.ean-search-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.ean-search-row input[type="text"] {
  flex: 1;
}

.ean-search-row .secondary-btn {
  white-space: nowrap;
  padding: 0 16px;
}

.ean-search-results {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg-soft);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.ean-product-title {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.ean-product-title strong {
  font-size: 1.1rem;
  color: var(--text);
}

.ean-product-title small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.ean-images-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.ean-image-item {
  position: relative;
  margin: 0;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color 0.2s, transform 0.2s;
  background: var(--card);
}

.ean-image-item:hover {
  transform: scale(1.02);
}

.ean-image-item.selected {
  border-color: var(--accent);
}

.ean-image-item img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  background: white;
}

.ean-image-item figcaption {
  display: none;
  text-align: center;
  background: var(--bg-soft);
}

.ean-image-checkbox {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: transparent;
  transition: all 0.2s;
}

.ean-image-item.selected .ean-image-checkbox {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.ean-search-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  color: var(--muted);
}

.spinner-small {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.hidden {
  display: none !important;
}

/* =============================================================================
   BATCH MODE STYLES
   ============================================================================= */

.batch-btn {
  margin-left: 8px;
}

/* Batch Modal Base */
.batch-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.batch-modal.visible {
  opacity: 1;
  visibility: visible;
}

.batch-modal__content {
  background: var(--card);
  border-radius: 12px;
  width: min(560px, 95vw);
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.batch-modal__content--progress {
  width: min(480px, 95vw);
}

.batch-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.batch-modal__header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.batch-modal__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: 4px;
}

.batch-modal__close:hover {
  color: var(--text);
}

.batch-modal__body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.batch-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

/* Batch Form */
.batch-form-group {
  margin-bottom: 16px;
}

.batch-form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.batch-form-group textarea,
.batch-form-group input[type="text"],
.batch-form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg);
}

.batch-form-group textarea:focus,
.batch-form-group input:focus,
.batch-form-group select:focus {
  outline: none;
  border-color: var(--accent);
}

.batch-form-row {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 16px;
}

/* Batch Validation Results */
.batch-validation {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.batch-validation__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 500;
}

.batch-credits-info {
  font-size: 0.85rem;
  color: var(--muted);
}

.batch-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.batch-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-soft);
  border-radius: 8px;
}

.batch-item--valid {
  border-left: 3px solid #22c55e;
}

.batch-item--invalid {
  border-left: 3px solid #ef4444;
  background: #fef2f2;
}

.batch-item__thumb {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 4px;
  background: white;
}

.batch-item__info {
  flex: 1;
  min-width: 0;
}

.batch-item__name {
  display: block;
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.batch-item__ean {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  font-family: monospace;
}

.batch-item__status {
  color: #22c55e;
  font-weight: bold;
}

.batch-item__error {
  color: #ef4444;
  font-size: 0.85rem;
}

.batch-invalid-list {
  margin-top: 12px;
}

.batch-invalid-header {
  font-size: 0.85rem;
  color: #ef4444;
  margin-bottom: 8px;
  font-weight: 500;
}

/* Batch Progress Modal */
.batch-progress-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 500;
}

.batch-progress-bar {
  height: 8px;
  background: var(--bg-soft);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 16px;
}

.batch-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.batch-progress-current {
  text-align: center;
  padding: 12px;
  background: var(--bg-soft);
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.95rem;
}

.batch-progress-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 16px;
}

.batch-progress-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-soft);
  border-radius: 6px;
  font-size: 0.9rem;
}

.batch-progress-item__status {
  width: 24px;
  text-align: center;
}

.batch-progress-item__status[data-status="completed"] {
  color: #22c55e;
}

.batch-progress-item__status[data-status="failed"] {
  color: #ef4444;
}

.batch-progress-item__status[data-status="processing"] {
  animation: pulse 1s infinite;
}

.batch-progress-item__status[data-status="skipped"] {
  color: #f59e0b;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.batch-progress-item__name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.batch-error-msg {
  color: #ef4444;
  font-size: 0.8rem;
}

.batch-progress-summary {
  display: flex;
  justify-content: center;
  gap: 24px;
  font-size: 0.9rem;
  color: var(--muted);
}

.summary-completed strong {
  color: #22c55e;
}

.summary-failed strong {
  color: #ef4444;
}
