@font-face {
  font-family: 'Cairo';
  src: url('/fonts/Cairo-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Cairo';
  src: url('/fonts/Cairo-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Cairo';
  src: url('/fonts/Cairo-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --kh-primary: #0891b2;
  --kh-primary-light: #51cad6;
  --kh-primary-dark: #0e7490;
  --kh-navy: #0f172a;
  --kh-accent: #0284c7;
  --kh-bg: #f8fafc;
  --kh-surface: #ffffff;
  --kh-surface-alt: #f1f5f9;
  --kh-border: #e2e8f0;
  --kh-text: #0f172a;
  --kh-muted: #64748b;
  --kh-success: #10b981;
  --kh-warning: #f59e0b;
  --kh-error: #ef4444;
  --kh-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06);
  --kh-shadow-lg: 0 18px 40px -12px rgba(8, 145, 178, 0.22);
  --kh-radius: 16px;
  --kh-radius-lg: 22px;
  --kh-glass: rgba(255, 255, 255, 0.88);
}

[data-theme="dark"] {
  --kh-bg: #0b1120;
  --kh-surface: #162033;
  --kh-surface-alt: #1e293b;
  --kh-border: #283548;
  --kh-text: #f8fafc;
  --kh-muted: #94a3b8;
  --kh-shadow: 0 4px 24px -4px rgba(0, 0, 0, 0.45);
  --kh-glass: rgba(22, 32, 51, 0.9);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  margin: 0;
  font-family: 'Cairo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--kh-bg);
  color: var(--kh-text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--kh-primary);
  text-decoration: none;
  transition: color 0.15s ease, opacity 0.15s ease;
}
a:hover { color: var(--kh-primary-dark); }
[data-theme="dark"] a:hover { color: var(--kh-primary-light); }

.kh-container {
  width: 100%;
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: 1.15rem;
}

/* Header & Navigation */
.kh-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--kh-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--kh-border);
}

.kh-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 68px;
}

.kh-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--kh-text);
  font-weight: 700;
}
.kh-brand img {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(8, 145, 178, 0.2);
}
.kh-brand-title { font-size: 1.12rem; line-height: 1.2; display: block; }
.kh-brand-sub { font-size: 0.73rem; font-weight: 600; color: var(--kh-muted); display: block; }

.kh-nav-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.kh-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--kh-muted);
  transition: all 0.18s ease;
}
.kh-nav-link:hover, .kh-nav-link.active {
  color: var(--kh-primary);
  background: rgba(8, 145, 178, 0.1);
}
[data-theme="dark"] .kh-nav-link:hover,
[data-theme="dark"] .kh-nav-link.active {
  color: var(--kh-primary-light);
  background: rgba(81, 202, 214, 0.14);
}

.kh-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.kh-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--kh-border);
  background: var(--kh-surface);
  color: var(--kh-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.16s ease;
}
.kh-icon-btn:hover {
  border-color: var(--kh-primary);
  color: var(--kh-primary);
  transform: translateY(-1px);
}

.kh-lang-select {
  position: relative;
}
.kh-lang-btn {
  height: 40px;
  padding-inline: 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--kh-border);
  background: var(--kh-surface);
  color: var(--kh-text);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}
.kh-lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  min-width: 175px;
  background: var(--kh-surface);
  border: 1px solid var(--kh-border);
  border-radius: 14px;
  box-shadow: var(--kh-shadow-lg);
  padding: 0.4rem;
  display: none;
  z-index: 60;
}
.kh-lang-menu.open { display: block; }
.kh-lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  color: var(--kh-text);
  font-weight: 600;
  font-size: 0.9rem;
}
.kh-lang-option:hover, .kh-lang-option.active {
  background: rgba(8, 145, 178, 0.12);
  color: var(--kh-primary);
}

/* Main Content */
main.kh-main {
  flex: 1;
  padding-block: 1.25rem 3.5rem;
}

