@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400..700;1,400..700&family=Plus+Jakarta+Sans:ital,wght@0,200..800;1,200..800&display=swap');

/* Design System Core Tokens - Theme Responsive */
:root {
  --bg-color: #EDF2EE;            /* Elegant soft sage green tint (non-beige) */
  --card-bg: #FFFFFF;
  --primary-color: #1E4620;       /* Deep premium forest green */
  --primary-hover: #132D15;
  --secondary-color: #2E7D32;
  --accent-color: #D97706;        /* Amber gold */
  --success-color: #15803D;
  --warning-color: #DC2626;
  --border-color: #E1E4DC;
  --text-primary: #1B1E1A;
  --text-secondary: #5A6057;

  --font-family: 'Plus Jakarta Sans', sans-serif;
  --font-serif: 'Lora', Georgia, serif;
  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 4px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06);

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --input-bg: #FAFBF9;
  --hover-bg: #EAECE6;
}

[data-theme="dark"] {
  --bg-color: #0F172A;            /* Slate 900 */
  --card-bg: #1E293B;             /* Slate 800 */
  --primary-color: #38BDF8;       /* Sky Blue */
  --primary-hover: #0EA5E9;
  --secondary-color: #0EA5E9;
  --accent-color: #F43F5E;        /* Rose pink */
  --success-color: #10B981;       /* Emerald green */
  --warning-color: #EF4444;       /* Red */
  --border-color: #334155;        /* Slate 700 */
  --text-primary: #F8FAFC;        /* Slate 50 */
  --text-secondary: #94A3B8;      /* Slate 400 */
  --input-bg: #0F172A;
  --hover-bg: #334155;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4);
}

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 700;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
  padding: 2.5rem 1.5rem;
  display: flex;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--transition), color var(--transition);
  position: relative;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  position: relative;
  z-index: 10;
}

/* Top Navigation Bar */
.nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0 1.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.platform-logo {
  background-color: var(--hover-bg);
  color: var(--primary-color);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
}

.title-group h1 {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  line-height: 1.2;
  text-transform: uppercase;
}

.title-group p {
  font-family: var(--font-family);
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-color);
  background-color: var(--hover-bg);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
}

.profile-avatar {
  background-color: var(--hover-bg);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
}

/* Theme switch button */
.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  background-color: var(--hover-bg);
  border-color: var(--primary-color);
}

/* Landing Page Elements */
.landing-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  z-index: 1;
  pointer-events: none;
  opacity: 0.22;
}

.landing-clip {
  position: absolute;
  width: 380px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 16px;
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-lg);
  animation: floatUp 32s linear infinite;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.landing-clip img {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: var(--radius-md);
  max-height: 320px;
}

.landing-clip-headline {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.25;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
}

.landing-clip-body {
  font-family: var(--font-family);
  font-size: 0.825rem;
  color: var(--text-secondary);
  overflow: hidden;
  max-height: 90px;
  line-height: 1.4;
}

@keyframes floatUp {
  0% {
    transform: translateY(110vh) rotate(0deg);
    opacity: 0;
  }
  8% {
    opacity: 1;
  }
  92% {
    opacity: 1;
  }
  100% {
    transform: translateY(-20vh) rotate(360deg);
    opacity: 0;
  }
}

.landing-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  gap: 3rem;
}

.landing-title {
  text-align: center;
}

.landing-title h1 {
  font-size: 3rem;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

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

.landing-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  width: 100%;
  max-width: 900px;
}

@media(min-width: 768px) {
  .landing-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

.landing-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.landing-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  opacity: 0;
  transition: var(--transition);
}

.landing-card:hover::before {
  opacity: 1;
}

.landing-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.landing-card h2 {
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.3;
}

.landing-card p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.landing-card-icon {
  font-size: 2.5rem;
  color: var(--primary-color);
}

/* Card Foundations */
.card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2.25rem;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-hero {
  border-top: 4px solid var(--primary-color);
}

.card-header {
  margin-bottom: 1.5rem;
}

.card-header h2 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  letter-spacing: 0.5px;
}

.card-header h2 svg {
  color: var(--primary-color);
}

.card-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* Downloader Forms Grid Layout */
.downloader-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

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

