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

:root {
  --bg-primary: #e8f3e3;
  --bg-secondary: white;
  --bg-tertiary: #f0f7ed;
  --text-primary: #333;
  --text-secondary: #555;
  --text-muted: #666;
  --border-color: #e0e0e0;
  --accent-primary: #4a7c2c;
  --accent-secondary: #2d5016;
  --accent-hover: #3d6823;
  --shadow: rgba(0, 0, 0, 0.1);
  --shadow-heavy: rgba(0, 0, 0, 0.3);
  --warning-bg: #fff3cd;
  --warning-border: #ffc107;
  --warning-text: #856404;
  --info-color: #17a2b8;
}

body.dark-mode {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --bg-tertiary: #242424;
  --text-primary: #e0e0e0;
  --text-secondary: #c0c0c0;
  --text-muted: #999;
  --border-color: #444;
  --accent-primary: #5a8f3c;
  --accent-secondary: #4a7c2c;
  --accent-hover: #4d7f2f;
  --shadow: rgba(0, 0, 0, 0.3);
  --shadow-heavy: rgba(0, 0, 0, 0.6);
  --warning-bg: #332b00;
  --warning-border: #ffc107;
  --warning-text: #ffd966;
  --info-color: #5bc0de;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-tertiary) 100%);
  color: var(--text-primary);
  min-height: 100vh;
  padding: 2rem 1rem;
  transition: background 0.3s, color 0.3s;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
  box-sizing: border-box;
  overflow-x: hidden;
}

@media (min-width: 1200px) {
  .container {
    padding: 0 3rem;
  }
}

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

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

.header h1 {
  font-size: 2.5rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 4px var(--shadow-heavy);
}

.header p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  opacity: 0.9;
}

.theme-toggle {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s;
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px var(--shadow);
}

/* Warnings Banner */
.warnings-banner {
  background: var(--warning-bg);
  border: 2px solid var(--warning-border);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
}

.warnings-banner.hidden {
  display: none;
}

.warning-item {
  color: var(--warning-text);
  font-size: 0.95rem;
  padding: 0.25rem 0;
}

/* Session expiry warning banner */
.session-warning-banner {
  background: #fff3cd;
  border: 2px solid #ff9800;
  border-radius: 12px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.session-warning-banner.hidden {
  display: none;
}

body.dark-mode .session-warning-banner {
  background: #3d2e00;
  border-color: #ff9800;
}

.session-warning-text {
  color: #856404;
  font-size: 0.95rem;
  font-weight: 600;
}

body.dark-mode .session-warning-text {
  color: #ffd966;
}

.session-warning-dismiss {
  background: transparent;
  border: 1px solid #856404;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  color: #856404;
  font-size: 0.85rem;
}

body.dark-mode .session-warning-dismiss {
  border-color: #ffd966;
  color: #ffd966;
}

.card {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 20px 60px var(--shadow-heavy);
  margin-bottom: 1.5rem;
  transition: background 0.3s;
}

.upload-zone {
  border: 3px dashed var(--accent-primary);
  border-radius: 12px;
  padding: 3rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: var(--bg-tertiary);
}

.upload-zone:hover {
  border-color: var(--accent-secondary);
  background: var(--bg-primary);
}

.upload-zone.dragover {
  border-color: var(--accent-secondary);
  background: var(--bg-primary);
  transform: scale(1.02);
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.upload-zone h3 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.upload-zone p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

#file {
  display: none;
}

.editor-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 2rem;
}

@media (max-width: 968px) {
  .editor-grid {
    grid-template-columns: 1fr;
  }
  
  .theme-toggle {
    position: static;
    display: block;
    margin: 1rem auto;
  }
  
  .cover-section {
    max-width: 100%;
  }
}

@media (max-width: 600px) {
  .container {
    padding: 1rem 0.5rem;
  }
  
  .card {
    padding: 1rem;
    margin: 0;
    border-radius: 12px;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  /* Prevent text inputs from overflowing */
  input,
  textarea {
    max-width: 100%;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
  }
  
  /* Prevent description field overflow */
  textarea {
    overflow-wrap: break-word;
    word-wrap: break-word;
  }
  
  /* Make buttons stack on mobile */
  .action-buttons {
    flex-direction: column;
    width: 100%;
    max-width: 100%;
  }
  
  .action-buttons button,
  .btn {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* Cover actions */
  .cover-actions {
    grid-template-columns: 1fr;
  }
  
  /* OPDS preview mobile fix */
  .opds-preview {
    max-width: 100%;
  }
  
  .opds-item {
    flex-direction: row;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .opds-cover-mini {
    width: 50px;
    height: 75px;
    flex-shrink: 0;
  }
  
  .opds-details {
    flex: 1;
    min-width: 0;
    text-align: left;
  }
  
  /* Modal fixes for mobile */
  .modal {
    padding: 0.5rem;
  }
  
  .modal-content {
    padding: 1rem 1rem 0 1rem;
    max-height: 95vh;
  }
  
  /* Candidate cards mobile - actions stack */
  .candidate-actions {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .candidate-actions button {
    width: 100%;
  }
  
  /* Cover search pagination mobile */
  .cover-pagination {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  /* Footer mobile */
  .footer {
    padding: 1rem 0.5rem;
    font-size: 0.85rem;
  }
}

.cover-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 300px;
}

.cover-preview {
  width: 100%;
  aspect-ratio: 2/3;
  border-radius: 8px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px solid var(--border-color);
}

.cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--bg-secondary);
}

.cover-placeholder {
  color: var(--text-muted);
  text-align: center;
  padding: 1rem;
}

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 124, 44, 0.4);
}

