/* ==========================================================================
   Design System & Styling for Discogs Cover Downloader
   Theme: Vintage Hi-Fi Lounge / Warm Vinyl Retro (80s & 90s inspired)
   ========================================================================== */

:root {
  /* Colors */
  --bg-color: #14110f; /* Warm dark espresso */
  --panel-bg: rgba(29, 25, 22, 0.65); /* Warm dark tinted glass */
  --panel-border: rgba(215, 195, 176, 0.12);
  --panel-border-hover: rgba(217, 160, 91, 0.4);
  
  --text-primary: #f7f0e9; /* Cream vanilla */
  --text-secondary: #cab8aa; /* Warm grey/tan */
  --text-muted: #8e7e72; /* Muted brown */
  
  --accent-gold: #d9a05b; /* Brushed Gold */
  --accent-orange: #e0533c; /* Vintage Hi-Fi Orange */
  --accent-gradient: linear-gradient(135deg, #e0533c 0%, #d9a05b 100%);
  --accent-glow: rgba(217, 160, 91, 0.3);
  
  --success: #10b981;
  --error: #f43f5e;
  --warning: #fbbf24;
  
  /* Fonts */
  --font-family-sans: 'Outfit', sans-serif;
  --font-family-serif: 'DM Serif Display', serif;
  --font-family: var(--font-family-sans);
  
  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
}

/* Ambient Background Orbs */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -1;
  opacity: 0.12;
  pointer-events: none;
}

.orb-1 {
  top: -10%;
  left: -10%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, var(--accent-orange) 0%, transparent 70%);
}

.orb-2 {
  bottom: -10%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, var(--accent-gold) 0%, transparent 70%);
}

.orb-3 {
  top: 40%;
  right: 20%;
  width: 35vw;
  height: 35vw;
  background: radial-gradient(circle, #a16207 0%, transparent 70%);
  opacity: 0.05;
}

/* Main Container Layout */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  position: relative;
  gap: 2rem;
  flex-wrap: wrap;
}

.logo-area {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.25rem;
}

.logo h1 {
  font-family: var(--font-family-serif);
  font-size: 2.5rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.disc-icon {
  font-size: 2.4rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: spin 8s linear infinite;
}

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

/* Header Settings Dropdown */
.header-settings {
  position: relative;
}

.settings-toggle-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  color: var(--text-primary);
  padding: 0.75rem 1.25rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
}

.settings-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.2);
}

.settings-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.75rem;
  width: 350px;
  z-index: 100;
  background: rgba(13, 14, 28, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
  animation: fadeIn var(--transition-fast) forwards;
}

.settings-dropdown .section-title h3 {
  font-size: 1.1rem;
}

/* Centered Search Section */
.search-hero-container {
  display: flex;
  justify-content: center;
  margin-bottom: 3rem;
  width: 100%;
}

.search-form-center {
  width: 100%;
  max-width: 700px;
}

.search-bar-wrapper {
  display: flex;
  align-items: center;
  background: rgba(20, 22, 37, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 100px;
  padding: 0.4rem 0.5rem 0.4rem 1.5rem;
  transition: all var(--transition-normal);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.search-bar-wrapper:focus-within {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.25);
  background: rgba(20, 22, 37, 0.75);
}

.search-bar-icon {
  color: var(--accent-cyan);
  font-size: 1.15rem;
  margin-right: 0.75rem;
}

.search-bar-wrapper input {
  flex-grow: 1;
  border: none !important;
  background: transparent !important;
  padding: 0.6rem 0;
  font-size: 1rem;
  color: var(--text-primary);
}

.search-bar-wrapper input:focus {
  outline: none;
  box-shadow: none !important;
}

.search-bar-wrapper .primary-btn {
  border-radius: 100px;
  padding: 0.6rem 1.75rem;
}

/* Main Workspace Full-Width Layout */
.app-main {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  flex-grow: 1;
  width: 100%;
}

/* Glassmorphism Panel Base */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  transition: border-color var(--transition-normal);
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

/* Control Panel (Left Column) */
.control-panel {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  align-self: start;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.section-title i {
  color: var(--accent-cyan);
  font-size: 1.25rem;
}

.section-title h2 {
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.panel-divider {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--panel-border) 20%, var(--panel-border) 80%, transparent);
}

/* Form Styles */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.input-wrapper, .search-input-wrapper {
  position: relative;
  display: flex;
  gap: 0.5rem;
}

input[type="text"], input[type="password"] {
  width: 100%;
  background: rgba(10, 11, 21, 0.6);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}

input[type="text"]:focus, input[type="password"]:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.15);
  background: rgba(10, 11, 21, 0.8);
}

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  color: var(--text-secondary);
  padding: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.help-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  line-height: 1.4;
}