.downloader-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.downloader-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.downloader-input, .downloader-select {
  height: 42px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 0 0.85rem;
  font-size: 0.9rem;
  background-color: var(--input-bg);
  color: var(--text-primary);
  font-family: var(--font-family);
  transition: var(--transition);
  outline: none;
}

.downloader-input:focus, .downloader-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.checkbox-row {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  height: 42px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-primary);
}

.checkbox-label input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Local downloaded list styling */
.downloaded-list-header {
  margin-top: 2rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
  margin-bottom: 1rem;
}

.downloaded-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}

.downloaded-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background-color: var(--hover-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.downloaded-row:hover {
  border-color: var(--primary-color);
}

.downloaded-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 80%;
}

.downloaded-title-block {
  display: flex;
  flex-direction: column;
}

.downloaded-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.downloaded-subtext {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.downloaded-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Grid columns for extraction layout split */
.extraction-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media(min-width: 900px) {
  .extraction-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 3.5rem 2rem;
  text-align: center;
  cursor: pointer;
  background-color: var(--hover-bg);
  transition: var(--transition);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary-color);
  background-color: var(--card-bg);
}

.pdf-illustration {
  margin-bottom: 1rem;
  display: flex;
  justify-content: center;
  animation: float 3s ease-in-out infinite;
}

.upload-message {
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 500;
}

.browse-btn-text {
  color: var(--primary-color);
  text-decoration: underline;
}

.upload-subtext {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.4rem;
}

/* Pipeline Stepper steps */
.pipeline-flow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1.5rem 0;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  min-width: 80px;
}

.step-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--hover-bg);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  transition: var(--transition);
}

.step-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
}

.step-status {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Step status modifiers */
.step.active .step-icon {
  background-color: var(--card-bg);
  color: var(--primary-color);
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.step.active .step-label {
  color: var(--primary-color);
}

.step.active .step-status {
  color: var(--primary-color);
}

.step.complete .step-icon {
  background-color: var(--success-color);
  color: white;
  border-color: var(--success-color);
}

.step.complete .step-label {
  color: var(--text-primary);
}

.step.complete .step-status {
  color: var(--success-color);
}

.step.failed .step-icon {
  background-color: var(--warning-color);
  color: white;
  border-color: var(--warning-color);
}

.pipeline-line {
  height: 2px;
  background-color: var(--border-color);
  flex: 1;
  min-width: 12px;
  margin-top: -16px;
}

.progress-details-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 1.25rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.progress-bar-container {
  height: 20px;
  background-color: var(--hover-bg);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-color);
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background-color: var(--primary-color);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.4s ease;
}

.stat-block {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Card 3: Generated Crops Grid */
.crops-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media(min-width: 600px) {
  .crops-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media(min-width: 900px) {
  .crops-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.crop-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--card-bg);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.crop-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.crop-preview-wrapper {
  background-color: var(--hover-bg);
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border-color);
  overflow: hidden;
  position: relative;
}

.crop-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: var(--transition);
}

.crop-card:hover .crop-image {
  transform: scale(1.05);
}

.crop-details {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex-grow: 1;
}

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

.crop-id-badge {
  font-weight: 700;
  color: var(--primary-color);
}

.crop-bbox-summary {
  background-color: var(--hover-bg);
  font-family: monospace;
  font-size: 0.75rem;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.crop-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

.crop-btn {
  flex: 1;
  padding: 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--card-bg);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  color: var(--text-primary);
  text-decoration: none;
}

.crop-btn:hover {
  background-color: var(--hover-bg);
  border-color: var(--primary-color);
}

/* Card 4: Search Form Layout */
.search-form-layout {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.search-box-row {
  display: flex;
  gap: 0.75rem;
}

.search-input-field {
  flex-grow: 1;
  height: 48px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 0 1rem;
  font-size: 0.95rem;
  background-color: var(--input-bg);
  color: var(--text-primary);
  transition: var(--transition);
  font-family: var(--font-family);
  outline: none;
}

.search-input-field:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.search-action-btn {
  width: 160px;
  font-size: 0.95rem;
}

.search-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: center;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.filter-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.radio-group {
  display: flex;
  gap: 0.75rem;
}

.radio-label {
  display: inline-flex;
  align-items: center;
  background: transparent;
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-family: var(--font-family);
  font-size: 0.725rem;
  font-weight: 700;
  color: var(--text-secondary);
  transition: var(--transition);
  text-transform: uppercase;
  user-select: none;
}

.radio-label:hover {
  background-color: var(--hover-bg);
  border-color: var(--primary-color);
}

.radio-label input {
  display: none;
}

.radio-label:has(input:checked) {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--card-bg);
}

/* Card 5: Search Results Layout */
.results-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.result-row-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--hover-bg);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.result-row-card:hover {
  border-color: var(--primary-color);
  background-color: var(--card-bg);
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
}

