/* ═══════════════════════════════════════════════════
   SARKARI RESULT TOOLS — Tool Page Specific Styles
   ═══════════════════════════════════════════════════ */

/* ───────── TOOL PAGE LAYOUT ───────── */
.tool-page {
  padding-top: calc(var(--header-height) + 4px);
  min-height: 100vh;
}

.tool-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--space-6);
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 1440px) {
  .tool-container {
    max-width: 1560px;
  }
}

/* Tool Hero/Header */
.tool-hero {
  text-align: center;
  padding: var(--space-10) 0 var(--space-8);
  animation: fadeInUp 0.5s var(--ease-out);
}

.tool-hero .tool-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}

.tool-hero h1 {
  font-size: var(--text-4xl);
  margin-bottom: var(--space-3);
}

.tool-hero .tool-description {
  font-size: var(--text-lg);
  color: var(--gray-500);
  max-width: 560px;
  margin: 0 auto;
}

/* ───────── TOOL WORKSPACE ───────── */
.tool-workspace {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-card);
  animation: scaleIn 0.4s var(--ease-out) 0.15s both;
}

/* Workspace sections */
.workspace-section {
  margin-bottom: var(--space-6);
}

.workspace-section:last-child {
  margin-bottom: 0;
}

.workspace-section-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--navy);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.workspace-section-title svg {
  width: 18px;
  height: 18px;
  color: var(--saffron);
}

/* Workspace divider */
.workspace-divider {
  height: 1px;
  background: var(--gray-200);
  margin: var(--space-6) 0;
}

/* ───────── FILE UPLOAD ZONE ───────── */
.upload-zone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  padding: var(--space-12) var(--space-6);
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  background: var(--gray-50);
  position: relative;
}

.upload-zone:hover {
  border-color: var(--saffron-light);
  background: rgba(255, 153, 51, 0.02);
}

.upload-zone.dragover {
  border-color: var(--saffron);
  background: rgba(255, 153, 51, 0.05);
  transform: scale(1.01);
}

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

.upload-zone-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-4);
  color: var(--gray-400);
  transition: color var(--duration-normal);
}

.upload-zone:hover .upload-zone-icon {
  color: var(--saffron);
}

.upload-zone h3 {
  font-size: var(--text-lg);
  color: var(--navy);
  margin-bottom: var(--space-2);
}

.upload-zone p {
  font-size: var(--text-sm);
  color: var(--gray-500);
}

.upload-zone .file-types {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  flex-wrap: wrap;
}

.upload-zone .file-type-badge {
  padding: 2px 10px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
}

.upload-zone input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0;
  cursor: pointer;
}

/* ───────── IMAGE PREVIEW ───────── */
.image-preview-container {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
}

.image-preview-container img {
  width: 100%;
  height: auto;
  display: block;
}

.image-preview-overlay {
  position: absolute;
  top: 0;
  right: 0;
  padding: var(--space-2);
  display: flex;
  gap: var(--space-1);
}

.image-info-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
  font-size: var(--text-xs);
  color: var(--gray-600);
  flex-wrap: wrap;
  gap: var(--space-2);
}

.image-info-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.image-info-item strong {
  color: var(--navy);
}

/* ───────── SETTINGS PANEL ───────── */
.settings-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.settings-group label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-700);
}

.settings-group .hint {
  font-size: var(--text-xs);
  color: var(--gray-400);
  margin-top: var(--space-1);
}

/* Range Slider */
.range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--saffron);
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid var(--white);
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-fast);
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.range-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--saffron);
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid var(--white);
  box-shadow: var(--shadow-sm);
}

/* Radio & Checkbox group */
.option-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.option-btn {
  padding: var(--space-2) var(--space-4);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-600);
  background: var(--white);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.option-btn:hover {
  border-color: var(--saffron-light);
  color: var(--saffron);
}

.option-btn.active {
  border-color: var(--saffron);
  background: rgba(255, 153, 51, 0.06);
  color: var(--saffron);
  font-weight: 600;
}

/* Preset size buttons */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-2);
}

.preset-btn {
  padding: var(--space-3);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: var(--white);
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-fast);
}

.preset-btn:hover {
  border-color: var(--saffron-light);
  background: rgba(255, 153, 51, 0.03);
}

.preset-btn.active {
  border-color: var(--saffron);
  background: rgba(255, 153, 51, 0.06);
}

.preset-btn .preset-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--navy);
  display: block;
}

.preset-btn .preset-size {
  font-size: var(--text-xs);
  color: var(--gray-500);
  margin-top: 2px;
}

/* ───────── ACTION BAR ───────── */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  flex-wrap: wrap;
}

.action-bar-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.action-bar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ───────── CANVAS WORKSPACE ───────── */
.canvas-container {
  position: relative;
  background: repeating-conic-gradient(var(--gray-200) 0% 25%, var(--white) 0% 50%) 50% / 16px 16px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.canvas-container canvas {
  max-width: 100%;
  max-height: 500px;
}

/* ───────── OUTPUT / RESULT SECTION ───────── */
.result-section {
  background: var(--success-light);
  border: 1px solid rgba(5, 150, 105, 0.2);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
  animation: bounceIn 0.5s var(--ease-out);
}

.result-section h3 {
  color: var(--success);
  font-size: var(--text-lg);
  margin-bottom: var(--space-3);
}

.result-section .result-preview {
  margin: var(--space-4) 0;
}

.result-section .result-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-8);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.result-stat {
  text-align: center;
}

.result-stat .stat-value {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--navy);
}

.result-stat .stat-label {
  font-size: var(--text-xs);
  color: var(--gray-500);
  margin-top: 2px;
}

/* ───────── COMPARISON LAYOUT ───────── */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.comparison-panel {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.comparison-panel-header {
  padding: var(--space-3) var(--space-4);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--navy);
  text-align: center;
}

.comparison-panel-body {
  padding: var(--space-4);
}

/* ───────── TEMPLATE GALLERY ───────── */
.template-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-4);
}

.template-card {
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
}

.template-card:hover {
  border-color: var(--saffron-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.template-card.selected {
  border-color: var(--saffron);
  box-shadow: 0 0 0 3px rgba(255, 153, 51, 0.15);
}

.template-card .template-preview {
  aspect-ratio: 3/4;
  background: var(--gray-100);
  overflow: hidden;
}

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

.template-card .template-name {
  padding: var(--space-3);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--navy);
  text-align: center;
}

/* ───────── TABS ───────── */
.tool-tabs {
  display: flex !important;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: var(--space-6);
  gap: var(--space-1);
  overflow-x: auto !important;
  max-width: 100% !important;
  -webkit-overflow-scrolling: touch !important;
  scrollbar-width: thin !important;
  box-sizing: border-box !important;
}

.tool-tab {
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--duration-fast);
  white-space: nowrap;
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  flex-shrink: 0 !important;
}

.tool-tab:hover {
  color: var(--navy);
}

.tool-tab.active {
  color: var(--saffron);
  border-bottom-color: var(--saffron);
  font-weight: 600;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn var(--duration-normal) var(--ease-out);
}

/* ───────── HOW TO USE SECTION ───────── */
.how-to-use {
  margin-top: var(--space-12);
  padding: var(--space-10) 0;
}