.help-text a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.help-text a:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  margin-top: 0.5rem;
  border: 1px solid transparent;
}

.status-badge.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
  border-color: rgba(239, 68, 68, 0.2);
}

.status-badge.success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.2);
}

/* Buttons */
.primary-btn {
  background: var(--accent-gradient);
  border: none;
  border-radius: 12px;
  color: #fff;
  padding: 0.75rem 1.5rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 15px rgba(127, 0, 255, 0.3);
}

.primary-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 242, 254, 0.4);
}

.primary-btn:active:not(:disabled) {
  transform: translateY(0);
}

.primary-btn:disabled {
  background: var(--text-muted);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.5;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  color: var(--text-primary);
  padding: 0.75rem 1.5rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
}

.secondary-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--text-secondary);
}

.wide-btn {
  width: 100%;
}

.search-input-wrapper {
  flex-direction: column;
}

@media (min-width: 480px) {
  .search-input-wrapper {
    flex-direction: row;
  }
  .search-input-wrapper input {
    flex-grow: 1;
  }
}

/* Results Panel (Right Column) */
.results-panel {
  display: flex;
  flex-direction: column;
  min-height: 500px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 1rem;
}

.panel-header h2 {
  font-family: var(--font-family-serif);
  font-size: 1.8rem;
  font-weight: 400;
}

.badge {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--panel-border);
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.badge-accent {
  background: rgba(0, 242, 254, 0.1);
  border: 1px solid rgba(0, 242, 254, 0.3);
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-cyan);
}

/* State Views (Initial, Loading, Empty, Error) */
.state-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
  animation: fadeIn var(--transition-normal) forwards;
}

.state-view i {
  font-size: 3.5rem;
  margin-bottom: 1.5rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.state-view .error-icon {
  background: none;
  -webkit-text-fill-color: initial;
  color: var(--error);
}

.state-view h3 {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.state-view p {
  font-size: 0.95rem;
  max-width: 400px;
}

.hidden {
  display: none !important;
}

/* Spinner Custom Animation */
.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(0, 242, 254, 0.1);
  border-top: 3px solid var(--accent-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1.5rem;
}

/* Results Grid */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
  animation: fadeIn var(--transition-normal) forwards;
}

/* Release Card */
.release-card {
  background: rgba(10, 11, 21, 0.4);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
}

.release-card:hover {
  transform: translateY(-6px);
  border-color: var(--panel-border-hover);
  box-shadow: 0 12px 30px rgba(0, 242, 254, 0.12);
  background: rgba(20, 22, 37, 0.6);
}

.card-img-wrapper {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  background: #111222;
  overflow: hidden;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-normal);
}

.release-card:hover .card-img {
  transform: scale(1.05);
}

.card-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.card-img-placeholder i {
  font-size: 3rem;
}