.result-left-block {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-width: 70%;
}

.result-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.result-meta-row {
  display: flex;
  gap: 1rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.meta-occurrences {
  font-weight: 700;
  color: var(--primary-color);
}

.btn-sm-primary {
  width: auto;
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  box-shadow: var(--shadow-sm);
}

/* Collapsible Related Articles Styling */
.placeholder-card {
  border: 1px dashed var(--border-color);
  background-color: transparent;
}

.placeholder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.placeholder-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toggle-icon {
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: transform 0.3s ease;
}

.placeholder-card.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

.placeholder-content {
  margin-top: 1.5rem;
  border-top: 1px dashed var(--border-color);
  padding-top: 1.5rem;
}

.placeholder-card.collapsed .placeholder-content {
  display: none;
}

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.empty-state-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.stub-item {
  position: relative;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  gap: 1.5rem;
  background-color: var(--card-bg);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.stub-item:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.stub-crop-preview {
  width: 140px;
  height: 140px;
  background-color: var(--hover-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); /* Rounded corner */
  display: flex;
  align-items: center;
  justify-content: center;
}

.stub-placeholder-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.stub-details {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex-grow: 1;
}

.stub-header-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.stub-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.35rem 0.75rem;
  border-radius: 20px; /* Fully rounded capsule */
  display: inline-flex;
  align-items: center;
}

.stub-field {
  font-size: 0.875rem;
  color: var(--text-primary);
}

.stub-field strong {
  color: var(--primary-color);
  font-weight: 600;
}

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

.stub-box {
  background-color: var(--hover-bg);
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md); /* Rounded corner */
  font-family: var(--font-family);
  font-size: 0.85rem;
  line-height: 1.5;
  border: 1px solid var(--border-color);
  margin-top: 0.4rem;
  color: var(--text-primary);
}

.stub-box-ai {
  background-color: rgba(30, 70, 32, 0.05); /* Forest green tint */
  border-color: rgba(30, 70, 32, 0.15);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-style: italic;
  border-radius: var(--radius-md);
}

/* Shared Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-family);
  font-weight: 600;
  gap: 0.4rem;
  padding: 0.75rem 1.5rem;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary-color);
  color: var(--card-bg);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

.btn-primary:disabled {
  background-color: var(--hover-bg);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  cursor: not-allowed;
}

.btn-secondary {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

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

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

.btn-danger {
  background-color: var(--warning-color);
  color: white;
}

.btn-danger:hover {
  opacity: 0.9;
}

.btn-icon-only {
  width: 42px;
  height: 42px;
  padding: 0;
}

.btn-large {
  height: 48px;
}

.action-btn-row {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.75rem;
}

/* Message boxes */
.message-box {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  margin-top: 1.25rem;
  border: 1px solid var(--border-color);
  display: none;
}

.message-box.info {
  background-color: rgba(59, 130, 246, 0.1);
  border-color: var(--primary-color);
  color: var(--text-primary);
  display: block;
}

.message-box.success {
  background-color: rgba(16, 185, 129, 0.1);
  border-color: var(--success-color);
  color: var(--text-primary);
  display: block;
}

.message-box.warning {
  background-color: rgba(245, 158, 11, 0.1);
  border-color: var(--warning-color);
  color: var(--text-primary);
  display: block;
}

.message-box.error {
  background-color: rgba(239, 68, 68, 0.1);
  border-color: var(--warning-color);
  color: var(--text-primary);
  display: block;
}

/* Console Logger UI for downloader */
.console-box {
  background-color: #0F172A;
  color: #10B981;
  font-family: monospace;
  font-size: 0.8rem;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  max-height: 120px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
}

.console-line {
  line-height: 1.4;
}

/* Animations */
@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-5px); }
  100% { transform: translateY(0px); }
}

