/*
 * ToolForge DS2 — Workspace compatibility shim
 * Maps old tf-* workspace classes to new light design tokens
 */

/* Override old dark workspace variables */
.tf-workspace {
  background: var(--c-bg) !important;
  min-height: calc(100vh - var(--nav-h));
  padding: 36px 0 72px;
}

/* Old card → white card */
.tf-card {
  background: var(--c-card) !important;
  border: 1.5px solid var(--c-border) !important;
  border-radius: var(--r-xl) !important;
  padding: clamp(24px, 4vw, 40px) !important;
  box-shadow: var(--shadow-sm) !important;
}

/* Breadcrumb */
.tf-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .8125rem;
  color: var(--c-text-dim);
  margin-bottom: 16px;
}

.tf-breadcrumb a {
  color: var(--c-text-sec) !important;
}

.tf-breadcrumb a:hover {
  color: var(--c-royal) !important;
}

.tf-breadcrumb-sep {
  color: var(--c-text-dim);
}

/* Tool header — sits on a dark navy gradient, so all text must be white */
.tf-tool-header {
  margin-bottom: 24px;
}

.tf-tool-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #fff;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .28);
  padding: 3px 10px;
  border-radius: var(--r-full);
  margin-bottom: 10px;
}

.tf-tool-header h1 {
  font-size: clamp(1.375rem, 3vw, 1.875rem);
  font-weight: 800;
  color: #fff !important;
  /* white on dark gradient */
  margin-bottom: 8px;
}

/* Description: was forcing dark --c-text-sec which was invisible on gradient */
.tf-tool-header p {
  color: rgba(255, 255, 255, .88) !important;
  margin-bottom: 0;
  font-size: .9375rem;
  line-height: 1.6;
  max-width: 560px;
}

/* Section labels */
.tf-section-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--c-text-dim);
  margin: 20px 0 8px;
}

/* Textareas / inputs in old workspace */
.tf-card textarea,
.tf-card input[type="text"],
.tf-card input[type="number"],
.tf-card input[type="url"],
.tf-card select {
  background: var(--c-bg-alt) !important;
  border: 1.5px solid var(--c-border) !important;
  border-radius: var(--r-sm) !important;
  color: var(--c-text) !important;
  font-family: var(--font-sans);
}

.tf-card textarea:focus,
.tf-card input:focus,
.tf-card select:focus {
  outline: none !important;
  border-color: var(--c-royal) !important;
  box-shadow: var(--shadow-focus) !important;
}

/* Code textarea (developer tools) */
.tf-card textarea[id*="inline"],
.tf-card textarea.code {
  background: #0F1117 !important;
  color: #E2E8F0 !important;
  font-family: var(--font-mono) !important;
  font-size: .875rem;
  border-color: #1E293B !important;
  border-radius: var(--r-md) !important;
  min-height: 200px;
}

/* Old buttons → map to new */
.tf-btn,
.tf-btn-primary,
button[class*="tf-btn"] {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  font-family: var(--font-sans) !important;
  font-weight: 600 !important;
  border-radius: var(--r-sm) !important;
  cursor: pointer !important;
  transition: all var(--t-base) !important;
}

.tf-btn-primary,
button.tf-btn-primary,
a.tf-btn-primary {
  background: var(--c-royal) !important;
  color: #fff !important;
  border: 1.5px solid var(--c-royal) !important;
  padding: 0 20px !important;
  height: 42px !important;
  font-size: .9375rem !important;
  box-shadow: 0 2px 4px rgba(37, 99, 235, .2) !important;
}

.tf-btn-primary:hover,
button.tf-btn-primary:hover,
a.tf-btn-primary:hover {
  background: var(--c-royal-hover) !important;
  border-color: var(--c-royal-hover) !important;
  color: #fff !important;
}

.tf-btn-secondary,
button.tf-btn-secondary {
  background: var(--c-bg-alt) !important;
  color: var(--c-text) !important;
  border: 1.5px solid var(--c-border) !important;
  padding: 0 18px !important;
  height: 40px !important;
  font-size: .875rem !important;
}