.how-to-use h2 {
  font-size: var(--text-2xl);
  text-align: center;
  margin-bottom: var(--space-8);
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-6);
  counter-reset: step;
}

.step-card {
  text-align: center;
  position: relative;
}

.step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 153, 51, 0.1);
  color: var(--saffron);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-3);
}

.step-card h3 {
  font-size: var(--text-base);
  margin-bottom: var(--space-2);
}

.step-card p {
  font-size: var(--text-sm);
  color: var(--gray-500);
  line-height: 1.6;
}

/* ───────── FAQ SECTION ───────── */
.faq-section {
  margin-top: var(--space-10);
  padding: var(--space-10) 0;
}

.faq-section h2 {
  font-size: var(--text-2xl);
  text-align: center;
  margin-bottom: var(--space-8);
}

.faq-list {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.faq-item {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--duration-fast);
}

.faq-item:hover {
  border-color: var(--gray-300);
}

.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  background: var(--white);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--navy);
  text-align: left;
  cursor: pointer;
  border: none;
  outline: none;
}

.faq-question svg {
  width: 18px;
  height: 18px;
  color: var(--gray-400);
  transition: transform var(--duration-normal) var(--ease-out);
  flex-shrink: 0;
}

.faq-item.open .faq-question svg {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--duration-slow) var(--ease-out);
}

.faq-item.open .faq-answer {
  max-height: 400px;
}

.faq-answer-inner {
  padding: 0 var(--space-5) var(--space-4);
  font-size: var(--text-sm);
  color: var(--gray-600);
  line-height: 1.7;
}

/* ───────── TOOL-SPECIFIC: TYPING TEST ───────── */
.typing-area {
  font-family: 'Courier New', monospace;
  font-size: var(--text-lg);
  line-height: 2;
  padding: var(--space-6);
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  min-height: 200px;
  position: relative;
}

.typing-text .correct { color: var(--success); }
.typing-text .incorrect { color: var(--error); text-decoration: underline; }
.typing-text .current { background: rgba(255, 153, 51, 0.2); border-bottom: 2px solid var(--saffron); }
.typing-text .pending { color: var(--gray-400); }

.typing-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.typing-stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  text-align: center;
}

.typing-stat-card .stat-value {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--navy);
}

.typing-stat-card .stat-label {
  font-size: var(--text-xs);
  color: var(--gray-500);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ───────── TOOL-SPECIFIC: RESUME/BIODATA ───────── */
.form-section {
  margin-bottom: var(--space-6);
}

.form-section h3 {
  font-size: var(--text-base);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--gray-200);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}

.form-row + .form-row {
  margin-top: var(--space-4);
}

/* Add/Remove repeater */
.repeater-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--gray-50);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
}

.repeater-item .form-fields {
  flex: 1;
}

.repeater-item .remove-btn {
  flex-shrink: 0;
  color: var(--error);
  padding: var(--space-2);
}

.add-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  color: var(--saffron);
  font-size: var(--text-sm);
  font-weight: 600;
  border: 1.5px dashed var(--saffron-light);
  border-radius: var(--radius-md);
  background: rgba(255, 153, 51, 0.03);
  cursor: pointer;
  transition: all var(--duration-fast);
  width: 100%;
  justify-content: center;
}

.add-btn:hover {
  background: rgba(255, 153, 51, 0.08);
  border-color: var(--saffron);
}

/* Preview Panel */
.preview-panel {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  min-height: 800px;
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
}

/* Split layout for resume / biodata / letter / editor tools */
.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.split-layout > :first-child {
  min-width: 0;
  width: 100%;
}

.split-layout > :nth-child(2) {
  min-width: 0;
  width: 100%;
  position: sticky;
  top: calc(var(--header-height, 72px) + 16px);
  max-height: calc(100vh - var(--header-height, 72px) - 24px);
  overflow-y: auto;
  overscroll-behavior: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}

.split-layout > :nth-child(2)::-webkit-scrollbar {
  width: 6px;
}