/* Hero Banner (Matches Flutter HomePage) */
.kh-hero {
  background: linear-gradient(135deg, #0f172a 0%, #0e7490 65%, #0891b2 100%);
  border-radius: var(--kh-radius-lg);
  padding: 2rem;
  color: #ffffff;
  position: relative;
  overflow: hidden;
  box-shadow: var(--kh-shadow-lg);
  margin-bottom: 1.5rem;
}
.kh-hero::after {
  content: "";
  position: absolute;
  inset-inline-end: -60px;
  top: -60px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(81, 202, 214, 0.25) 0%, transparent 70%);
  pointer-events: none;
}
.kh-hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.24);
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
}
.kh-hero h1 {
  margin: 0 0 0.55rem;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 700;
  line-height: 1.28;
}
.kh-hero p {
  margin: 0 0 1.35rem;
  color: rgba(255, 255, 255, 0.88);
  max-width: 720px;
  font-size: 1rem;
}
.kh-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Buttons */
.kh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.3rem;
  border-radius: 14px;
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  text-decoration: none;
}
.kh-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
}
.kh-btn-primary {
  background: var(--kh-primary);
  color: #ffffff;
}
.kh-btn-primary:hover:not(:disabled) {
  background: var(--kh-primary-dark);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -6px rgba(8, 145, 178, 0.45);
}
.kh-btn-cyan {
  background: var(--kh-primary-light);
  color: #0f172a;
}
.kh-btn-cyan:hover {
  background: #67d8e3;
  color: #0f172a;
  transform: translateY(-1px);
}
.kh-btn-hero-outline {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.38);
  color: #ffffff;
}
.kh-btn-hero-outline:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}
.kh-btn-outline {
  background: var(--kh-surface);
  border-color: var(--kh-border);
  color: var(--kh-text);
}
.kh-btn-outline:hover:not(:disabled) {
  border-color: var(--kh-primary);
  color: var(--kh-primary);
}
.kh-btn-danger {
  background: #ef4444;
  color: #ffffff;
}
.kh-btn-sm {
  padding: 0.42rem 0.85rem;
  font-size: 0.82rem;
  border-radius: 10px;
}

/* Search & Category Chips */
.kh-search-wrap {
  position: relative;
  margin-bottom: 1rem;
}
.kh-search-icon {
  position: absolute;
  top: 50%;
  inset-inline-start: 1rem;
  transform: translateY(-50%);
  color: var(--kh-muted);
  pointer-events: none;
}
.kh-search-input {
  width: 100%;
  padding: 0.85rem 2.9rem;
  border-radius: 16px;
  border: 1.5px solid var(--kh-border);
  background: var(--kh-surface);
  color: var(--kh-text);
  font-family: inherit;
  font-size: 0.98rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.kh-search-input:focus {
  outline: none;
  border-color: var(--kh-primary);
  box-shadow: 0 0 0 4px rgba(8, 145, 178, 0.12);
}

.kh-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1.35rem;
}
.kh-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.48rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--kh-border);
  background: var(--kh-surface);
  color: var(--kh-muted);
  font-family: inherit;
  font-size: 0.87rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
}
.kh-chip:hover {
  border-color: var(--kh-primary);
  color: var(--kh-primary);
}
.kh-chip.active {
  background: var(--kh-primary);
  border-color: var(--kh-primary);
  color: #ffffff;
}

/* Cards & Tools Grid */
.kh-card {
  background: var(--kh-surface);
  border: 1px solid var(--kh-border);
  border-radius: var(--kh-radius);
  box-shadow: var(--kh-shadow);
}
.kh-card-pad { padding: 1.35rem; }

.kh-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 1rem;
}