.btn-secondary {
  background: var(--bg-secondary);
  border: 2px solid var(--accent-primary);
  color: var(--accent-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-tertiary);
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cover-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
}

.cover-actions button {
  font-size: 0.85rem;
  padding: 0.6rem;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-width: 100%;
}

.action-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-primary);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
  max-width: 100%;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

label {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.field-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: help;
  flex-shrink: 0;
}

input, textarea {
  padding: 0.75rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: border-color 0.3s;
  font-family: inherit;
}

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

textarea {
  resize: vertical;
  min-height: 100px;
}

#coverInput {
  display: none;
}

.lookup-group {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.lookup-group .form-group {
  flex: 1;
}

.lookup-btn {
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
  font-family: inherit;
}

.lookup-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 124, 44, 0.4);
}

.lookup-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

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

.hidden {
  display: none !important;
}

/* Field Warning */
.field-warning {
  color: var(--warning-text);
  font-size: 0.85rem;
  padding: 0.5rem;
  background: var(--warning-bg);
  border-radius: 4px;
  margin-top: 0.25rem;
}

.field-warning.info {
  color: var(--info-color);
  background: rgba(23, 162, 184, 0.1);
}

/* Diff Preview */
.diff-preview {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 1rem;
}

.diff-preview h4 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-size: 1rem;
}

.diff-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.diff-item:last-child {
  border-bottom: none;
}

.diff-field {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.diff-values {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.diff-old {
  color: #c43030;
  font-size: 0.9rem;
  text-decoration: line-through;
  opacity: 0.8;
}

.diff-new {
  color: #28a745;
  font-size: 0.9rem;
  font-weight: 500;
}

/* Changes Divider */
.changes-divider {
  border: none;
  border-top: 2px dashed var(--border-color);
  margin: 1.5rem 0;
}

/* OPDS Preview */
.opds-preview {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 1rem;
  border: 2px solid var(--border-color);
}

.opds-preview-header {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.opds-preview-content {
  min-height: 80px;
}

.opds-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.opds-cover-mini {
  width: 60px;
  height: 90px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
}

.opds-cover-mini img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.opds-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1.5rem;
}

.opds-details {
  flex: 1;
  min-width: 0;
}

.opds-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.3;
  word-break: break-word;
}

.opds-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 0.15rem;
}