/* Sidebar & Overlay */
.history-sidebar {
  position: fixed;
  top: 0;
  right: -400px;
  width: 400px;
  height: 100vh;
  background-color: var(--card-bg);
  box-shadow: -4px 0 15px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-color);
}

.history-sidebar.open {
  right: 0;
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.history-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.85rem;
  background-color: var(--hover-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.history-item:hover {
  background-color: var(--card-bg);
  border-color: var(--primary-color);
}

.history-item-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-all;
}

.history-item-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-secondary);
  align-items: center;
}

.batch-file-progress {
  padding: 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--hover-bg);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.batch-file-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.batch-file-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-file-status {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

/* File Row items in Upload stepper */
.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background-color: var(--hover-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.file-row-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 80%;
}

.file-row-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row-size {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Badges styling */
.badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.badge-gray {
  background-color: var(--hover-bg);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.badge-blue {
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

.badge-green {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
  border: 1px solid var(--success-color);
}

.badge-orange {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--warning-color);
  border: 1px solid var(--warning-color);
}

.badge-pending {
  background-color: var(--hover-bg);
  color: var(--text-secondary);
  border: 1px dashed var(--border-color);
}

/* Scrollbars styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

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

/* Responsive Overrides */
@media(max-width: 600px) {
  body {
    padding: 1.5rem 0.75rem;
  }

  .card {
    padding: 1.5rem;
  }

  .progress-details-grid {
    grid-template-columns: 1fr;
  }

  .search-box-row {
    flex-direction: column;
  }

  .search-action-btn {
    width: 100%;
  }

  .result-row-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .result-row-card button {
    width: 100%;
  }

  .history-sidebar {
    width: 100% !important;
    right: -100% !important;
  }

  .history-sidebar.open {
    right: 0 !important;
  }
}

/* Custom Multi-select Dropdown for Editions */
.custom-dropdown {
  position: relative;
  width: 100%;
  font-family: var(--font-family);
}

.dropdown-select {
  height: 42px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 0 1rem;
  font-size: 0.9rem;
  background-color: var(--input-bg);
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}

.dropdown-select:hover {
  border-color: var(--primary-color);
}

.dropdown-options {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 6px 0;
}

.dropdown-option {
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  color: var(--text-primary);
}

.dropdown-option:hover {
  background-color: var(--hover-bg);
}

.dropdown-option input {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

/* Spinner/Loader Styles */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

[data-theme="dark"] .spinner {
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary-color);
}

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

/* Image Preview Modal CSS */
.preview-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
}

.preview-modal-content {
  position: relative;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2xl);
  padding: 1rem;
  width: 98%;
  max-width: 1600px;
  max-height: 96vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  z-index: 2001;
  animation: modalFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.preview-close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
  transition: var(--transition);
}

.preview-close-btn:hover {
  color: var(--warning-color);
}

.preview-image-container {
  width: 100%;
  height: 78vh;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: #0f172a;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: grab;
}

.preview-image-container:active {
  cursor: grabbing;
}

.preview-image-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.15s ease-out;
  user-select: none;
  pointer-events: none;
}

.preview-controls {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding-top: 0.25rem;
}

/* Specific styles for session results */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.meta-info {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.search-filter-container {
  margin-top: 1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  width: 100%;
  background: var(--card-bg);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}
.search-input {
  flex: 1;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--input-bg);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}
.search-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(30, 70, 32, 0.1);
}
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}
.article-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}
.article-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}
.article-img-container {
  position: relative;
  background: #f1f3f0;
  padding: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 220px;
  overflow: hidden;
  border-bottom: 1px solid var(--border-color);
  cursor: zoom-in;
}
.article-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}
.article-img-container:hover .article-img {
  transform: scale(1.05);
}
.article-content {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}
.article-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
}
.article-ocr-btn {
  width: 100%;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
}
.ocr-text-box {
  display: none;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-primary);
  max-height: 150px;
  overflow-y: auto;
  white-space: pre-wrap;
  font-family: var(--font-family);
}
.ocr-text-box.open {
  display: block;
  animation: slideDown 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Modal styles for full screen image view */
.image-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
}
.image-modal.open {
  display: flex;
}
.image-modal-content {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  border-radius: 4px;
}
.image-modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  color: #fff;
  font-size: 2.5rem;
  cursor: pointer;
  background: none;
  border: none;
  line-height: 1;
}
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}