.card-content {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex-grow: 1;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  /* Multi-line clamp */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-artist {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: auto;
  display: flex;
  justify-content: space-between;
}

/* Modal Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 5, 10, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  width: 100%;
  max-width: 1100px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  background: rgba(20, 22, 37, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transform: scale(0.95);
  transition: transform var(--transition-normal);
}

.modal-overlay:not(.hidden) .modal-container {
  transform: scale(1);
}

.close-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all var(--transition-fast);
  z-index: 10;
}

.close-btn:hover {
  background: var(--error);
  color: #fff;
  border-color: var(--error);
}

.modal-release-header {
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 1.5rem;
}

#modal-release-title {
  font-family: var(--font-family-serif);
  font-size: 2.2rem;
  font-weight: 400;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.25rem;
}

#modal-release-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  font-weight: 300;
}

/* Downloader Split Workspace */
.downloader-workspace {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2rem;
}

@media (max-width: 820px) {
  .downloader-workspace {
    grid-template-columns: 1fr;
  }
}

.gallery-column h3, .download-control-column h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 0.5rem;
}

.gallery-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4rem;
  color: var(--text-secondary);
}

/* Images Grid Gallery */
.images-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

/* Gallery Item Card */
.gallery-item {
  position: relative;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(10, 11, 21, 0.4);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.gallery-item:hover {
  border-color: var(--accent-cyan);
}

.gallery-item.selected {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.3);
}

.gallery-img-wrapper {
  aspect-ratio: 1/1;
  width: 100%;
  background: #111222;
}

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

.gallery-item-footer {
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.3);
}

.item-type-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.item-type-label.primary {
  background: rgba(0, 242, 254, 0.15);
  color: var(--accent-cyan);
}

.item-type-label.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.item-resolution {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Checkbox Overlay in Gallery Item */
.item-select-checkbox {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(10, 11, 21, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: all var(--transition-fast);
  z-index: 2;
}

.gallery-item.selected .item-select-checkbox {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: #0b0c15;
}

/* Download Individual Button Overlay */
.item-download-direct {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(10, 11, 21, 0.7);
  border: 1px solid var(--panel-border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all var(--transition-fast);
  z-index: 2;
}

.gallery-item:hover .item-download-direct {
  opacity: 1;
}

.item-download-direct:hover {
  background: var(--accent-cyan);
  color: #0b0c15;
  border-color: var(--accent-cyan);
}

/* Download control panel */
.download-summary-card {
  background: rgba(10, 11, 21, 0.4);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  margin-bottom: 1rem;
}

.summary-details {
  border-top: 1px solid var(--panel-border);
  border-bottom: 1px solid var(--panel-border);
  padding: 1rem 0;
  margin-bottom: 1.5rem;
  max-height: 200px;
  overflow-y: auto;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.no-selection-msg {
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
  padding: 1rem 0;
}

.summary-item-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
}

.summary-item-row i {
  color: var(--success);
  font-size: 0.8rem;
}

.download-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Tips Card */
.tip-card {
  background: rgba(0, 242, 254, 0.03);
  border: 1px solid rgba(0, 242, 254, 0.1);
  border-radius: 16px;
  padding: 1.25rem;
}

.tip-card h4 {
  font-size: 0.9rem;
  color: var(--accent-cyan);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tip-card p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Footer Styling */
.app-footer {
  text-align: center;
  margin-top: auto;
  padding-top: 3rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Keyframes & Animations */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

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

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(10, 11, 21, 0.6);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  transition: background var(--transition-fast);
}

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

/* ==========================================================================
   Print Modal & Print Styles
   ========================================================================== */

.print-modal-container {
  max-width: 900px;
}

.print-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: start;
}

@media (max-width: 768px) {
  .print-settings-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* Select element */
.custom-select {
  width: 100%;
  background: rgba(10, 11, 21, 0.6);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  color: var(--text-primary);
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.2em;
  cursor: pointer;
}

.custom-select:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.15);
}

.custom-select option {
  background-color: #0f1121;
  color: var(--text-primary);
}

.form-group-row {
  display: flex;
  gap: 1rem;
  animation: fadeIn var(--transition-fast) forwards;
}

.form-group-row.hidden {
  display: none !important;
}

.half-width {
  flex: 1;
}

.print-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* Print Preview Column */
.print-preview-column h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 0.5rem;
}

.print-preview-visual-card {
  background: rgba(10, 11, 21, 0.4);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 250px;
  margin-bottom: 1.25rem;
}

/* Layout visuals styles */
.preview-layout-duplex {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  width: 100%;
}

.preview-layout-duplex .preview-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  max-width: 130px;
}

