﻿/*
  RoarTools master stylesheet
  Shared by all static pages: homepage, exam tools, PDF tools, and utility pages.
*/

:root {
  /* Brand Colors */
  --primary: #1a56db;
  --primary-dark: #1e429f;
  --primary-light: #ebf5ff;
  --primary-hover: #1648c0;
  --accent: #ff6b2b;
  --accent-dark: #e55a1c;
  --accent-light: #fff3ee;
  --accent-hover: #e55a1c;

  /* Status Colors */
  --success: #057a55;
  --success-light: #f3faf7;
  --success-border: #84e1bc;
  --warning: #c27803;
  --warning-light: #fdf6b2;
  --warning-border: #fce96a;
  --danger: #c81e1e;
  --danger-light: #fdf2f2;
  --danger-border: #f8b4b4;
  --info: #1c64f2;
  --info-light: #ebf5ff;

  /* Text */
  --text-primary: #111827;
  --text-secondary: #374151;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --text-white: #ffffff;

  /* Backgrounds */
  --bg-white: #ffffff;
  --bg-light: #f9fafb;
  --bg-lighter: #f3f4f6;
  --bg-card: #ffffff;
  --bg-dark: #111827;
  --bg-darker: #0d1117;

  /* Borders */
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --border-dark: #d1d5db;
  --border-focus: #1a56db;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px rgba(0,0,0,0.1), 0 10px 10px rgba(0,0,0,0.04);
  --shadow-card: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-card-hover: 0 8px 24px rgba(0,0,0,0.12);

  /* Border Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Courier New', Courier, monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;

  /* Layout */
  --container-max: 1200px;
  --container-pad: 24px;
  --header-height: 64px;
  --sidebar-width: 280px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-white);
  line-height: var(--leading-normal);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body.menu-open {
  overflow: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

a:hover {
  text-decoration: underline;
}

button {
  cursor: pointer;
  font-family: inherit;
}

input,
select,
textarea {
  font-family: inherit;
}

ul,
ol {
  list-style: none;
}

:focus-visible {
  outline: 3px solid rgba(26, 86, 219, 0.3);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  top: -80px;
  left: 16px;
  z-index: 10000;
  padding: 10px 14px;
  color: var(--text-white);
  background: var(--primary);
  border-radius: var(--radius-sm);
  font-weight: var(--font-semibold);
}

.skip-link:focus {
  top: 12px;
}

/* Layout utilities */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}

.container-sm {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 var(--container-pad);
}

.container-lg {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--container-pad);
}

.section { padding: 64px 0; }
.section-sm { padding: 40px 0; }
.section-lg { padding: 96px 0; }

.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 24px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-height);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  transition: box-shadow var(--transition-base);
}

.site-header.scrolled {
  box-shadow: var(--shadow-md);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 20px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
  font-weight: var(--font-bold);
  text-decoration: none;
}

.header-logo:hover {
  text-decoration: none;
}

.logo-text {
  font-size: 1.1rem;
  font-weight: var(--font-bold);
  color: var(--primary);
  white-space: nowrap;
}

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

.nav-item {
  position: relative;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: var(--font-medium);
  transition: color var(--transition-base), background var(--transition-base);
  text-decoration: none;
}

.nav-link:hover {
  color: var(--primary);
  background: var(--primary-light);
  text-decoration: none;
}

.nav-link.active {
  color: var(--primary);
  background: var(--primary-light);
  font-weight: var(--font-semibold);
}

.nav-caret {
  font-size: 0.75rem;
  line-height: 1;
  color: var(--text-muted);
}

.nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  padding: 8px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
}

.nav-dropdown::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -10px;
  height: 10px;
}

.nav-item:hover .nav-dropdown,
.nav-item:focus-within .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown a {
  display: block;
  padding: 10px 12px;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  border-radius: var(--radius-sm);
}

.nav-dropdown a:hover,
.nav-dropdown a:focus {
  color: var(--primary);
  background: var(--primary-light);
  text-decoration: none;
}

.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
}

/* Mobile menu */
.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 1999;
  display: none;
  background: rgba(0, 0, 0, 0.5);
}

.mobile-menu-overlay.show {
  display: block;
}

.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 2000;
  padding: 20px;
  overflow-y: auto;
  background: var(--bg-white);
  transform: translateX(100%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform var(--transition-slow), opacity var(--transition-slow), visibility var(--transition-slow);
}

.mobile-menu.open {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.mobile-menu-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  background: var(--bg-lighter);
  font-size: 1.4rem;
  line-height: 1;
}

.mobile-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mobile-nav-link {
  display: block;
  min-height: 48px;
  padding: 14px 16px;
  margin-bottom: 4px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: var(--font-medium);
  text-decoration: none;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
  color: var(--primary);
  background: var(--primary-light);
  text-decoration: none;
}

/* Tool page layout */
.tool-page-hero {
  padding: 40px 0 32px;
  background: linear-gradient(180deg, var(--primary-light), var(--bg-white));
  border-bottom: 1px solid var(--border);
}