.tf-btn-secondary:hover {
  background: var(--c-card) !important;
  border-color: var(--c-royal) !important;
  color: var(--c-royal) !important;
}

/* Actions row */
.tf-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* Old progress */
.tf-progress-wrap,
#tf-progress-wrap {
  margin-top: 20px;
}

.tf-progress-header {
  display: flex;
  justify-content: space-between;
  font-size: .8125rem;
  color: var(--c-text-sec);
  margin-bottom: 8px;
}

.tf-progress-bar-bg {
  background: var(--c-bg-alt) !important;
  border-radius: var(--r-full);
  height: 8px;
  overflow: hidden;
}

.tf-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--c-royal), var(--c-royal-light)) !important;
  border-radius: var(--r-full);
  transition: width 300ms ease;
}

/* Old upload zone */
.tf-drop-zone,
.tf-upload-area {
  border: 2px dashed var(--c-border-med) !important;
  border-radius: var(--r-xl) !important;
  background: var(--c-bg-alt) !important;
  transition: all var(--t-base) !important;
}

.tf-drop-zone:hover,
.tf-drop-zone.drag-over,
.tf-upload-area:hover,
.tf-upload-area.dragover {
  border-color: var(--c-royal) !important;
  background: var(--c-royal-pale) !important;
}

/* Old result zones */
.tf-result-zone,
.tf-result-box,
#tf-result-area {
  background: var(--c-card) !important;
  border: 1.5px solid var(--c-border) !important;
  border-radius: var(--r-xl) !important;
}

.tf-result-zone.success,
.tf-result-box.success {
  border-color: var(--c-success-border) !important;
  background: var(--c-success-bg) !important;
}

.tf-result-zone.error,
.tf-result-box.error {
  border-color: var(--c-error-border) !important;
  background: var(--c-error-bg) !important;
}

/* Old options panel */
.tf-options {
  background: var(--c-bg-alt) !important;
  border: 1.5px solid var(--c-border) !important;
  border-radius: var(--r-lg) !important;
  padding: 20px !important;
}

.tf-options label {
  color: var(--c-text) !important;
  font-size: .875rem !important;
}

/* Alert/toast messages */
.tf-toast,
.tf-alert {
  border-radius: var(--r-md) !important;
  font-size: .875rem !important;
  padding: 12px 16px !important;
}

/* File list items */
.tf-file-item-old {
  background: var(--c-card) !important;
  border: 1.5px solid var(--c-border) !important;
  border-radius: var(--r-md) !important;
}

/* Tool grid on old category pages */
.tf-tools-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)) !important;
  gap: 16px !important;
}

.tf-tool-card {
  background: var(--c-card) !important;
  border: 1.5px solid var(--c-border) !important;
  border-radius: var(--r-lg) !important;
  transition: border-color var(--t-base), box-shadow var(--t-base), transform var(--t-base) !important;
}

.tf-tool-card:hover {
  border-color: var(--c-royal) !important;
  box-shadow: var(--shadow-lg) !important;
  transform: translateY(-2px) !important;
}

.tf-tool-card h3 {
  color: var(--c-navy) !important;
  font-size: .9375rem !important;
  font-weight: 700 !important;
}

.tf-tool-card p {
  color: var(--c-text-sec) !important;
  font-size: .8125rem !important;
}

.tf-tool-card-icon {
  font-size: 1.375rem;
  margin-bottom: 12px;
}

.tf-tool-card-badge {
  display: inline-flex;
  font-size: .6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 2px 8px;
  border-radius: var(--r-full);
  background: var(--c-royal-pale);
  color: var(--c-royal);
  border: 1px solid #BFDBFE;
  margin-top: 10px;
}

/* Category filter bar (old) */
.tf-cat-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.tf-cat-btn {
  padding: 6px 16px !important;
  border-radius: var(--r-full) !important;
  font-size: .8125rem !important;
  font-weight: 600 !important;
  border: 1.5px solid var(--c-border) !important;
  background: var(--c-card) !important;
  color: var(--c-text-sec) !important;
  cursor: pointer !important;
  font-family: var(--font-sans) !important;
  transition: all var(--t-fast) !important;
}