.preview-layout-fold {
  display: flex;
  gap: 0;
  border: 1px dashed rgba(0, 242, 254, 0.4);
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  position: relative;
  border-radius: 8px;
  width: 100%;
  max-width: 300px;
  justify-content: center;
}

.preview-layout-fold::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  border-left: 1px dashed rgba(255, 255, 255, 0.3);
}

.preview-layout-fold .preview-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 110px;
  padding: 0.25rem;
}

.preview-layout-single {
  display: flex;
  justify-content: center;
  width: 100%;
}

.preview-layout-single .preview-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 160px;
  width: 100%;
}

.preview-page-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.preview-img-container {
  aspect-ratio: 1/1;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  background: #111222;
}

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

.preview-tip {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.preview-tip strong {
  color: var(--accent-cyan);
}

/* ==========================================================================
   Tab Navigation & CSV Layout Styles
   ========================================================================== */

.tabs-container {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 0.25rem;
  justify-content: center;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.75rem 1.5rem;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--accent-gold);
}

.tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: -0.25rem;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
  border-radius: 3px 3px 0 0;
  box-shadow: 0 0 10px rgba(217, 160, 91, 0.4);
}

.tab-content.hidden {
  display: none !important;
}

/* CSV Dropzone */
.csv-dropzone-area {
  border: 2px dashed rgba(215, 195, 176, 0.2);
  border-radius: 16px;
  padding: 3.5rem 2rem;
  text-align: center;
  background: rgba(10, 11, 21, 0.2);
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
}

.csv-dropzone-area:hover, .csv-dropzone-area.dragover {
  border-color: var(--accent-gold);
  background: rgba(217, 160, 91, 0.03);
  box-shadow: inset 0 0 20px rgba(217, 160, 91, 0.03);
}

.dropzone-icon {
  font-size: 3.5rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.csv-dropzone-area h3 {
  font-size: 1.25rem;
  font-weight: 600;
}

.csv-dropzone-area p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.csv-dropzone-area input[type="file"] {
  display: none;
}

.dropzone-help {
  font-size: 0.75rem !important;
  color: var(--text-muted) !important;
  margin-top: 0.5rem;
}

/* Mapping settings */
.csv-mapping-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--panel-border);
  animation: fadeIn var(--transition-normal) forwards;
}

.csv-mapping-section h3 {
  font-family: var(--font-family-serif);
  font-size: 1.4rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
}

.mapping-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.mapping-grid input[type="text"] {
  width: 100%;
  background: rgba(10, 11, 21, 0.6);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}

.mapping-grid input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 10px rgba(217, 160, 91, 0.15);
}

.mapping-actions {
  display: flex;
  justify-content: flex-end;
}

/* Queue Control Bar */
.queue-control-bar {
  background: rgba(10, 11, 21, 0.3);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.queue-status-text {
  font-size: 0.9rem;
  font-weight: 500;
  min-width: 180px;
  flex-shrink: 0;
}

.queue-progress-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-grow: 1;
  min-width: 250px;
}

.queue-progress-bar-wrapper {
  flex-grow: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.queue-progress-bar {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 10px;
  width: 0;
  transition: width 0.3s ease;
  box-shadow: 0 0 8px rgba(217, 160, 91, 0.4);
}

.queue-progress-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
}