.split-layout > :nth-child(2)::-webkit-scrollbar-thumb {
  background: var(--gray-300, #cbd5e1);
  border-radius: 3px;
}

@media (max-width: 992px) {
  .split-layout {
    grid-template-columns: 1fr !important;
    display: flex !important;
    flex-direction: column !important;
    gap: var(--space-4) !important;
  }

  .split-layout > :nth-child(2) {
    position: static !important;
    max-height: none !important;
    overflow-y: visible !important;
    padding-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* ───────── RESPONSIVE TOOL PAGES ───────── */
.tool-page,
.tool-container,
.tool-workspace {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.tool-workspace,
.tool-workspace *,
.tool-workspace *::before,
.tool-workspace *::after,
.tool-container,
.tool-container * {
  min-width: 0;
}

#qrGeneratorLayout,
.qr-workspace-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1.15fr) minmax(360px, 0.95fr);
  gap: var(--space-6);
  align-items: start;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.qr-form-column {
  min-width: 0;
  width: 100%;
}

.qr-preview-column {
  min-width: 0;
  width: 100%;
  position: sticky;
  top: calc(var(--header-height, 72px) + 16px);
  max-height: calc(100vh - var(--header-height, 72px) - 24px);
  overflow-y: auto;
  overscroll-behavior: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}

.qr-preview-column::-webkit-scrollbar {
  width: 6px;
}

.qr-preview-column::-webkit-scrollbar-thumb {
  background: var(--gray-300, #cbd5e1);
  border-radius: 3px;
}

.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: var(--space-4);
}

table {
  max-width: 100%;
}

@media (max-width: 992px) {
  #qrGeneratorLayout,
  .qr-workspace-grid {
    grid-template-columns: 1fr !important;
    display: flex !important;
    flex-direction: column !important;
    gap: var(--space-4) !important;
  }

  .qr-form-column,
  .qr-preview-column {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    position: static !important;
    top: auto !important;
  }

  .qr-preview-column canvas,
  #mainQrCanvas {
    max-width: 100% !important;
    height: auto !important;
  }
}

@media (max-width: 768px) {
  .tool-container {
    padding: var(--space-4);
  }

  .tool-workspace {
    padding: var(--space-4);
    border-radius: var(--radius-lg);
  }

  .tool-hero {
    padding: var(--space-6) 0 var(--space-4);
  }

  .tool-hero h1 {
    font-size: var(--text-2xl);
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .settings-panel {
    grid-template-columns: 1fr;
  }

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

  .preview-panel {
    min-height: auto;
    padding: var(--space-4);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

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

  .steps-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .action-bar {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }

  .action-bar-left,
  .action-bar-right {
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .upload-zone {
    padding: var(--space-8) var(--space-4);
  }

  .template-gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }

  /* Flexible button bars */
  .tool-workspace > div[style*="display: flex"],
  .field-subgroup > div[style*="display: flex"],
  .form-row,
  .tool-toolbar {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .tool-workspace button,
  .tool-workspace .btn {
    max-width: 100%;
    box-sizing: border-box;
  }
}

@media (max-width: 480px) {
  .tool-container {
    padding: 12px 8px !important;
  }

  .tool-workspace {
    padding: 14px 10px !important;
  }
}

@media (max-width: 680px) {
  /* Prevent side-by-side grid columns from squishing inputs or breaking width anywhere in tool workspace */
  .tool-workspace [style*="grid-template-columns: 1fr 1fr"],
  .tool-workspace [style*="grid-template-columns: 1fr 1.2fr"],
  .tool-workspace [style*="grid-template-columns: 1.2fr 1fr"],
  .tool-workspace [style*="grid-template-columns: 1.15fr 0.95fr"],
  .tool-workspace [style*="grid-template-columns: 1fr 1fr 1fr"],
  .tool-workspace [style*="grid-template-columns: repeat(2"],
  .tool-workspace [style*="grid-template-columns: repeat(3"],
  .qr-preview-column [style*="grid-template-columns"],
  .qr-form-column [style*="grid-template-columns"],
  .field-subgroup [style*="grid-template-columns"],
  .settings-group [style*="grid-template-columns"],
  .schema-form-section [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .tool-workspace div[style*="display: flex"],
  .tool-workspace [style*="display: flex; gap"] {
    flex-wrap: wrap !important;
  }

  .qr-mode-btn {
    white-space: normal !important;
    text-align: center !important;
    padding: 8px 10px !important;
    font-size: 12px !important;
  }

  /* Printable & Invoice Sheets on Mobile */
  #billPaper,
  .printable-sheet,
  .resume-paper,
  .biodata-paper {
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: auto !important;
    padding: 14px !important;
  }

  #billPaper > div:first-child {
    flex-direction: column !important;
    gap: 12px !important;
  }

  #billPaper > div:first-child > div:last-child {
    text-align: left !important;
  }
}

@media (max-width: 480px) {
  .tool-hero .tool-icon {
    width: 48px;
    height: 48px;
    font-size: 24px;
  }

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

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

  .btn {
    font-size: 13px;
    padding: 8px 14px;
  }
}

/* ═══════════════════════════════════════════════════
   AI DETECTOR & PLAGIARISM CHECKER STYLES
   ═══════════════════════════════════════════════════ */
.ai-score-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.ai-gauge-card {
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 24px;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
  position: relative;
  overflow: hidden;
}

.ai-gauge-svg {
  width: 140px;
  height: 140px;
  margin: 0 auto 12px;
  transform: rotate(-90deg);
}

.ai-gauge-bg {
  fill: none;
  stroke: #f1f5f9;
  stroke-width: 12;
}

.ai-gauge-meter {
  fill: none;
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s ease, stroke 0.4s ease;
}

.ai-gauge-text {
  position: absolute;
  top: 66px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 700;
  color: var(--gray-900);
}

.ai-highlight-view {
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  font-size: 15px;
  line-height: 1.8;
  max-height: 380px;
  overflow-y: auto;
  color: #1e293b;
  margin-bottom: var(--space-4);
}

.ai-sent {
  padding: 2px 4px;
  margin: 0 1px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.ai-sent:hover {
  filter: brightness(0.92);
  outline: 1.5px solid currentColor;
}

.ai-sent.high-ai {
  background: #fee2e2;
  color: #991b1b;
  border-bottom: 2px solid #ef4444;
}

.ai-sent.medium-ai {
  background: #fef3c7;
  color: #92400e;
  border-bottom: 2px solid #f59e0b;
}

.ai-sent.human {
  background: #dcfce7;
  color: #166534;
  border-bottom: 2px solid #22c55e;
}

.ai-sent.plagiarized {
  background: #f3e8ff;
  color: #6b21a8;
  border-bottom: 2px dashed #9333ea;
}

.ai-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: var(--space-4);
}

.ai-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ai-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

/* ═══════════════════════════════════════════════════
   QR STUDIO & SCANNER & BARCODE STYLES
   ═══════════════════════════════════════════════════ */
.qr-tab-nav {
  display: flex;
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  gap: 6px;
  padding-bottom: 8px;
  margin-bottom: var(--space-6);
  border-bottom: 1.5px solid var(--border-color);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.qr-tab-nav::-webkit-scrollbar {
  height: 4px;
}

.qr-tab-btn,
.qr-nav-pill {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--gray-700);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.qr-tab-btn:hover,
.qr-nav-pill:hover {
  background: #f1f5f9;
  border-color: var(--navy);
  color: var(--navy);
}

.qr-tab-btn.active,
.qr-nav-pill.active {
  background: var(--navy);
  color: #ffffff;
  border-color: var(--navy);
  box-shadow: 0 4px 10px rgba(26, 35, 126, 0.15);
}

/* QR Scanner Viewfinder */
.scanner-viewport {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 320px;
  margin: 0 auto 16px;
  background: #000000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.scanner-laser {
  width: 220px;
  height: 220px;
  border: 2px solid #22c55e;
  border-radius: 12px;
  position: relative;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.scanner-laser::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  animation: laserScan 2s infinite ease-in-out;
}

@keyframes laserScan {
  0%, 100% { top: 5%; }
  50% { top: 95%; }
}

/* Barcode Printable Sheet */
.barcode-sheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  background: #ffffff;
  padding: 20px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
}

.barcode-label-item {
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  padding: 10px;
  text-align: center;
  background: #ffffff;
}

.barcode-label-item svg {
  max-width: 100%;
  height: auto;
}

/* ───────── SEO & DIGITAL MARKETING TOOLS STYLES ───────── */

/* Authority & Metrics Grid */
.seo-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.seo-metric-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  text-align: center;
  position: relative;
  transition: all 0.2s ease;
}

.seo-metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--navy);
  box-shadow: 0 4px 12px rgba(26, 35, 126, 0.08);
}

.seo-metric-gauge {
  width: 96px;
  height: 96px;
  margin: 0 auto 12px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.seo-metric-gauge svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.seo-metric-gauge circle {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
}

.seo-metric-gauge .gauge-bg {
  stroke: var(--gray-200);
}

.seo-metric-gauge .gauge-fill {
  transition: stroke-dashoffset 1s ease-in-out;
}

.seo-gauge-val {
  position: absolute;
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
}

.seo-metric-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 4px;
}

.seo-metric-desc {
  font-size: 11px;
  color: var(--gray-500);
}

/* DNS Records & Audit Table */
.dns-table-container {
  overflow-x: auto;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  background: var(--white);
  margin-top: 16px;
}

.dns-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.dns-table th {
  background: var(--gray-100);
  padding: 12px 14px;
  font-weight: 600;
  color: var(--navy);
  border-bottom: 1px solid var(--gray-200);
}

.dns-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-100);
  font-family: var(--font-mono, monospace);
  word-break: break-all;
}