.tf-cat-btn:hover,
.tf-cat-btn.active {
  border-color: var(--c-royal) !important;
  background: var(--c-royal-pale) !important;
  color: var(--c-royal) !important;
}

/* Page headings — override dark text from old stylesheet */
body h1,
body h2,
body h3,
body h4 {
  color: var(--c-navy);
}

body p {
  color: var(--c-text-sec);
}

/* Report Issue / Jump to Feedback Button (Near submit) */
.tf-tool-report-jump-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  font-size: 0.8125rem !important;
  font-weight: 600 !important;
  color: #DC2626 !important;
  background: #FEF2F2 !important;
  border: 1px solid #FECACA !important;
  padding: 6px 14px !important;
  border-radius: var(--r-full) !important;
  text-decoration: none !important;
  cursor: pointer !important;
  transition: all var(--t-fast) !important;
  line-height: 1.4 !important;
}

.tf-tool-report-jump-btn:hover {
  background: #FEE2E2 !important;
  color: #B91C1C !important;
  border-color: #F87171 !important;
  transform: translateY(-1px) !important;
}

.tf-tool-report-jump-btn svg {
  stroke: currentColor !important;
}

/* Workspace feedback bar */
.tf-workspace-feedback-bar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  margin-top: 28px !important;
  padding-top: 20px !important;
  border-top: 1px dashed var(--c-border, #E2E8F0) !important;
  font-size: 0.825rem !important;
  color: var(--c-text-sec, #64748B) !important;
  flex-wrap: wrap !important;
}

/* Comprehensive Spacing & Margins */
.tf-workspace,
.tf2-workspace {
  padding-top: 36px !important;
  padding-bottom: 6rem !important;
}

.tf-card,
.tf2-workspace__card {
  margin-bottom: 4rem !important;
}

.tf2-workspace__breadcrumb {
  margin-bottom: 24px !important;
}

.tf-tool-header {
  margin-bottom: 28px !important;
}

.tf-tool-header h1 {
  margin: 12px 0 10px !important;
  line-height: 1.25 !important;
}

.tf-tool-header p {
  margin: 0 0 22px !important;
  line-height: 1.6 !important;
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  font-weight: 500 !important;
  opacity: 0.96 !important;
}

.tf-drop-zone,
#tf-drop-zone {
  margin: 1.75rem 0 2rem !important;
}

.tf-textarea,
#tf-input {
  margin-bottom: 1.75rem !important;
}

.tf-options,
#tf-options-form {
  margin: 1.75rem 0 2rem !important;
}

.tf-actions {
  margin-top: 2rem !important;
  margin-bottom: 1.5rem !important;
}

.tf-section-label {
  margin-top: 1.75rem !important;
  margin-bottom: 0.85rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.03em !important;
}

#tf-inline-result,
#tf-result-wrap,
.tf-result-box {
  margin: 2rem 0 !important;
}

#tf-file-list {
  margin: 1.5rem 0 !important;
}

.tf-related-wrap {
  margin-top: 4.5rem !important;
  margin-bottom: 4rem !important;
}

/* Rich SEO Content Deep Spacing */
.tf-seo-content {
  margin: 4.5rem auto 4.5rem !important;
  padding: clamp(28px, 5vw, 48px) !important;
}

.tf-seo-content h2 {
  margin: 3.25rem 0 1.25rem !important;
}

.tf-seo-content h2:first-child {
  margin-top: 0 !important;
}

.tf-seo-content h3 {
  margin: 2.35rem 0 0.85rem !important;
}

.tf-seo-content h4 {
  margin: 1.75rem 0 0.5rem !important;
}

.tf-seo-content p {
  margin: 0 0 1.4rem !important;
  line-height: 1.85 !important;
}

.tf-seo-content ul,
.tf-seo-content ol {
  margin: 0 0 1.75rem !important;
  padding-left: 2rem !important;
}

.tf-seo-content li {
  margin-bottom: 0.65rem !important;
  line-height: 1.8 !important;
}

.tf-seo-content table {
  margin: 2.25rem 0 2.5rem !important;
}

.tf-seo-content blockquote {
  margin: 2rem 0 !important;
  padding: 1.25rem 1.75rem !important;
}