.tool-page-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.breadcrumb-sep {
  color: var(--text-light);
}

.tool-page-title {
  margin-bottom: 8px;
  color: var(--text-primary);
  font-size: 2rem;
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
}

.tool-page-subtitle {
  margin-bottom: 16px;
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.tool-main-area {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 32px;
  padding: 40px 0;
}

.tool-panel {
  position: relative;
  padding: 28px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.tool-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.breadcrumb-nav {
  padding: 14px 0;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-light);
}

.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.breadcrumb-list a {
  color: var(--primary);
}

.controls-panel {
  display: none;
  margin-top: 24px;
}

.controls-panel.show {
  display: block;
}

.control-section {
  padding: 18px 0;
  border-top: 1px solid var(--border-light);
}

.control-section:first-child {
  border-top: 0;
  padding-top: 0;
}

.control-title {
  margin-bottom: 12px;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: var(--font-bold);
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.preset-buttons,
.format-options,
.segmented-options,
.tool-actions,
.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option-pill,
.preset-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  color: var(--text-secondary);
  cursor: pointer;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: var(--font-semibold);
  transition: all var(--transition-base);
}

.option-pill input,
.preset-btn input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option-pill:has(input:checked),
.option-pill.active,
.preset-btn.active {
  color: var(--primary);
  background: var(--primary-light);
  border-color: var(--primary);
}

.download-name {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
  word-break: break-word;
}

.sidebar-card {
  padding: 18px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.sidebar-card h3 {
  margin-bottom: 12px;
  color: var(--text-primary);
  font-size: 1rem;
}

.sidebar-card a {
  display: block;
  min-height: 34px;
  padding: 6px 0;
  font-size: 0.9rem;
  font-weight: var(--font-medium);
}

.sidebar-card li {
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

.content-section {
  padding: 56px 0;
  background: var(--bg-white);
}

.file-note {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.target-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  margin: 20px 0;
  color: var(--primary-dark);
  background: linear-gradient(135deg, var(--primary-light), var(--bg-white));
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.target-card-icon {
  font-size: 2rem;
  line-height: 1;
}

.target-card strong {
  display: block;
  color: var(--text-primary);
  font-size: 1.05rem;
}

.target-card span {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.match-box {
  display: none;
  padding: 16px 18px;
  margin-top: 18px;
  background: var(--success-light);
  border: 1px solid var(--success-border);
  border-radius: var(--radius-md);
}

.match-box.show {
  display: block;
}

.match-box h3 {
  margin-bottom: 8px;
  color: var(--success);
  font-size: 1rem;
}

.match-box ul {
  list-style: disc;
  margin-left: 20px;
  color: var(--text-secondary);
}

.match-box li {
  margin-bottom: 4px;
}

.current-target-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  margin: 16px 0;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.current-target-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.current-target-row strong {
  color: var(--text-primary);
}

.status-line {
  display: none;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-weight: var(--font-semibold);
}

.status-line.show {
  display: block;
}

.status-line.success {
  color: var(--success);
  background: var(--success-light);
  border: 1px solid var(--success-border);
}

.status-line.danger {
  color: var(--danger);
  background: var(--danger-light);
  border: 1px solid var(--danger-border);
}

.mini-reference {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.mini-reference th,
.mini-reference td {
  padding: 8px 6px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.mini-reference th {
  color: var(--text-primary);
  font-weight: var(--font-semibold);
}

.exam-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 12px;
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: var(--font-semibold);
}

.history-section {
  padding: 48px 0;
  background: var(--bg-light);
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.history-section h2 {
  margin-bottom: 8px;
  color: var(--text-primary);
  font-size: 1.5rem;
}

.history-section p {
  margin-bottom: 18px;
  color: var(--text-muted);
}

.history-note {
  margin-top: 12px;
  color: var(--warning);
  font-size: 0.9rem;
}

.spec-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: var(--font-semibold);
}

.status-grid {
  display: grid;
  gap: 8px;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
}

.status-row:last-child {
  border-bottom: 0;
}

.status-row strong,
.status-ok,
.status-bad {
  font-weight: var(--font-bold);
}

.status-ok { color: var(--success); }
.status-bad { color: var(--danger); }

.tip-box {
  padding: 16px;
  margin-top: 18px;
  background: var(--info-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
}

.tip-box h3 {
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 1rem;
}

.tip-box ul {
  list-style: disc;
  margin-left: 18px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.tip-box li {
  margin-bottom: 5px;
}

.inline-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.inline-inputs label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: var(--font-medium);
}

.image-workspace {
  display: none;
  margin-top: 24px;
}

.image-workspace.show {
  display: block;
}

.crop-stage {
  position: relative;
  width: 100%;
  max-width: 760px;
  margin: 0 auto 18px;
  overflow: hidden;
  touch-action: none;
  background: var(--bg-dark);
  border-radius: var(--radius-md);
}

.crop-canvas {
  width: 100%;
  max-height: 560px;
  display: block;
}

.crop-help {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
}

/* Upload zone */
.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 200px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-light);
  border: 2px dashed var(--border-dark);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition-base), background var(--transition-base), transform var(--transition-base);
}

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

.upload-zone.dragover {
  background: var(--primary-light);
  border-color: var(--primary);
  transform: scale(1.01);
}

.upload-zone.has-file {
  background: var(--success-light);
  border-color: var(--success-border);
  border-style: solid;
}

.upload-icon {
  margin-bottom: 8px;
  font-size: 3rem;
  line-height: 1;
}

.upload-title {
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: var(--font-semibold);
}

.upload-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.upload-methods {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.upload-method-badge {
  padding: 4px 12px;
  color: var(--text-secondary);
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
}

/* Preview area */
.preview-area {
  display: none;
  margin-top: 24px;
}

.preview-area.show {
  display: block;
}

.preview-image-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  max-height: 70vh;
  overflow: hidden;
  background-color: #ffffff;
  background-image:
    /* checkerboard — overridden in dark mode */
    linear-gradient(45deg, #f1f5f9 25%, transparent 25%),
    linear-gradient(-45deg, #f1f5f9 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f1f5f9 75%),
    linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.preview-image-wrap img {
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
}

.preview-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.stat-box {
  padding: 12px;
  text-align: center;
  background: var(--bg-light);
  border-radius: var(--radius-md);
}

.stat-label {
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 0.75rem;
}

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

.stat-value.warning { color: var(--warning); }
.stat-value.success { color: var(--success); }
.stat-value.danger { color: var(--danger); }

/* Sliders and numeric inputs */
.slider-group {
  margin-bottom: 20px;
}

.slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.slider-label {
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: var(--font-medium);
}

.slider-value {
  padding: 2px 10px;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: var(--font-bold);
}

.slider-input {
  width: 100%;
  height: 6px;
  cursor: pointer;
  appearance: none;
  accent-color: var(--primary);
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary) var(--slider-fill, 50%), var(--border) var(--slider-fill, 50%), var(--border) 100%);
  border-radius: var(--radius-full);
}

.slider-input::-webkit-slider-runnable-track {
  height: 6px;
  background: transparent;
  border-radius: var(--radius-full);
}

.slider-input::-webkit-slider-thumb {
  width: 24px;
  height: 24px;
  margin-top: -9px;
  appearance: none;
  background: var(--primary);
  border: 3px solid var(--bg-white);
  border-radius: 50%;
  box-shadow: var(--shadow-md);
}

.slider-input::-moz-range-track {
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
}

.slider-input::-moz-range-progress {
  height: 6px;
  background: var(--primary);
  border-radius: var(--radius-full);
}

.slider-input::-moz-range-thumb {
  width: 24px;
  height: 24px;
  background: var(--primary);
  border: 3px solid var(--bg-white);
  border-radius: 50%;
  box-shadow: var(--shadow-md);
}

.number-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.number-input {
  width: 100px;
  padding: 6px 10px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

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

.number-input.input-error {
  border-color: var(--danger) !important;
  background: #fef2f2;
  color: var(--danger);
}

.input-error-msg {
  display: block;
  color: var(--danger);
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 4px;
  padding: 3px 8px;
  background: #fef2f2;
  border-left: 3px solid var(--danger);
  border-radius: 0 4px 4px 0;
  animation: errFadeIn 0.15s ease;
}

@keyframes errFadeIn {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: translateY(0); }
}

.unit-label {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  color: inherit;
  white-space: nowrap;
  cursor: pointer;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: var(--font-semibold);
  line-height: 1;
  text-decoration: none;
  transition: background var(--transition-base), color var(--transition-base), transform var(--transition-base), border-color var(--transition-base), opacity var(--transition-base);
}

.btn:hover {
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-primary:active,
.btn-accent:active {
  transform: translateY(0);
}

.btn-accent {
  color: var(--text-white);
  background: var(--accent);
}

.btn-accent:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.btn-outline {
  color: var(--primary);
  background: transparent;
  border: 2px solid var(--primary);
}

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

.btn-success {
  color: var(--text-white);
  background: var(--success);
}

.btn-success:hover {
  background: #046c4e;
}

.btn-ghost {
  color: var(--text-secondary);
  background: transparent;
}

.btn-ghost:hover {
  background: var(--bg-lighter);
}

.btn-sm {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 0.8125rem;
}

.btn-lg {
  min-height: 52px;
  padding: 14px 28px;
  font-size: 1.0625rem;
}

.btn-full,
.btn-download {
  width: 100%;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.btn-download {
  margin-top: 16px;
  padding: 14px;
  color: var(--text-white);
  background: var(--success);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: var(--font-bold);
}

/* Exam preset card */
.preset-card {
  padding: 16px;
  margin-bottom: 24px;
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
}

.preset-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: var(--primary);
  font-weight: var(--font-semibold);
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.preset-item {
  padding: 8px 12px;
  background: var(--bg-white);
  border-radius: var(--radius-sm);
}

.preset-item-label {
  color: var(--text-muted);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.preset-item-value {
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: var(--font-bold);
}

.preset-source {
  display: flex;
  gap: 4px;
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.preset-source a {
  color: var(--primary);
}

.btn-reset-preset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 4px 8px;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: var(--font-medium);
}

.btn-reset-preset:hover {
  color: var(--primary);
  background: rgba(255, 255, 255, 0.8);
}

/* Tool cards */
.tool-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  color: inherit;
  cursor: pointer;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
}

.tool-card:hover {
  border-left-color: var(--primary);
  box-shadow: var(--shadow-card-hover);
  text-decoration: none;
  transform: translateY(-2px);
}

.tool-card-icon {
  font-size: 2rem;
  line-height: 1;
}

.tool-card-name {
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-weight: var(--font-semibold);
}

.tool-card-desc {
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.4;
}

.tool-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.tag {
  padding: 2px 8px;
  color: var(--text-secondary);
  background: var(--bg-light);
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: var(--font-medium);
}

.tag-exam { color: var(--primary); background: var(--primary-light); }
.tag-free { color: var(--success); background: var(--success-light); }
.tag-pdf { color: #92400e; background: #fef3c7; }

/* Tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  -webkit-overflow-scrolling: touch;
}

.specs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.specs-table th {
  padding: 12px 16px;
  color: var(--text-primary);
  text-align: left;
  white-space: nowrap;
  background: var(--bg-light);
  border-bottom: 2px solid var(--border);
  font-weight: var(--font-semibold);
}

.specs-table td {
  padding: 11px 16px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
}

.specs-table tr:hover td {
  background: var(--bg-light);
}

.specs-table tr:last-child td {
  border-bottom: none;
}

.row-ssc td:first-child { border-left: 3px solid #1a56db; }
.row-bank td:first-child { border-left: 3px solid #057a55; }
.row-upsc td:first-child { border-left: 3px solid #7c3aed; }
.row-railway td:first-child { border-left: 3px solid #dc2626; }
.row-neet td:first-child { border-left: 3px solid #d97706; }
.row-psc td:first-child { border-left: 3px solid #0891b2; }

/* FAQ accordion */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.faq-item {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 16px 20px;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  background: var(--bg-white);
  border: none;
  font-size: 0.9375rem;
  font-weight: var(--font-medium);
  transition: background var(--transition-base), color var(--transition-base);
}

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

.faq-question.open {
  color: var(--primary);
  background: var(--primary-light);
}

.faq-icon {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  transition: transform var(--transition-slow), color var(--transition-base);
  flex-shrink: 0;
}

.faq-question.open .faq-icon {
  color: var(--primary);
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  padding: 0 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  transition: max-height var(--transition-slow), padding var(--transition-slow);
}

.faq-answer.open {
  max-height: 2000px;
  padding: 0 20px 16px;
}

/* Toast notifications */
.toast-container {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 280px;
  max-width: 400px;
  padding: 12px 20px;
  color: var(--text-white);
  pointer-events: all;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: var(--font-medium);
  animation: slideIn 200ms ease;
}

.toast.fade-out {
  animation: toastFadeOut 180ms ease forwards;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--primary); }
.toast-warning { background: var(--warning); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toastFadeOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* Loading */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

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

.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  border-radius: inherit;
}

/* Section headings */
.section-heading {
  margin-bottom: 40px;
  text-align: center;
}

.section-heading h2 {
  margin-bottom: 8px;
  color: var(--text-primary);
  font-size: 1.875rem;
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
}

.section-heading p {
  max-width: 600px;
  margin: 0 auto;
  color: var(--text-muted);
  font-size: 1rem;
}

.section-label {
  display: block;
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: var(--font-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Article content */
.article-content {
  max-width: 800px;
}

.article-content h2 {
  margin: 40px 0 16px;
  padding-bottom: 8px;
  color: var(--text-primary);
  border-bottom: 2px solid var(--border);
  font-size: 1.5rem;
  font-weight: var(--font-bold);
}

.article-content h3 {
  margin: 24px 0 12px;
  color: var(--text-primary);
  font-size: 1.15rem;
  font-weight: var(--font-semibold);
}

.article-content p {
  margin-bottom: 16px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.article-content ul,
.article-content ol {
  margin: 0 0 16px 20px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.article-content ul { list-style: disc; }
.article-content ol { list-style: decimal; }

.article-content li {
  margin-bottom: 6px;
}

.article-content strong {
  color: var(--text-primary);
  font-weight: var(--font-semibold);
}

.info-box,
.warning-box,
.success-box {
  display: flex;
  gap: 12px;
  margin: 20px 0;
  padding: 16px 20px;
  border-radius: var(--radius-md);
}

.info-box {
  background: var(--info-light);
  border: 1px solid var(--info);
}

.warning-box {
  background: var(--warning-light);
  border: 1px solid var(--warning-border);
}

.success-box {
  background: var(--success-light);
  border: 1px solid var(--success-border);
}

/* Footer */
.site-footer {
  padding: 64px 0 0;
  color: #9ca3af;
  background: var(--bg-dark);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr);
  gap: 40px;
  padding-bottom: 48px;
}

.footer-brand .logo-text {
  color: var(--text-white);
  font-size: 1.1rem;
  font-weight: var(--font-bold);
}

.footer-desc {
  margin-top: 12px;
  color: #9ca3af;
  font-size: 0.875rem;
  line-height: 1.6;
}

.footer-col h4 {
  margin-bottom: 16px;
  padding-bottom: 8px;
  color: var(--text-white);
  border-bottom: 1px solid #374151;
  font-size: 0.9rem;
  font-weight: var(--font-semibold);
}

.footer-col ul li {
  margin-bottom: 8px;
}

.footer-col ul li a {
  color: #9ca3af;
  font-size: 0.875rem;
  text-decoration: none;
  transition: color var(--transition-base);
}

.footer-col ul li a:hover {
  color: var(--text-white);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 20px 0;
  color: #9ca3af;
  border-top: 1px solid #374151;
  font-size: 0.8rem;
}

.footer-bottom a {
  color: #9ca3af;
}

.footer-bottom a:hover {
  color: var(--text-white);
}

.footer-bottom-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.privacy-note {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #9ca3af;
  font-size: 0.75rem;
}

/* Back to top */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 80px;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--text-white);
  pointer-events: none;
  cursor: pointer;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: opacity var(--transition-base), transform var(--transition-base), background var(--transition-base);
}

.back-to-top:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.back-to-top.show {
  pointer-events: all;
  opacity: 1;
}

/* Similar tools */
.similar-tools {
  display: flex;
  gap: 12px;
  padding-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

/* Cookie notice */
.cookie-notice {
  position: fixed;
  right: 20px;
  bottom: 20px;
  left: 20px;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 960px;
  margin: 0 auto;
  padding: 14px 16px;
  color: var(--text-white);
  background: var(--bg-dark);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  transition: opacity var(--transition-base), transform var(--transition-base);
}

.cookie-notice.fade-out {
  opacity: 0;
  transform: translateY(10px);
}

.cookie-notice p {
  color: var(--text-white);
  font-size: 0.9rem;
}

.cookie-notice .btn {
  flex-shrink: 0;
}

/* Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.w-full { width: 100%; }
.rounded { border-radius: var(--radius-md); }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Responsive */
@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  .tool-main-area {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --container-pad: 16px;
    --header-height: 60px;
  }

  .header-nav {
    display: none;
  }

  .hamburger-btn {
    display: flex;
  }

  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .section {
    padding: 40px 0;
  }

  .section-lg {
    padding: 56px 0;
  }

  .tool-page-title {
    font-size: 1.5rem;
  }

  .tool-page-subtitle {
    font-size: 1rem;
  }

  .tool-panel {
    padding: 20px;
  }

  .control-grid {
    grid-template-columns: 1fr;
  }

  .upload-zone {
    padding: 36px 18px;
  }

  .preview-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .section-heading h2 {
    font-size: 1.5rem;
  }

  .toast-container {
    right: 16px;
    left: 16px;
  }

  .toast {
    min-width: 0;
    max-width: none;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .tool-page-title {
    font-size: 1.4rem;
  }

  .section-heading h2 {
    font-size: 1.35rem;
  }

  .btn {
    min-height: 48px;
  }

  .btn-full-mobile {
    width: 100%;
  }

  .preset-grid {
    grid-template-columns: 1fr;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .footer-bottom-links {
    justify-content: center;
  }

  .cookie-notice {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 360px) {
  :root {
    --container-pad: 12px;
  }

  .preview-stats {
    grid-template-columns: 1fr;
  }

  .tool-panel {
    padding: 16px;
  }

  .logo-text {
    font-size: 1rem;
  }

  .similar-tools-grid {
    grid-template-columns: 1fr;
  }
}

/* ── PROCESSING SPINNER ────────────────────── */
.processing-spinner {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.93);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  border-radius: inherit;
  z-index: 20;
}
.processing-spinner.show {
  display: flex;
}
.spinner-ring {
  width: 44px;
  height: 44px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── UPLOAD ZONE HIDDEN AFTER UPLOAD ───────── */
.upload-zone.hidden { display: none !important; }

.change-image-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.change-image-bar.show { display: flex; }
.change-image-bar a {
  color: var(--primary);
  cursor: pointer;
  font-weight: 500;
  text-decoration: none;
}
.change-image-bar a:hover { text-decoration: underline; }

/* ── SIMILAR TOOLS HEADING ─────────────────── */
.similar-tools-heading {
  font-size: 1.25rem;
  margin-bottom: 16px;
  color: var(--text-primary);
}

/* ── SIMILAR TOOLS GRID (no overflow) ──────── */
.similar-tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}
@media (max-width: 768px) {
  .similar-tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 400px) {
  .similar-tools-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}
.similar-tool-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 12px;
  text-decoration: none;
  color: inherit;
  background: var(--bg-white);
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: all 200ms;
}
.similar-tool-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  text-decoration: none;
}
.similar-tool-icon { font-size: 1.4rem; line-height: 1; }
.similar-tool-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

/* ── SIDEBAR — RELATED TOOLS ONLY ──────────── */
.sidebar-card h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}
.related-tools-list { list-style: none; }
.related-tools-list li { margin-bottom: 8px; }
.related-tools-list a {
  font-size: 0.8125rem;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}
.related-tools-list a:hover { text-decoration: underline; }

/* ── DIMENSION NOTICE TOAST ─────────────────── */
.dim-notice {
  font-size: 0.78rem;
  color: var(--info);
  background: var(--info-light);
  border-radius: 6px;
  padding: 6px 10px;
  margin-top: 8px;
  display: none;
}
.dim-notice.show { display: block; }

html,
body {
  overflow-x: hidden;
}

.similar-tools-grid .similar-tool-card {
  width: auto;
  min-width: 0;
  max-width: 100%;
}

/* ═══════════════════════════════════════
   DARK MODE
   ═══════════════════════════════════════ */
[data-theme="dark"] {
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --text-muted: #9ca3af;
  --text-light: #6b7280;
  --bg-white: #111827;
  --bg-light: #1f2937;
  --bg-lighter: #374151;
  --bg-card: #1f2937;
  --border: #374151;
  --border-light: #4b5563;
  --border-dark: #6b7280;
  --primary-light: #1e3a5f;
  --primary-hover: #3b82f6;
  --accent-light: #3d1f0d;
  --success-light: #052e16;
  --warning-light: #1c1400;
  --danger-light: #2d0000;
  --info-light: #0c1a3d;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
  --shadow-card: 0 2px 8px rgba(0,0,0,0.4);
  --shadow-card-hover: 0 8px 24px rgba(0,0,0,0.6);
}

html[data-theme="dark"],
html[data-theme="dark"] body {
  background: var(--bg-white);
  color: var(--text-primary);
}

[data-theme="dark"] .site-header,
[data-theme="dark"] #site-header {
  background: rgba(17, 24, 39, 0.96);
  border-bottom-color: var(--border);
}

[data-theme="dark"] .nav-dropdown {
  background: #1f2937;
  border-color: var(--border);
}

[data-theme="dark"] .nav-dropdown a:hover {
  background: #374151;
}

[data-theme="dark"] .mobile-menu,
[data-theme="dark"] .mobile-panel {
  background: #1f2937;
}

[data-theme="dark"] .mobile-links a {
  border-bottom-color: var(--border);
  color: var(--text-primary);
}

[data-theme="dark"] .tool-card {
  background: var(--bg-card);
  border-color: var(--border);
}

[data-theme="dark"] .tool-card:hover {
  background: #253048;
}

[data-theme="dark"] .upload-zone {
  background: var(--bg-card);
  border-color: var(--border);
}

[data-theme="dark"] .upload-zone:hover,
[data-theme="dark"] .upload-zone.dragover {
  background: #253048;
  border-color: var(--primary);
}

[data-theme="dark"] .controls-panel,
[data-theme="dark"] .tool-panel,
[data-theme="dark"] .sidebar,
[data-theme="dark"] .preview-area {
  background: var(--bg-card);
  border-color: var(--border);
}

[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: #1f2937;
  color: var(--text-primary);
  border-color: #4b5563;
}

[data-theme="dark"] input[type="range"] {
  background: var(--border);
}

[data-theme="dark"] .faq-item {
  background: var(--bg-card);
  border-color: var(--border);
}

[data-theme="dark"] .faq-question {
  background: var(--bg-card);
  color: var(--text-primary);
}

[data-theme="dark"] table {
  background: var(--bg-card);
}

[data-theme="dark"] tbody tr:nth-child(even) {
  background: #253048;
}

[data-theme="dark"] td,
[data-theme="dark"] th {
  border-bottom-color: var(--border);
}

[data-theme="dark"] .tag {
  background: #253048;
  color: #93c5fd;
}

[data-theme="dark"] .tag-free {
  background: #052e16;
  color: #6ee7b7;
}

[data-theme="dark"] .tag-pdf {
  background: #1c1400;
  color: #fcd34d;
}

[data-theme="dark"] .hero {
  background: radial-gradient(circle at 20% 20%, rgba(255,107,43,.06), transparent 24%),
    linear-gradient(180deg, #1a2744, #111827 72%);
}

[data-theme="dark"] .hero:before {
  background-image: radial-gradient(rgba(59,130,246,.15) 1px, transparent 1px);
}

[data-theme="dark"] .stat-pill,
[data-theme="dark"] .trust-pill {
  background: #1f2937;
  border-color: var(--border);
  color: var(--text-secondary);
}

[data-theme="dark"] .tool-search {
  background: #1f2937;
  border-color: var(--border);
}

[data-theme="dark"] .tool-search input {
  background: transparent;
  color: var(--text-primary);
}

[data-theme="dark"] .clear-search {
  background: #374151;
  color: var(--text-secondary);
}

[data-theme="dark"] .related-card,
[data-theme="dark"] .quick-tile {
  background: var(--bg-card);
  border-color: var(--border);
}

[data-theme="dark"] .step,
[data-theme="dark"] .testimonial {
  background: var(--bg-card);
  border-color: var(--border);
}

[data-theme="dark"] .cookie {
  background: #0d1117;
}

[data-theme="dark"] .result-box,
[data-theme="dark"] .output-box {
  background: var(--bg-card);
  border-color: var(--border);
}

[data-theme="dark"] .breadcrumb-nav {
  background: var(--bg-light);
  border-bottom-color: var(--border);
}

[data-theme="dark"] .tool-page-hero {
  background: linear-gradient(135deg, #1a2744, #111827);
}

[data-theme="dark"] .section-lite,
[data-theme="dark"] .section-alt,
[data-theme="dark"] section[style*="background:#f9fafb"],
[data-theme="dark"] section[style*="background: #f9fafb"] {
  background: #1f2937 !important;
}

[data-theme="dark"] .spec-table,
[data-theme="dark"] .info-card,
[data-theme="dark"] .notice-box,
[data-theme="dark"] .alert {
  background: var(--bg-card);
  border-color: var(--border);
}

[data-theme="dark"] .processing-spinner {
  background: rgba(17, 24, 39, 0.9);
}

[data-theme="dark"] .spinner-ring {
  border-color: #374151;
  border-top-color: var(--primary);
}

[data-theme="dark"] .spinner-text {
  color: var(--text-muted);
}

/* Dark mode toggle button */
.dark-toggle {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-light);
  color: var(--text-secondary);
  font-size: 1.1rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background var(--transition-base), color var(--transition-base);
  flex-shrink: 0;
}

.dark-toggle:hover {
  background: var(--primary-light);
  color: var(--primary);
}

[data-theme="dark"] .dark-toggle {
  background: #374151;
  border-color: #4b5563;
  color: #fbbf24;
}

[data-theme="dark"] .dark-toggle:hover {
  background: #4b5563;
}

/* ═══════════════════════════════════════
   WHATSAPP SHARE BUTTON
   ═══════════════════════════════════════ */
.share-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  align-items: center;
}

.share-bar-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 600;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.share-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
  text-decoration: none;
}

.share-btn-wa {
  background: #25d366;
  color: #fff;
}

.share-btn-copy {
  background: var(--bg-lighter);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

[data-theme="dark"] .share-btn-copy {
  background: #374151;
  color: var(--text-secondary);
  border-color: var(--border);
}

/* ═══════════════════════════════════════
   PWA INSTALL PROMPT
   ═══════════════════════════════════════ */
.pwa-banner {
  position: fixed;
  bottom: 72px;
  left: 16px;
  right: 16px;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 16px 18px;
  display: none;
  align-items: center;
  gap: 14px;
  z-index: 1100;
  animation: slideUp 0.3s ease;
}

.pwa-banner.show { display: flex; }

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

.pwa-banner-icon { font-size: 2rem; flex-shrink: 0; }

.pwa-banner-text { flex: 1; }
.pwa-banner-text strong { display: block; font-size: 0.9375rem; }
.pwa-banner-text span   { font-size: 0.8125rem; color: var(--text-muted); }

.pwa-banner-actions { display: flex; gap: 8px; flex-shrink: 0; }

.pwa-install-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
}

.pwa-dismiss-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px;
}

[data-theme="dark"] .pwa-banner {
  background: #1f2937;
  border-color: var(--border);
}

/* ═══════════════════════════════════════
   PROGRESS SPINNER ENHANCEMENT
   ═══════════════════════════════════════ */
.spinner-progress {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* ═══════════════════════════════════════
   KEYBOARD SHORTCUT HINT
   ═══════════════════════════════════════ */
.kbd-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

.kbd {
  background: var(--bg-lighter);
  border: 1px solid var(--border-dark);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

[data-theme="dark"] .kbd {
  background: #374151;
  border-color: #6b7280;
}

/* ─── ADDITIONAL DARK MODE FIXES ──────────────────────────── */
[data-theme="dark"] .loading-overlay {
  background: rgba(17, 24, 39, 0.9);
}

[data-theme="dark"] .similar-tool-card {
  background: var(--bg-card);
}

[data-theme="dark"] .sidebar-card {
  border-color: var(--border);
}

[data-theme="dark"] .number-input.input-error {
  background: #1c1010;
  color: #fca5a5;
}

[data-theme="dark"] .input-error-msg {
  background: #1c1010;
  color: #fca5a5;
  border-left-color: #f87171;
}

[data-theme="dark"] .dim-notice {
  color: #93c5fd;
}

[data-theme="dark"] .preview-image-wrap {
  background-color: #1f2937;
  background-image:
    linear-gradient(45deg, #374151 25%, transparent 25%),
    linear-gradient(-45deg, #374151 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #374151 75%),
    linear-gradient(-45deg, transparent 75%, #374151 75%);
}

/* ── PRESET CARD COLLAPSIBLE ──────────────────── */
.preset-card.collapsible .preset-title {
  cursor: pointer;
  user-select: none;
  justify-content: space-between;
}
.preset-card.collapsible .preset-title::after {
  content: '▲';
  font-size: 0.65rem;
  opacity: 0.55;
  flex-shrink: 0;
  margin-left: 6px;
}
.preset-card.collapsible.collapsed .preset-title::after {
  content: '▼';
}
.preset-card.collapsible.collapsed .preset-grid,
.preset-card.collapsible.collapsed .preset-source {
  display: none;
}
.preset-card.upload-done {
  display: none;
}

/* ── RENAME FILE INPUT ────────────────────────── */
.rename-file-group {
  display: none;
  margin-top: 10px;
}
.rename-file-group.visible {
  display: block;
}
.rename-file-label {
  display: block;
  margin-bottom: 4px;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.rename-file-input {
  width: 100%;
  padding: 7px 10px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  box-sizing: border-box;
}
.rename-file-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}
[data-theme="dark"] .rename-file-input {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text-primary);
}

/* ─────────────────────────────────────────────────────────
   Extended inline-style dark mode overrides
   These cover page-specific light backgrounds and hardcoded
   dark text colours that bypass the CSS variable system.
   ───────────────────────────────────────────────────────── */

/* Hero gradient sections */
[data-theme="dark"] section[style*="background:linear-gradient(135deg,#ebf5ff"] {
  background: linear-gradient(135deg,#1a2535 0%,#111827 100%) !important;
}
/* Page h1 with hardcoded near-black colour */
[data-theme="dark"] h1[style*="color:#111827"] { color: #f3f4f6 !important; }

/* Light blue info / summary boxes */
[data-theme="dark"] div[style*="background:#ebf5ff"],
[data-theme="dark"] div[style*="background:#eff6ff"] {
  background: #172554 !important;
  border-color: #1e40af !important;
}
/* Light green info / summary boxes */
[data-theme="dark"] div[style*="background:#f3faf7"] {
  background: #052e16 !important;
  border-color: #065f46 !important;
}
/* Light blue warning strips */
[data-theme="dark"] p[style*="background:#dbeafe"],
[data-theme="dark"] div[style*="background:#dbeafe"] {
  background: #1e3a5f !important;
  color: #93c5fd !important;
}
/* White inline background boxes */
[data-theme="dark"] div[style*="background:white"],
[data-theme="dark"] div[style*="background: white"] {
  background: #1f2937 !important;
  color: #d1d5db !important;
}
/* Light gray card / footer boxes */
[data-theme="dark"] div[style*="background:#f9fafb"] {
  background: #1f2937 !important;
  border-color: #374151 !important;
}
/* Strong headings with hardcoded dark colours */
[data-theme="dark"] strong[style*="color:#1e429f"] { color: #93c5fd !important; }
[data-theme="dark"] strong[style*="color:#057a55"] { color: #6ee7b7 !important; }
/* Paragraph / list text with hardcoded dark colours */
[data-theme="dark"] p[style*="color:#1e429f"]  { color: #93c5fd !important; }
[data-theme="dark"] p[style*="color:#374151"]  { color: #d1d5db !important; }
[data-theme="dark"] ol[style*="color:#374151"] { color: #d1d5db !important; }
/* Table row alternates */
[data-theme="dark"] tr[style*="background:#f9fafb"] { background: #1f2937 !important; }
[data-theme="dark"] tr[style*="background:#f3f4f6"] { background: #374151 !important; }
/* Anchor tag white/light background cards */
[data-theme="dark"] a[style*="background:white"],
[data-theme="dark"] a[style*="background: white"] {
  background: #1f2937 !important;
  color: #93c5fd !important;
}
/* Unordered lists with hardcoded dark gray */
[data-theme="dark"] ul[style*="color:#374151"] { color: #d1d5db !important; }
/* Strong with dark orange-red color */
[data-theme="dark"] strong[style*="color:#9a3412"] { color: #fb923c !important; }
/* Span quality-display badges with light blue background */
[data-theme="dark"] span[style*="background:#ebf5ff"] {
  background: #1e3a5f !important;
  color: #93c5fd !important;
}
/* Yellow/amber warning boxes (signature hint boxes across exam pages) */
[data-theme="dark"] div[style*="background:#fdf6b2"] {
  background: #1c1400 !important;
  border-color: #854d0e !important;
  color: #fcd34d !important;
}
/* Sky-blue paragraph text */
[data-theme="dark"] p[style*="color:#0369a1"] { color: #38bdf8 !important; }
/* Light green boxes (ibps declaration variant) */
[data-theme="dark"] div[style*="background:#f0fdf4"] {
  background: #052e16 !important;
  border-color: #065f46 !important;
}
[data-theme="dark"] p[style*="color:#15803d"] { color: #6ee7b7 !important; }
/* Error message box */
[data-theme="dark"] div[style*="background:#fdf2f2"] {
  background: #2d0000 !important;
  border-color: #7f1d1d !important;
  color: #fca5a5 !important;
}