.dns-type-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.dns-badge-a { background: #dbeafe; color: #1e40af; }
.dns-badge-aaaa { background: #e0e7ff; color: #4338ca; }
.dns-badge-mx { background: #fef3c7; color: #92400e; }
.dns-badge-txt { background: #f3e8ff; color: #6b21a8; }
.dns-badge-ns { background: #dcfce7; color: #166534; }
.dns-badge-cname { background: #fee2e2; color: #991b1b; }
.dns-badge-soa { background: #f1f5f9; color: #475569; }

/* Status Badges */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
}
.status-pill.pass { background: #dcfce7; color: #15803d; }
.status-pill.warn { background: #fef3c7; color: #b45309; }
.status-pill.fail { background: #fee2e2; color: #b91c1c; }

/* Audit Checklist */
.seo-audit-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.seo-audit-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease;
}

.seo-audit-item:hover {
  border-color: var(--gray-300);
}

.seo-audit-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 13px;
  font-weight: bold;
}

.seo-audit-icon.pass { background: #dcfce7; color: #16a34a; }
.seo-audit-icon.warn { background: #fef9c3; color: #ca8a04; }
.seo-audit-icon.fail { background: #fee2e2; color: #dc2626; }

.seo-audit-info {
  flex: 1;
}

.seo-audit-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 2px;
}

.seo-audit-detail {
  font-size: 12px;
  color: var(--gray-600);
  line-height: 1.4;
}

/* SERP Google Simulator Box */
.serp-card {
  background: #ffffff;
  border: 1px solid #dfe1e5;
  border-radius: 8px;
  padding: 16px;
  max-width: 650px;
  box-shadow: 0 1px 6px rgba(32,33,36,0.1);
  font-family: Arial, sans-serif;
}

.serp-url-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #202124;
  margin-bottom: 4px;
}

.serp-favicon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f1f3f4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.serp-site-name {
  font-size: 14px;
  color: #202124;
  font-weight: 400;
}

.serp-breadcrumb {
  font-size: 12px;
  color: #4d5156;
}

.serp-title {
  color: #1a0dab;
  font-size: 20px;
  line-height: 1.3;
  font-weight: 400;
  text-decoration: none;
  cursor: pointer;
  margin-bottom: 4px;
  display: block;
}

.serp-title:hover {
  text-decoration: underline;
}

.serp-desc {
  color: #4d5156;
  font-size: 14px;
  line-height: 1.58;
  word-wrap: break-word;
}

.serp-desc strong {
  color: #202124;
}

.serp-pixel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 11px;
  color: var(--gray-500);
}

.pixel-meter {
  height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
  overflow: hidden;
  margin: 4px 0 8px;
}

.pixel-meter-fill {
  height: 100%;
  background: #16a34a;
  transition: width 0.2s ease, background-color 0.2s ease;
}

.pixel-meter-fill.warning { background: #eab308; }
.pixel-meter-fill.danger { background: #dc2626; }

/* Social Card Previews (FB / Twitter) */
.social-preview-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 20px;
}

@media (min-width: 768px) {
  .social-preview-container {
    grid-template-columns: 1fr 1fr;
  }
}

.fb-card-preview {
  background: #ffffff;
  border: 1px solid #ced0d4;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.fb-card-img {
  width: 100%;
  height: 180px;
  background: #e9ebee;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8d949e;
  font-size: 13px;
  background-size: cover;
  background-position: center;
}

.fb-card-content {
  padding: 10px 12px;
  background: #f2f3f5;
  border-top: 1px solid #e5e5e5;
}

.fb-card-domain {
  font-size: 11px;
  color: #606770;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.fb-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #1d2129;
  line-height: 1.3;
  margin-bottom: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fb-card-desc {
  font-size: 12px;
  color: #606770;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tw-card-preview {
  background: #ffffff;
  border: 1px solid #cfd9de;
  border-radius: 16px;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ═══════════════════════════════════════════════════
   UNIVERSAL 50/50 TOOL SPLIT LAYOUT
   Left half = editor/inputs, Right half = live output/preview.
   Desktop (≥1024px): side-by-side equal halves, output sticky.
   Mobile/tablet: stacked (inputs first, output below).
   ═══════════════════════════════════════════════════ */
.tool-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.tool-split-inputs,
.tool-split-output {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.tool-split-output canvas,
.tool-split-output img,
.tool-split-output svg,
.tool-split-output video {
  max-width: 100%;
  height: auto;
}

@media (min-width: 992px) {
  .tool-split {
    grid-template-columns: minmax(420px, 1.15fr) minmax(380px, 1fr);
    gap: var(--space-6);
    align-items: start;
  }

  .tool-split-output {
    position: sticky;
    top: calc(var(--header-height, 72px) + 16px);
    max-height: calc(100vh - var(--header-height, 72px) - 24px);
    overflow-y: auto;
    overscroll-behavior: auto;
    padding-right: 4px;
    scrollbar-width: thin;
  }

  .tool-split-output::-webkit-scrollbar {
    width: 6px;
  }

  .tool-split-output::-webkit-scrollbar-thumb {
    background: var(--gray-300, #cbd5e1);
    border-radius: 3px;
  }
}

.tw-card-img {
  width: 100%;
  height: 180px;
  background: #eff3f4;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #536471;
  font-size: 13px;
  background-size: cover;
  background-position: center;
}

.tw-card-content {
  padding: 10px 14px;
}

.tw-card-domain {
  font-size: 12px;
  color: #536471;
  margin-bottom: 2px;
}

.tw-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f1419;
  line-height: 1.3;
  margin-bottom: 2px;
}

.tw-card-desc {
  font-size: 13px;
  color: #536471;
  line-height: 1.35;
}

/* Code Previews */
.code-preview-box {
  background: #1e1e2e;
  color: #cdd6f4;
  border-radius: var(--radius-lg);
  padding: 16px;
  font-family: var(--font-mono, 'Consolas', monospace);
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  position: relative;
  max-height: 400px;
}

.code-preview-box pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.copy-code-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 6px;
  color: #ffffff;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-code-btn:hover {
  background: rgba(255,255,255,0.25);
}

/* Keyword Density Table */
.keyword-stat-badges {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.keyword-stat-box {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
}

.keyword-stat-number {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
}

.keyword-stat-label {
  font-size: 11px;
  color: var(--gray-500);
  text-transform: uppercase;
}

.quick-tag-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.quick-tag-pill {
  padding: 4px 10px;
  border-radius: 9999px;
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  font-size: 12px;
  color: var(--gray-700);
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-tag-pill:hover {
  background: var(--navy);
  color: #ffffff;
  border-color: var(--navy);
}

/* ───────── DOMAIN AVAILABILITY CHECKER STYLES ───────── */
.domain-results-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.domain-result-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  transition: all 0.2s ease;
  flex-wrap: wrap;
  gap: 14px;
}

.domain-result-card:hover {
  border-color: var(--navy);
  box-shadow: 0 4px 14px rgba(26, 35, 126, 0.08);
}

.domain-result-card.is-available {
  border-left: 5px solid #16a34a;
  background: #f0fdf4;
}

.domain-result-card.is-taken {
  border-left: 5px solid #dc2626;
  background: #fef2f2;
}

.domain-result-card.is-checking {
  border-left: 5px solid var(--gray-400);
  background: #f8fafc;
}

.domain-name-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.domain-ext-badge {
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--navy);
  color: #ffffff;
}

.domain-full-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.3px;
}

.domain-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 9999px;
  text-transform: uppercase;
}

.domain-status-badge.available {
  background: #dcfce7;
  color: #15803d;
  box-shadow: 0 0 0 1px #86efac;
}

.domain-status-badge.taken {
  background: #fee2e2;
  color: #b91c1c;
}

.domain-status-badge.checking {
  background: #f1f5f9;
  color: #64748b;
}

.domain-price-pill {
  font-size: 14px;
  font-weight: 700;
  color: var(--saffron-dark);
}

.domain-actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Suggestion Grid */
.domain-suggestions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.domain-sugg-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: all 0.2s ease;
}

.domain-sugg-card:hover {
  border-color: var(--navy);
  transform: translateY(-2px);
}

/* ═══ DARK MODE — tool surfaces (style.css has the variable flips) ═══ */
body.dark .ai-gauge-card,
body.dark .ai-highlight-view,
body.dark .qr-nav-pill,
body.dark .barcode-sheet-grid,
body.dark .barcode-label-item,
body.dark .dns-badge-soa,
body.dark .domain-result-card.is-checking {
  background: #16202F;
  border-color: #24324B;
}

body.dark .serp-card {
  background: #FFFFFF;
}

body.dark .domain-status-badge.checking {
  background: #3D2E0F;
  color: #FCD34D;
}

body.dark .qr-tab-btn,
body.dark .qr-nav-pill {
  background: #16202F;
  border-color: #24324B;
  color: #D0D9E8;
}

body.dark .qr-tab-btn:hover,
body.dark .qr-nav-pill:hover {
  background: #1D2A40;
  border-color: #A9B6FF;
  color: #C3CCFF;
}


/* ───────── IMAGE TO TEXT (OCR) STYLES ───────── */
.ocr-batch-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--gray-50, #f8fafc);
  border: 1px solid var(--gray-200, #e2e8f0);
  padding: 14px 18px;
  border-radius: var(--radius-xl, 12px);
  margin-bottom: 24px;
  box-sizing: border-box;
  width: 100%;
}

body.dark .ocr-batch-bar {
  background: #16202F;
  border-color: #24324B;
}

.ocr-batch-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700, #334155);
}

body.dark .ocr-batch-stats {
  color: #D0D9E8;
}

.ocr-batch-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ocr-progress-container {
  width: 100%;
  height: 8px;
  background: var(--gray-200, #e2e8f0);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 10px;
}

body.dark .ocr-progress-container {
  background: #24324B;
}

.ocr-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  transition: width 0.3s ease;
  border-radius: 4px;
}

.ocr-progress-fill.animated {
  background-size: 20px 20px;
  background-image: linear-gradient(45deg, rgba(255,255,255,0.2) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.2) 75%, transparent 75%, transparent);
  animation: ocrProgressStripes 1s linear infinite;
}

@keyframes ocrProgressStripes {
  0% { background-position: 0 0; }
  100% { background-position: 20px 0; }
}

.ocr-card {
  background: var(--white, #ffffff);
  border: 1px solid var(--gray-200, #e2e8f0);
  border-radius: var(--radius-xl, 12px);
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  transition: all 0.2s ease;
  overflow: hidden;
  box-sizing: border-box;
  width: 100%;
}

body.dark .ocr-card {
  background: #111a28;
  border-color: #24324B;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.ocr-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.08);
}

body.dark .ocr-card:hover {
  border-color: #3b82f6;
}

.ocr-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--gray-50, #f8fafc);
  border-bottom: 1px solid var(--gray-200, #e2e8f0);
  flex-wrap: wrap;
  gap: 10px;
}

body.dark .ocr-card-header {
  background: #16202F;
  border-bottom-color: #24324B;
}

.ocr-card-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.ocr-thumbnail {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--gray-300, #cbd5e1);
  background: #ffffff;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.ocr-thumbnail:hover {
  transform: scale(1.08);
}

.ocr-file-info {
  min-width: 0;
}

.ocr-file-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

body.dark .ocr-file-name {
  color: #F8FAFC;
}

.ocr-file-meta {
  font-size: 12px;
  color: var(--gray-500, #64748b);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

body.dark .ocr-file-meta {
  color: #94A3B8;
}

.ocr-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.ocr-badge.status-ready {
  background: #e0f2fe;
  color: #0369a1;
}

.ocr-badge.status-processing {
  background: #fef3c7;
  color: #b45309;
}

.ocr-badge.status-done {
  background: #dcfce7;
  color: #15803d;
}

.ocr-badge.status-error {
  background: #fee2e2;
  color: #b91c1c;
}

.ocr-badge.confidence-high {
  background: #dcfce7;
  color: #166534;
}

.ocr-badge.confidence-mid {
  background: #fef9c3;
  color: #854d0e;
}

.ocr-badge.confidence-low {
  background: #fee2e2;
  color: #991b1b;
}

.ocr-card-body {
  padding: 16px 18px;
}

.ocr-textarea {
  width: 100%;
  min-height: 140px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--gray-300, #cbd5e1);
  background: #ffffff;
  color: var(--gray-900, #0f172a);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

body.dark .ocr-textarea {
  background: #0d1522;
  border-color: #24324B;
  color: #F8FAFC;
}

.ocr-textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.ocr-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  background: var(--gray-50, #f8fafc);
  border-top: 1px solid var(--gray-200, #e2e8f0);
  flex-wrap: wrap;
  gap: 8px;
}

body.dark .ocr-card-footer {
  background: #16202F;
  border-top-color: #24324B;
}

.ocr-counts {
  font-size: 12px;
  color: var(--gray-500, #64748b);
  display: flex;
  gap: 12px;
}

body.dark .ocr-counts {
  color: #94A3B8;
}

.ocr-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.ocr-btn-sm {
  font-size: 11px !important;
  padding: 4px 10px !important;
  border-radius: 6px !important;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

/* Image preview modal */
.ocr-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 16px;
}

.ocr-modal-content {
  background: #ffffff;
  border-radius: 12px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  position: relative;
  padding: 16px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

body.dark .ocr-modal-content {
  background: #111a28;
}

.ocr-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 24px;
  background: none;
  border: none;
  cursor: pointer;
  color: #64748b;
}

@media (max-width: 600px) {
  .ocr-card-header,
  .ocr-card-footer,
  .ocr-batch-bar {
    flex-direction: column;
    align-items: flex-start !important;
  }
  .ocr-card-actions,
  .ocr-batch-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .ocr-file-name {
    max-width: 200px;
  }
}


/* ───────── TECH DETECTOR / WAPPALYZER STYLES ───────── */
.tech-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.tech-summary-card {
  background: var(--white, #ffffff);
  border: 1px solid var(--gray-200, #e2e8f0);
  border-radius: var(--radius-lg, 10px);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

body.dark .tech-summary-card {
  background: #111a28;
  border-color: #24324B;
}

.tech-summary-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.tech-summary-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy, #0f172a);
  line-height: 1.2;
}

body.dark .tech-summary-val {
  color: #F8FAFC;
}

.tech-summary-label {
  font-size: 12px;
  color: var(--gray-500, #64748b);
  margin-top: 2px;
}

body.dark .tech-summary-label {
  color: #94A3B8;
}

.tech-category-section {
  margin-bottom: 24px;
}

.tech-category-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy, #0f172a);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

body.dark .tech-category-title {
  color: #F8FAFC;
}

.tech-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.tech-item-card {
  background: var(--white, #ffffff);
  border: 1px solid var(--gray-200, #e2e8f0);
  border-radius: var(--radius-lg, 10px);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: all 0.2s ease;
  position: relative;
}

body.dark .tech-item-card {
  background: #111a28;
  border-color: #24324B;
}

.tech-item-card:hover {
  border-color: #93c5fd;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.08);
}

body.dark .tech-item-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tech-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: var(--gray-100, #f1f5f9);
  flex-shrink: 0;
}

body.dark .tech-item-icon {
  background: #1e293b;
}

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

.tech-item-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy, #0f172a);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

body.dark .tech-item-name {
  color: #F8FAFC;
}

.tech-item-version {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: #e0f2fe;
  color: #0369a1;
}

body.dark .tech-item-version {
  background: #0c4a6e;
  color: #bae6fd;
}

.tech-item-desc {
  font-size: 12px;
  color: var(--gray-500, #64748b);
  margin-top: 3px;
  line-height: 1.4;
}

body.dark .tech-item-desc {
  color: #94A3B8;
}

.tech-item-evidence {
  font-size: 11px;
  font-family: var(--font-mono, monospace);
  color: #059669;
  background: #ecfdf5;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 6px;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.dark .tech-item-evidence {
  background: #064e3b;
  color: #6ee7b7;
}

/* Shopify Highlight Box */
.shopify-store-alert {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 1.5px solid #86efac;
  border-radius: var(--radius-xl, 12px);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

body.dark .shopify-store-alert {
  background: linear-gradient(135deg, #064e3b22 0%, #064e3b44 100%);
  border-color: #059669;
}

.shopify-alert-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.shopify-alert-title {
  font-size: 15px;
  font-weight: 700;
  color: #166534;
}

body.dark .shopify-alert-title {
  color: #86efac;
}

.shopify-alert-desc {
  font-size: 12px;
  color: #15803d;
  margin-top: 2px;
}

body.dark .shopify-alert-desc {
  color: #bbf7d0;
}


/* ───────── WEBSITE ANALYZER STYLES ───────── */
.analyzer-bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.analyzer-bento-card {
  background: var(--white, #ffffff);
  border: 1px solid var(--gray-200, #e2e8f0);
  border-radius: var(--radius-xl, 12px);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
  transition: all 0.2s ease;
}

body.dark .analyzer-bento-card {
  background: #111a28;
  border-color: #24324B;
}

.analyzer-bento-card:hover {
  border-color: #93c5fd;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.08);
}

body.dark .analyzer-bento-card:hover {
  border-color: #3b82f6;
}

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

.analyzer-bento-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

body.dark .analyzer-bento-title {
  color: #94A3B8;
}

.analyzer-score-num {
  font-size: 32px;
  font-weight: 800;
  color: var(--navy, #0f172a);
  line-height: 1.1;
  font-family: var(--font-heading, sans-serif);
}

body.dark .analyzer-score-num {
  color: #F8FAFC;
}

.analyzer-score-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}

/* Social links pill grid */
.analyzer-social-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.analyzer-social-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--gray-50, #f8fafc);
  border: 1px solid var(--gray-200, #e2e8f0);
  border-radius: 10px;
  text-decoration: none;
  color: var(--navy, #0f172a);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
  overflow: hidden;
}

body.dark .analyzer-social-pill {
  background: #16202F;
  border-color: #24324B;
  color: #F8FAFC;
}

.analyzer-social-pill:hover {
  transform: translateY(-2px);
  border-color: #3b82f6;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.12);
}

.analyzer-social-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  color: #ffffff;
}

.analyzer-social-handle {
  font-size: 11px;
  font-weight: 400;
  color: var(--gray-500, #64748b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

body.dark .analyzer-social-handle {
  color: #94A3B8;
}

/* Meta Ads Callout Card */
.analyzer-ads-banner {
  background: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 100%);
  border: 1.5px solid #93c5fd;
  border-radius: var(--radius-xl, 12px);
  padding: 18px 22px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

body.dark .analyzer-ads-banner {
  background: linear-gradient(135deg, #1e3a8a22 0%, #0369a122 100%);
  border-color: #1d4ed8;
}

.analyzer-ads-title {
  font-size: 16px;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 4px;
}

body.dark .analyzer-ads-title {
  color: #93c5fd;
}

.analyzer-ads-desc {
  font-size: 13px;
  color: #1e3a8a;
  line-height: 1.4;
}

body.dark .analyzer-ads-desc {
  color: #bfdbfe;
}

/* Contact Details List */
.analyzer-contact-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.analyzer-contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--gray-50, #f8fafc);
  border-radius: 8px;
  font-size: 13px;
  word-break: break-all;
}

body.dark .analyzer-contact-item {
  background: #16202F;
  border: 1px solid #24324B;
}

@media (max-width: 600px) {
  .analyzer-bento-grid {
    grid-template-columns: 1fr;
  }
  .analyzer-ads-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}


/* ═══════════════════════════════════════════════════
   ALL TOOLS DIRECTORY (tools.html) - LIVE FILTERS & DIRECTORY
   ═══════════════════════════════════════════════════ */

.directory-page-hero {
  text-align: center;
  padding: 36px 16px 28px;
  background: linear-gradient(180deg, rgba(79, 70, 229, 0.05) 0%, transparent 100%);
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 32px;
}

body.dark .directory-page-hero {
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.08) 0%, transparent 100%);
  border-color: #24324B;
}

.directory-page-hero h1 {
  font-size: clamp(24px, 3.5vw, 36px);
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

body.dark .directory-page-hero h1 {
  color: #F8FAFC;
}

.directory-page-hero p {
  font-size: 15px;
  color: var(--gray-600);
  max-width: 680px;
  margin: 0 auto;
  line-height: 1.6;
}

body.dark .directory-page-hero p {
  color: #94A3B8;
}

.directory-layout {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 32px;
  align-items: start;
  margin-bottom: 60px;
}

/* Sidebar (Left Hand Side) */
.directory-sidebar {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl, 16px);
  padding: 22px;
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  scrollbar-width: thin;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.dark .directory-sidebar {
  background: #111C2E;
  border-color: #24324B;
  box-shadow: none;
}

.directory-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-200);
}

body.dark .directory-sidebar-header {
  border-color: #24324B;
}

.directory-sidebar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

body.dark .directory-sidebar-title {
  color: #F8FAFC;
}

.btn-sidebar-reset {
  background: transparent;
  border: none;
  font-size: 12px;
  font-weight: 600;
  color: #4f46e5;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}

.btn-sidebar-reset:hover {
  background: #eef2ff;
}

body.dark .btn-sidebar-reset {
  color: #818cf8;
}

body.dark .btn-sidebar-reset:hover {
  background: rgba(99, 102, 241, 0.15);
}

.filter-section {
  margin-bottom: 22px;
}

.filter-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.filter-category-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-category-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

body.dark .filter-category-btn {
  color: #CBD5E1;
}

.filter-category-btn:hover {
  background: var(--gray-100);
  color: var(--navy);
}

body.dark .filter-category-btn:hover {
  background: #1E293B;
  color: #F8FAFC;
}

.filter-category-btn.active {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #4f46e5;
  font-weight: 700;
}

body.dark .filter-category-btn.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
}

.filter-cat-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.filter-cat-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-count-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 12px;
  background: var(--gray-100);
  color: var(--gray-600);
  flex-shrink: 0;
}

body.dark .filter-count-badge {
  background: #1E293B;
  color: #94A3B8;
}

.filter-category-btn.active .filter-count-badge {
  background: #4f46e5;
  color: #fff;
}

/* Badge / Status Filter Pills */
.filter-badge-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-badge-pill {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}

body.dark .filter-badge-pill {
  background: #1E293B;
  color: #94A3B8;
}

.filter-badge-pill:hover {
  background: var(--gray-200);
  color: var(--navy);
}

body.dark .filter-badge-pill:hover {
  background: #334155;
  color: #F8FAFC;
}

.filter-badge-pill.active {
  background: #4f46e5;
  color: #fff;
  border-color: #4f46e5;
}

/* Quick Keyword Tags */
.filter-tags-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-tag-chip {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  background: var(--gray-50);
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
  cursor: pointer;
  transition: all 0.15s;
}

body.dark .filter-tag-chip {
  background: #16202F;
  border-color: #24324B;
  color: #94A3B8;
}

.filter-tag-chip:hover {
  border-color: #4f46e5;
  color: #4f46e5;
}

body.dark .filter-tag-chip:hover {
  border-color: #818cf8;
  color: #818cf8;
}

.filter-tag-chip.active {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #fff;
  font-weight: 600;
}

/* Main Content Area */
.directory-main {
  min-width: 0;
}

/* Top Control Bar */
.directory-topbar {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl, 16px);
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.dark .directory-topbar {
  background: #111C2E;
  border-color: #24324B;
  box-shadow: none;
}

.topbar-controls-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.dir-search-wrap {
  flex: 1;
  min-width: 220px;
  position: relative;
}

.dir-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--gray-400);
  pointer-events: none;
}

.dir-search-input {
  width: 100%;
  padding: 10px 38px 10px 40px;
  border-radius: 10px;
  border: 1px solid var(--gray-300);
  font-size: 14px;
  font-family: var(--font-body);
  background: var(--white);
  color: var(--gray-900);
  transition: border-color 0.2s, box-shadow 0.2s;
}

body.dark .dir-search-input {
  background: #0B1322;
  border-color: #24324B;
  color: #F8FAFC;
}

.dir-search-input:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.dir-search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  font-size: 14px;
  color: var(--gray-400);
  cursor: pointer;
  padding: 4px;
  display: none;
}

.dir-search-clear:hover {
  color: var(--gray-700);
}

.topbar-right-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dir-sort-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dir-sort-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  white-space: nowrap;
}

.dir-sort-select {
  padding: 9px 30px 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--gray-300);
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-800);
  background: var(--white);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

body.dark .dir-sort-select {
  background-color: #0B1322;
  border-color: #24324B;
  color: #F8FAFC;
}

.dir-view-toggle {
  display: flex;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  overflow: hidden;
  background: var(--white);
}

body.dark .dir-view-toggle {
  background: #0B1322;
  border-color: #24324B;
}

.dir-view-btn {
  background: transparent;
  border: none;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--gray-500);
  transition: all 0.15s;
}

.dir-view-btn.active {
  background: #eef2ff;
  color: #4f46e5;
}

body.dark .dir-view-btn.active {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

/* Active Filter Chips Row */
.dir-chips-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--gray-100);
  flex-wrap: wrap;
  gap: 8px;
}

body.dark .dir-chips-row {
  border-color: #1E293B;
}

.dir-chips-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.dir-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #4338ca;
  font-size: 12px;
  font-weight: 500;
  border-radius: 16px;
}

body.dark .dir-chip {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
}

.dir-chip-remove {
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
}

.dir-chip-remove:hover {
  color: #1e1b4b;
}

.dir-results-counter {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
}

body.dark .dir-results-counter {
  color: #94A3B8;
}

/* Mobile Filter Drawer Button */
.btn-mobile-filter {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* Grid View for Tools */
.directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.directory-tool-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl, 16px);
  padding: 22px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
}

body.dark .directory-tool-card {
  background: #111C2E;
  border-color: #24324B;
}

.directory-tool-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.08);
  border-color: #c7d2fe;
}

body.dark .directory-tool-card:hover {
  border-color: #6366f1;
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.4);
}

.dir-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.dir-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.dir-card-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}

.dir-card-badge.badge-popular {
  background: #fef3c7;
  color: #b45309;
}

.dir-card-badge.badge-new {
  background: #dcfce7;
  color: #15803d;
}

.dir-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
  line-height: 1.35;
}

body.dark .dir-card-title {
  color: #F8FAFC;
}

.dir-card-desc {
  font-size: 13px;
  color: var(--gray-600);
  line-height: 1.5;
  margin-bottom: 16px;
  flex: 1;
}

body.dark .dir-card-desc {
  color: #94A3B8;
}

.dir-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--gray-100);
  font-size: 12px;
}

body.dark .dir-card-footer {
  border-color: #1E293B;
}

.dir-card-cat {
  color: var(--gray-500);
  font-weight: 500;
}

body.dark .dir-card-cat {
  color: #64748B;
}

.dir-card-arrow {
  color: #4f46e5;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: transform 0.2s;
}

.directory-tool-card:hover .dir-card-arrow {
  transform: translateX(4px);
}

/* List View for Tools */
.directory-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.directory-list-item {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  text-decoration: none;
  transition: all 0.2s;
}

body.dark .directory-list-item {
  background: #111C2E;
  border-color: #24324B;
}

.directory-list-item:hover {
  border-color: #4f46e5;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.08);
}

.dir-list-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.dir-list-info {
  min-width: 0;
}

.dir-list-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dir-list-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
}

body.dark .dir-list-name {
  color: #F8FAFC;
}

.dir-list-desc {
  font-size: 13px;
  color: var(--gray-600);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 600px;
}

body.dark .dir-list-desc {
  color: #94A3B8;
}

.dir-list-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Empty State */
.directory-empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--white);
  border: 1px dashed var(--gray-300);
  border-radius: var(--radius-xl, 16px);
  margin-top: 20px;
}

body.dark .directory-empty-state {
  background: #111C2E;
  border-color: #24324B;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 14px;
}

.empty-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}

body.dark .empty-title {
  color: #F8FAFC;
}

.empty-desc {
  font-size: 14px;
  color: var(--gray-500);
  margin-bottom: 18px;
}

/* Mobile Responsive Drawer */
@media (max-width: 1024px) {
  .directory-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .btn-mobile-filter {
    display: inline-flex;
  }

  .directory-sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 300px;
    height: 100vh;
    max-height: 100vh;
    z-index: 99999;
    border-radius: 0;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
    transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .directory-sidebar.mobile-open {
    left: 0;
  }

  .directory-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99998;
    display: none;
    backdrop-filter: blur(2px);
  }

  .directory-backdrop.mobile-open {
    display: block;
  }

  .mobile-drawer-close {
    display: block;
    background: transparent;
    border: none;
    font-size: 20px;
    color: var(--gray-500);
    cursor: pointer;
  }
}