.kh-tool-card {
  background: var(--kh-surface);
  border: 1px solid var(--kh-border);
  border-radius: 18px;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.85rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  position: relative;
}
.kh-tool-card:hover {
  transform: translateY(-3px);
  border-color: rgba(8, 145, 178, 0.45);
  box-shadow: var(--kh-shadow-lg);
}
.kh-tool-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}
.kh-tool-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.kh-tool-badges {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.kh-badge-new {
  background: rgba(8, 145, 178, 0.14);
  color: var(--kh-primary);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 7px;
}
.kh-fav-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--kh-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}
.kh-fav-btn.is-fav { color: #f59e0b; }
.kh-tool-title {
  margin: 0 0 0.25rem;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--kh-text);
  line-height: 1.3;
}
.kh-tool-sub {
  margin: 0;
  font-size: 0.84rem;
  color: var(--kh-muted);
  line-height: 1.45;
}
.kh-tool-link-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
}

/* Tool Workspace & Form Controls */
.kh-tool-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.kh-tool-header-icon {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.kh-tool-header h1 {
  margin: 0 0 0.2rem;
  font-size: clamp(1.35rem, 2.5vw, 1.9rem);
  font-weight: 700;
}
.kh-tool-header p {
  margin: 0;
  color: var(--kh-muted);
  font-size: 0.96rem;
}

.kh-workspace {
  background: var(--kh-surface);
  border: 1px solid var(--kh-border);
  border-radius: var(--kh-radius-lg);
  padding: 1.5rem;
  box-shadow: var(--kh-shadow);
  margin-bottom: 2rem;
}

.kh-dropzone {
  border: 2px dashed rgba(8, 145, 178, 0.45);
  background: rgba(8, 145, 178, 0.04);
  border-radius: 18px;
  padding: 2.2rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.kh-dropzone:hover, .kh-dropzone.dragover {
  background: rgba(8, 145, 178, 0.1);
  border-color: var(--kh-primary);
}

.kh-input, .kh-select, .kh-textarea {
  width: 100%;
  padding: 0.72rem 0.95rem;
  border-radius: 12px;
  border: 1.5px solid var(--kh-border);
  background: var(--kh-surface);
  color: var(--kh-text);
  font-family: inherit;
  font-size: 0.95rem;
}
.kh-input:focus, .kh-select:focus, .kh-textarea:focus {
  outline: none;
  border-color: var(--kh-primary);
}
.kh-label {
  display: block;
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 0.35rem;
  color: var(--kh-text);
}
.kh-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.kh-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
@media (max-width: 768px) {
  .kh-grid-2, .kh-grid-3 { grid-template-columns: 1fr; }
}

/* Segmented Tabs */
.kh-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  background: var(--kh-surface-alt);
  padding: 0.35rem;
  border-radius: 14px;
  border: 1px solid var(--kh-border);
  margin-bottom: 1.15rem;
}
.kh-tab-btn {
  padding: 0.5rem 0.95rem;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--kh-muted);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
}
.kh-tab-btn.active {
  background: var(--kh-surface);
  color: var(--kh-primary);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

/* Thumbnail Grids */
.kh-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.85rem;
}
.kh-thumb-card {
  background: var(--kh-surface-alt);
  border: 1.5px solid var(--kh-border);
  border-radius: 14px;
  padding: 0.55rem;
  text-align: center;
  position: relative;
  transition: border-color 0.15s ease;
}
.kh-thumb-card.selected {
  border-color: var(--kh-primary);
  background: rgba(8, 145, 178, 0.1);
}
.kh-thumb-img {
  width: 100%;
  height: 155px;
  object-fit: contain;
  border-radius: 8px;
  background: #ffffff;
}