.opds-author {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.opds-meta {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.opds-language {
  color: var(--text-muted);
  font-size: 0.7rem;
  margin-top: 0.15rem;
}

.opds-subjects {
  color: var(--text-muted);
  font-size: 0.7rem;
  margin-top: 0.15rem;
  word-break: break-word;
}

.opds-description {
  color: var(--text-secondary);
  font-size: 0.7rem;
  margin-top: 0.35rem;
  line-height: 1.4;
  word-break: break-word;
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer a {
  color: var(--accent-primary);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* Tooltip */
.tooltip {
  position: fixed;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  max-width: 300px;
  box-shadow: 0 4px 12px var(--shadow);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.tooltip.visible {
  opacity: 1;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 2rem 2rem 0 2rem;
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px var(--shadow-heavy);
  position: relative;
}

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

.modal-header h3 {
  color: var(--text-primary);
  font-size: 1.5rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.5rem;
  line-height: 1;
  transition: color 0.3s;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-footer {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 2px solid var(--border-color);
}

.modal-footer.sticky-footer {
  position: sticky;
  bottom: 0;
  background: var(--bg-secondary);
  margin: 1.5rem -2rem 0 -2rem;
  padding: 1rem 2rem;
  border-top: 2px solid var(--border-color);
  border-radius: 0 0 16px 16px;
  z-index: 10;
  box-shadow: 0 -4px 12px var(--shadow);
}

/* Language input group - select + input combo */
.language-input-group {
  display: flex;
  gap: 0.5rem;
}

.language-input-group input {
  flex: 1;
  min-width: 0;
}

.language-input-group select {
  width: auto;
  min-width: 120px;
  padding: 0.75rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
}

.language-input-group select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

@media (max-width: 600px) {
  .language-input-group {
    flex-direction: column;
  }
  
  .language-input-group select {
    width: 100%;
  }
}

/* Candidates List */
.candidates-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 100%;
  padding-bottom: 1rem;
}

/* ---- Candidate responsive layout: MOBILE-FIRST with cover on TOP ---- */
.candidate-card {
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.3s;
  overflow: hidden;
  max-width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto;
  gap: 1rem;
  align-items: start;
}

.candidate-card:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 4px 12px var(--shadow);
}

/* Cover area - on MOBILE appears FIRST (row 1) */
.candidate-cover-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  grid-row: 1;  /* Cover on top for mobile */
}

/* Container for textual content - on MOBILE appears SECOND (row 2) */
.candidate-main {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  grid-row: 2;  /* Text below cover for mobile */
}

/* Title row + source badge */
.candidate-title-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.candidate-title {
  font-size: 1.05rem;
  color: var(--text-primary);
  line-height: 1.3;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.candidate-meta-line {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.meta-item { color: var(--text-secondary); }

.source-badge {
  background: var(--accent-primary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Cover image - use object-fit: contain to preserve aspect ratio */
.candidate-cover {
  width: 120px;
  height: auto;
  max-height: 180px;
  aspect-ratio: 2 / 3;
  object-fit: contain;  /* Changed from 'cover' to 'contain' - show full image */
  border-radius: 6px;
  border: 2px solid var(--border-color);
  box-shadow: 0 8px 20px var(--shadow);
  display: block;
  background: var(--bg-secondary);  /* Background for transparent images */
}

.candidate-cover.placeholder {
  width: 120px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border-radius: 6px;
  border: 2px dashed var(--border-color);
  padding: 0.5rem;
  font-size: 0.85rem;
}

.candidate-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-start;
}

.candidate-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.candidate-details strong {
  color: var(--text-primary);
}

.candidate-note {
  font-size: 0.8rem;
  color: var(--info-color);
  font-style: italic;
  margin-top: 0.5rem;
}

/* Actions styling */
.candidate-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* >= 720px: DESKTOP layout - two columns: text LEFT, cover RIGHT */
@media (min-width: 720px) {
  .candidate-card {
    grid-template-columns: 1fr 140px;
    grid-template-rows: auto;
    gap: 1rem;
  }

  /* Text content on left (column 1) */
  .candidate-main {
    grid-row: auto;
    grid-column: 1;
    padding-right: 0.5rem;
  }

  /* Cover on right (column 2) */
  .candidate-cover-wrap {
    grid-row: auto;
    grid-column: 2;
    justify-self: center;
    align-self: start;
  }
}

/* >= 980px: give the cover a little more room */
@media (min-width: 980px) {
  .candidate-card {
    grid-template-columns: 1fr 160px;
  }
  .candidate-cover { 
    width: 100%; 
    max-width: 160px; 
  }
}

/* Field Selector */
.field-selector {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field-selector h4 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.field-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-tertiary);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s;
}

.field-checkbox:hover {
  background: var(--bg-primary);
}

.field-checkbox input[type="checkbox"] {
  margin-top: 0.25rem;
  cursor: pointer;
  width: auto;
}

.field-checkbox strong {
  color: var(--text-primary);
}

/* Covers Grid */
.covers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  padding-bottom: 1rem;
}

.cover-pagination {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--border-color);
  flex-wrap: nowrap;
}

.cover-pagination button {
  flex-shrink: 0;
  white-space: nowrap;
}

.page-indicator {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
}

.cover-option {
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s;
}

.cover-option:hover {
  border-color: var(--accent-primary);
  transform: translateY(-4px);
  box-shadow: 0 4px 12px var(--shadow);
}

.cover-option img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: contain;
  display: block;
  background: var(--bg-tertiary);
}

.cover-info {
  padding: 0.75rem;
  font-size: 0.85rem;
}

.cover-info strong {
  color: var(--text-primary);
  display: block;
  margin-bottom: 0.25rem;
}

.cover-desc {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.loading, .no-results, .error {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.error {
  color: #c43030;
}

/* Success Message */
.success-message {
  background: #d4edda;
  border: 2px solid #28a745;
  color: #155724;
  padding: 1rem;
  border-radius: 8px;
  margin-top: 1rem;
  text-align: center;
  font-weight: 600;
}

body.dark-mode .success-message {
  background: #1e4620;
  border-color: #28a745;
  color: #90ee90;
}

/* Date Input */
.date-input-wrapper {
  position: relative;
}

.date-input-wrapper input[type="text"] {
  padding-right: 2.5rem;
}

.date-clear-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--border-color);
  border: none;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: background 0.3s;
}

.date-clear-btn:hover {
  background: var(--text-muted);
  color: var(--bg-secondary);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
  background: var(--accent-primary);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-secondary);
}