/* Category Hero & Grid Spacing */
.tf2-cat-hero {
  padding: 40px 0 32px !important;
  margin-bottom: 24px !important;
}

.tf2-tool-card {
  margin-bottom: 0 !important;
}

/* Encrypted File List Styling */
.tf-file-item {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  width: 100% !important;
  box-sizing: border-box !important;
  padding: 14px 18px !important;
  background: #ffffff !important;
  border: 1.5px solid #e2e8f0 !important;
  border-radius: 12px !important;
  margin-bottom: 14px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  transition: all 0.2s ease !important;
}

.tf-file-item--encrypted {
  border-color: #fed7aa !important;
  background: #fffdfb !important;
}

.tf-file-main-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  gap: 12px !important;
}

.tf-file-password-box {
  display: block !important;
  width: 100% !important;
  box-sizing: border-box !important;
  margin-top: 12px !important;
}

/* =========================================================================
   CROSS-BROWSER CONSISTENCY SHIM (CHROME, FIREFOX, BRAVE, SAFARI, EDGE)
   ========================================================================= */

/* 1. Global Box Sizing & Font Smoothing Parity */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* 2. Firefox & Brave Text Gradient Normalization */
.tf2-hero__h1 em {
  color: #93C5FD;
  /* Vibrant solid fallback for Firefox & non-WebKit */
  background: linear-gradient(135deg, #60A5FA 0%, #93C5FD 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

/* 3. Cross-Browser Scrollbar Styling (Firefox + WebKit) */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.4) transparent;
}

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

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

*::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.4);
  border-radius: 9999px;
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.7);
}

/* 4. Form Controls & Buttons Parity (Firefox default inner focus rings & search decoration) */
button::-moz-focus-inner,
input::-moz-focus-inner {
  border: 0;
  padding: 0;
}

input[type="search"] {
  -webkit-appearance: none;
  -moz-appearance: textfield;
  appearance: none;
}

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  display: none;
  -webkit-appearance: none;
}

/* 5. Backdrop Filter Fallbacks (Brave Shields & Firefox with hardware acceleration off) */
.tf2-nav {
  background: rgba(248, 250, 252, 0.94) !important;
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
}

.th-cookie-banner {
  background-color: rgba(10, 15, 29, 0.96) !important;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.tf2-hero__search-box {
  background-color: rgba(255, 255, 255, 0.1) !important;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

/* 6. Mask Image Cross-Browser Parity for Hero Grid Background */
.tf2-hero::after {
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0, black, transparent);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0, black, transparent);
}

/* 7. Tap Target & Accessibility Compliance for Lighthouse 100% */
.tf2-nav__logo {
  min-height: 44px !important;
  display: inline-flex !important;
  align-items: center !important;
}

.tf2-nav__hamburger {
  display: none !important;
}

.tf2-nav__mega-btn {
  min-height: 44px !important;
  height: 44px !important;
}

.tf2-btn--sm,
#tf2-all-tools-link {
  min-height: 44px !important;
  height: 44px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.tf2-hero__search-btn {
  min-height: 44px !important;
  height: 44px !important;
}

.tf2-section-link {
  min-height: 44px !important;
  display: inline-flex !important;
  align-items: center !important;
  padding: 10px 4px !important;
}

.tf2-footer__logo {
  min-height: 44px !important;
  display: inline-flex !important;
  align-items: center !important;
}

.tf2-footer__link-chip {
  min-height: 44px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 10px 18px !important;
  font-size: 0.8125rem !important;
}

.tf2-footer__col-list a {
  min-height: 44px !important;
  display: inline-flex !important;
  align-items: center !important;
  padding: 8px 0 !important;
}

.tf2-footer__bottom-links {
  display: flex !important;
  gap: 12px 20px !important;
  flex-wrap: wrap !important;
  align-items: center !important;
}

.tf2-footer__bottom-links a {
  min-height: 44px !important;
  display: inline-flex !important;
  align-items: center !important;
  padding: 10px 8px !important;
}

.tf2-hero__stat-label {
  color: #CBD5E1 !important;
}

.tf2-tool-card__desc {
  color: #475569 !important;
}