.queue-actions {
  display: flex;
  gap: 0.75rem;
  flex-shrink: 0;
}

.queue-actions button {
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
  border-radius: 10px;
}

/* Batch Toolbar */
.batch-operations-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(217, 160, 91, 0.02);
  border: 1px solid rgba(217, 160, 91, 0.08);
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
}

.selected-items-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.selected-items-label span {
  color: var(--accent-gold);
  font-weight: 700;
}

.batch-buttons {
  display: flex;
  gap: 0.75rem;
}

.batch-buttons button {
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
  border-radius: 8px;
}

/* CSV Results Table */
.csv-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: rgba(10, 11, 21, 0.2);
}

.csv-results-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.csv-results-table th {
  background: rgba(29, 25, 22, 0.8);
  padding: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--panel-border);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.csv-results-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
  color: var(--text-primary);
}

.csv-results-table tbody tr {
  transition: background var(--transition-fast);
  cursor: pointer;
}

.csv-results-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.csv-results-table tbody tr.row-loading {
  background: rgba(217, 160, 91, 0.02);
}

.csv-results-table tbody tr.row-loaded {
  background: rgba(16, 185, 129, 0.01);
}

.csv-results-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-gold);
  cursor: pointer;
}

.table-thumb-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
  background: #111222;
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.table-thumb-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.table-actions {
  display: flex;
  gap: 0.5rem;
}

.table-actions button {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 8px;
}

.manual-duplex-buttons {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.manual-duplex-buttons button {
  width: 100%;
}

.amber-btn {
  background: linear-gradient(135deg, #e08e39 0%, #b86214 100%) !important;
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 4px 15px rgba(184, 98, 20, 0.25) !important;
}

.amber-btn:hover {
  background: linear-gradient(135deg, #f09e49 0%, #c87224 100%) !important;
  box-shadow: 0 4px 20px rgba(184, 98, 20, 0.4) !important;
}

.csv-results-table tbody tr.row-completed td:not(.checkbox-cell):not(.actions-cell) {
  opacity: 0.45;
  text-decoration: line-through;
  color: var(--text-muted);
}

.csv-results-table tbody tr.row-completed {
  background: rgba(0, 0, 0, 0.15);
}

.csv-results-table tbody tr.row-completed td.cond-cell span,
.csv-results-table tbody tr.row-completed td.cat-cell span {
  opacity: 0.6;
  text-decoration: none !important;
}

.csv-results-table td.completed-cell {
  text-align: center;
  vertical-align: middle;
}

.csv-results-table input.csv-row-completed-checkbox {
  width: 16px;
  height: 16px;
  accent-color: #10b981 !important; /* Green for completed state */
  cursor: pointer;
}

/* ==========================================================================
   CSS Media Print rules
   ========================================================================== */

#print-area {
  display: none;
}

@media print {
  @page {
    margin: 0;
    size: auto;
  }
  
  html, body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 12pt;
    margin: 0 !important;
    padding: 0 !important;
    height: 100%;
  }

  /* Hide everything on web interface during print */
  body > *:not(#print-area) {
    display: none !important;
  }

  #print-area {
    display: block !important;
    width: 100vw;
    height: 100vh;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
  }

  /* Centered Duplex page print block */
  .print-page {
    display: flex !important;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    box-sizing: border-box;
    page-break-after: always;
    break-after: page;
    background: #ffffff !important;
  }

  .print-page img {
    object-fit: cover;
    display: block;
  }

  /* Fold cover container: side by side */
  .print-fold-container {
    display: flex !important;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    box-sizing: border-box;
    background: #ffffff !important;
  }

  .print-fold-layout {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    border: 0.5mm dashed #bbbbbb;
    position: relative;
  }

  .print-fold-layout img {
    object-fit: cover;
    display: block;
  }

  .print-fold-divider {
    border-left: 0.5mm dashed #999999;
    height: 100%;
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    z-index: 10;
  }
}