/* Before / After Comparison Slider */
.kh-compare-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--kh-border);
  background: repeating-conic-gradient(#cbd5e1 0% 25%, #f8fafc 0% 50%) 50% / 20px 20px;
  user-select: none;
  max-height: 460px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.kh-compare-wrap img {
  display: block;
  max-width: 100%;
  max-height: 450px;
  object-fit: contain;
}
.kh-compare-overlay {
  position: absolute;
  inset: 0;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}
.kh-compare-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #ffffff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

/* Result Bar */
.kh-result-bar {
  margin-top: 1.25rem;
  padding: 1rem 1.2rem;
  border-radius: 16px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Breadcrumbs & SEO Sections */
.kh-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--kh-muted);
  margin-bottom: 0.85rem;
}
.kh-seo-section {
  margin-top: 2.25rem;
}
.kh-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.kh-step-card {
  background: var(--kh-surface);
  border: 1px solid var(--kh-border);
  border-radius: 16px;
  padding: 1.15rem;
}
.kh-step-num {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(8, 145, 178, 0.12);
  color: var(--kh-primary);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.55rem;
}

.kh-faq-item {
  background: var(--kh-surface);
  border: 1px solid var(--kh-border);
  border-radius: 14px;
  margin-bottom: 0.65rem;
  overflow: hidden;
}
.kh-faq-item summary {
  padding: 0.95rem 1.15rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kh-faq-item p {
  margin: 0;
  padding: 0 1.15rem 1rem;
  color: var(--kh-muted);
  font-size: 0.94rem;
}

/* Footer */
.kh-footer {
  background: var(--kh-surface);
  border-top: 1px solid var(--kh-border);
  padding-block: 2.5rem 1.75rem;
  margin-top: auto;
}
.kh-footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 1.75rem;
  margin-bottom: 2rem;
}
.kh-footer h3 {
  margin: 0 0 0.7rem;
  font-size: 0.96rem;
  font-weight: 700;
}
.kh-footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.kh-footer li { margin-bottom: 0.4rem; font-size: 0.88rem; }
.kh-footer li a { color: var(--kh-muted); }
.kh-footer li a:hover { color: var(--kh-primary); }

/* Mobile Bottom Nav (Matching MainShell) */
.kh-mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  inset-inline: 0;
  z-index: 45;
  background: var(--kh-glass);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--kh-border);
  padding: 0.35rem 0.5rem;
}
.kh-mobile-nav-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.25rem;
}
.kh-mobile-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.35rem;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--kh-muted);
}
.kh-mobile-tab.active {
  color: var(--kh-primary);
  background: rgba(8, 145, 178, 0.1);
}

/* Toast Notification */
.kh-toast-stack {
  position: fixed;
  bottom: 4.5rem;
  inset-inline-end: 1.25rem;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.kh-toast {
  background: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--kh-shadow-lg);
  border-inline-start: 4px solid var(--kh-primary-light);
}
.kh-toast.error { border-inline-start-color: #ef4444; }
.kh-toast.success { border-inline-start-color: #10b981; }

/* Recent tools strip */
.kh-recent-strip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
  margin-bottom: 0.85rem;
}
.kh-recent-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  padding: 0.38rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--kh-border);
  background: var(--kh-surface);
  color: var(--kh-text);
  font-size: 0.83rem;
  font-weight: 600;
}

.kh-btn-whatsapp {
  background: #16a34a;
  color: #ffffff;
}
.kh-btn-whatsapp:hover:not(:disabled) {
  background: #15803d;
  color: #ffffff;
}
.kh-viral-optin-row {
  flex: 1 0 100%;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.81rem;
  color: var(--kh-muted);
  padding-top: 0.45rem;
  border-top: 1px dashed rgba(16, 185, 129, 0.3);
  cursor: pointer;
}
.kh-viral-optin-row input[type="checkbox"] {
  accent-color: #16a34a;
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.kh-hidden { display: none !important; }

@media (max-width: 900px) {
  .kh-nav-links { display: none; }
  .kh-footer-grid { grid-template-columns: 1fr 1fr; }
  .kh-mobile-nav { display: block; }
  body { padding-bottom: 64px; }
}
@media (max-width: 560px) {
  .kh-footer-grid { grid-template-columns: 1fr; }
  .kh-hero { padding: 1.35rem; }
  .kh-workspace { padding: 1rem; }
}