@media (min-width: 1025px) {
  .mobile-drawer-close {
    display: none;
  }
}

@media (max-width: 640px) {
  .topbar-controls-row {
    flex-direction: column;
    align-items: stretch;
  }
  .topbar-right-controls {
    justify-content: space-between;
  }
  .dir-list-desc {
    display: none;
  }
}

/* ───────── WIDE TOOL FULL ROOM OVERRIDE ───────── */
@media (min-width: 1200px) {
  .tool-container[style*="max-width: 1200px"],
  .tool-container[style*="max-width: 1140px"],
  .tool-container[style*="max-width: 1100px"],
  .tool-container[style*="max-width: 1080px"],
  .tool-container[style*="max-width: 1060px"],
  .tool-container[style*="max-width: 1040px"],
  .tool-container[style*="max-width: 1000px"] {
    max-width: 1520px !important;
  }
}

/* ───────── OCR SPLIT BODY (IMAGE LEFT / TEXT RIGHT) ───────── */
.ocr-split-body {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(380px, 1.25fr);
  gap: 18px;
  align-items: stretch;
  padding: 16px 18px;
}

.ocr-image-preview-pane {
  display: flex;
  flex-direction: column;
  background: var(--gray-50, #f8fafc);
  border: 1px solid var(--gray-200, #e2e8f0);
  border-radius: var(--radius-lg, 8px);
  padding: 12px;
}

body.dark .ocr-image-preview-pane {
  background: #0d1320;
  border-color: #24324B;
}

.ocr-pane-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

body.dark .ocr-pane-label {
  color: #93c5fd;
}

.ocr-image-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #00000008;
  border-radius: 6px;
  overflow: hidden;
  min-height: 220px;
  max-height: 420px;
}

.ocr-preview-img {
  max-width: 100%;
  max-height: 380px;
  object-fit: contain;
  display: block;
  border-radius: 4px;
  cursor: zoom-in;
}

.ocr-text-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ocr-text-pane .ocr-textarea {
  flex: 1;
  min-height: 280px;
}

@media (max-width: 900px) {
  .ocr-split-body {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
  .ocr-image-wrapper {
    max-height: 220px;
  }
}


/* ───────── PREVENT MOUSE WHEEL TRAPPING ───────── */
.split-layout > :nth-child(2),
.qr-preview-column,
.tool-split-output,
.preview-panel,
.tool-workspace,
.ocr-card {
  overscroll-behavior: auto !important;
}


/* ═══════════════════════════════════════════════════════════════
   PREMIUM ALIGNMENT & ZERO-OVERFLOW RESPONSIVE ENGINE (ALL TOOLS)
   ═══════════════════════════════════════════════════════════════ */

/* Universal flex wrap for all button and action containers */
.tool-actions,
.action-buttons,
.button-row,
.btn-row,
.btn-group,
.tabs-wrap,
.mode-tabs,
.tool-workspace [style*="display: flex"],
.tool-workspace [style*="display:flex"],
.tool-split [style*="display: flex"],
.tool-split [style*="display:flex"] {
  flex-wrap: wrap !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Prevent any button or input from blowing out of its container */
.tool-workspace .btn,
.tool-split .btn,
.workspace-section .btn {
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

/* Force container alignment & zero horizontal scroll */
.tool-page,
.tool-container,
.tool-workspace,
.tool-split,
.tool-split-inputs,
.tool-split-output {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

/* Prevent inputs, textareas, canvases, tables from overflowing */
.tool-workspace input,
.tool-workspace select,
.tool-workspace textarea,
.tool-workspace canvas,
.tool-workspace img,
.tool-workspace table,
.tool-workspace pre,
.tool-workspace code {
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Responsive collapse on tablets and small laptops */
@media (max-width: 991px) {
  .tool-split {
    grid-template-columns: 1fr !important;
    gap: var(--space-5, 20px) !important;
  }
  .tool-split-inputs,
  .tool-split-output {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .tool-split-output {
    position: static !important;
    max-height: none !important;
    overflow: visible !important;
  }
}

/* Responsive mode tabs on small screens */
@media (max-width: 768px) {
  .tool-workspace [style*="border-bottom: 2px solid"],
  .tool-workspace [style*="border-bottom:2px solid"] {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .tool-workspace [style*="border-bottom: 2px solid"] button,
  .tool-workspace [style*="border-bottom:2px solid"] button {
    flex: 1 1 calc(50% - 8px) !important;
    min-width: 120px !important;
    font-size: 13px !important;
    padding: 8px 10px !important;
    text-align: center !important;
    justify-content: center !important;
  }
}

/* Responsive Grid Form Controls (1fr 1fr or 1fr 1fr 1fr to 1 column on mobile) */
@media (max-width: 680px) {
  .tool-workspace [style*="grid-template-columns: 1fr 1fr 1fr"],
  .tool-workspace [style*="grid-template-columns: 1fr 1fr"],
  .tool-workspace [style*="grid-template-columns: repeat(3,"],
  .tool-workspace [style*="grid-template-columns: repeat(2,"] {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .tool-split-inputs,
  .tool-split-output {
    min-width: 0 !important;
    width: 100% !important;
  }

  .tool-workspace {
    padding: var(--space-4, 16px) 12px !important;
  }
}

/* Fix Preview Containers (Twitter card, Instagram post, Canvas previews) */
.tweet-card-box,
.ig-card,
.canvas-preview-box,
.handwriting-sheet {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
}


/* ═══════════════════════════════════════════════════════════════
   COMPONENT LEVEL REFINEMENTS FOR ALL ORIGINAL & EXAM TOOLS
   ═══════════════════════════════════════════════════════════════ */

/* Exam & Studio Presets */
.preset-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important;
  gap: 10px !important;
  width: 100% !important;
}

.preset-btn {
  word-break: break-word !important;
  overflow-wrap: break-word !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  padding: 10px 8px !important;
}

.preset-btn .preset-name {
  word-break: break-word !important;
  line-height: 1.3 !important;
}

.preset-btn .preset-size {
  word-break: break-word !important;
  line-height: 1.25 !important;
}

/* Mode Tabs & Pill Selectors */
.mode-tab-bar,
.qr-tab-bar,
.sub-lang-pills {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.mode-tab-btn,
.qr-tab-btn,
.sub-lang-pill,
.option-btn,
.quick-add-btn {
  white-space: normal !important;
  word-break: break-word !important;
  text-align: center !important;
  box-sizing: border-box !important;
  max-width: 100% !important;
}

/* Calculators & Result Grids */
.result-stats {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)) !important;
  gap: 12px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.result-stat {
  min-width: 0 !important;
  box-sizing: border-box !important;
  word-break: break-word !important;
}

.stat-value {
  word-break: break-word !important;
}

/* Action Bars for All Tools */
.action-bar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: var(--space-4, 16px) !important;
  padding: var(--space-4, 16px) 0 !important;
  flex-wrap: wrap !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.action-bar-left,
.action-bar-right {
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: var(--space-2, 8px) !important;
}

@media (max-width: 640px) {
  .action-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  .action-bar-left,
  .action-bar-right {
    width: 100% !important;
    justify-content: center !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .action-bar .btn,
  .action-bar-right .btn,
  .action-bar-left .btn {
    width: 100% !important;
    justify-content: center !important;
  }
}
