/* MalafKit Design System — Clean, fast, AdSense-safe RTL/LTR layout */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --ink: #0f172a;
  --ink-muted: #475569;
  --ink-soft: #64748b;
  --border: #e2e8f0;
  --primary: #0f766e;
  --primary-hover: #0d5e58;
  --primary-soft: #ccfbf1;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.1);
  --font-sans: "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.container {
  width: min(1180px, 100% - 2rem);
  margin-inline: auto;
}

.container-wide {
  width: min(1420px, 100% - 1.2rem);
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-block: 0.8rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 800;
  font-size: 1.12rem;
  color: var(--ink);
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  font-weight: 800;
  flex-shrink: 0;
}

.brand-name {
  letter-spacing: 0.015em;
  white-space: nowrap;
  unicode-bidi: isolate;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  font-weight: 600;
  font-size: 0.89rem;
  color: var(--ink-muted);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--primary);
}

.privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 0.3rem 0.68rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 1.2rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: 0.16s ease;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

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

.btn-accent {
  background: var(--accent);
  color: #fff;
}

.btn-accent:hover:not(:disabled) {
  filter: brightness(0.92);
}

.btn-outline {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border);
}

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

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

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

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

/* Hero */
.hero {
  background: linear-gradient(160deg, #0f172a 0%, #134e4a 100%);
  color: #fff;
  padding-block: 3.2rem 2.8rem;
  text-align: center;
}

.hero h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.7rem, 3.6vw, 2.6rem);
  line-height: 1.3;
}

.hero p {
  margin: 0 auto 1.6rem;
  max-width: 720px;
  color: #cbd5e1;
  font-size: 1.05rem;
}

.hero-search-wrap {
  max-width: 620px;
  margin-inline: auto;
  position: relative;
}

.hero-search {
  width: 100%;
  padding: 0.95rem 1.2rem;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.98);
  color: var(--ink);
  font-size: 1rem;
  outline: none;
  box-shadow: var(--shadow-lg);
}

.hero-search:focus {
  border-color: #2dd4bf;
}

.hero-badges {
  margin-top: 1.2rem;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hero-badge {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.86rem;
  color: #f1f5f9;
}

/* Sections & Grids */
main {
  flex: 1;
}

.section {
  padding-block: 2.4rem;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.35rem;
}

.section-header h2 {
  margin: 0;
  font-size: 1.45rem;
}

.section-sub {
  margin: 0.25rem 0 0;
  color: var(--ink-muted);
  font-size: 0.95rem;
}

.category-tabs {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
}

.tab-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-muted);
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

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

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

a.tool-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
}

.tool-card.is-planned {
  opacity: 0.82;
  background: var(--surface-alt);
  box-shadow: none;
}

.tool-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.tool-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  background: var(--surface-alt);
}

.badge {
  font-size: 0.76rem;
  font-weight: 800;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
}

.badge-live {
  background: var(--primary-soft);
  color: var(--primary);
}

.badge-soon {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge-cat {
  background: var(--accent-soft);
  color: var(--accent);
}

.tool-card h3 {
  margin: 0.2rem 0 0;
  font-size: 1.07rem;
}

.tool-card p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.9rem;
  flex: 1;
}

.tool-cta {
  color: var(--primary);
  font-weight: 700;
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* Tool Workspace */
.tool-page-head {
  padding-block: 1.8rem 1.2rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.breadcrumb {
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin-bottom: 0.45rem;
}

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

.tool-page-head h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.4rem, 2.8vw, 2rem);
}

.tool-page-head p {
  margin: 0;
  color: var(--ink-muted);
  max-width: 780px;
}

.workspace-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: var(--shadow);
  margin-block: 1.4rem;
}

.dropzone {
  border: 2px dashed #94a3b8;
  border-radius: var(--radius);
  background: var(--surface-alt);
  padding: 2.2rem 1.2rem;
  text-align: center;
  cursor: pointer;
  transition: 0.16s ease;
}

.dropzone.dragover,
.dropzone:hover {
  border-color: var(--primary);
  background: #f0fdfa;
}

.dropzone-icon {
  font-size: 2.2rem;
  margin-bottom: 0.4rem;
}

.dropzone strong {
  display: block;
  font-size: 1.05rem;
}

.dropzone span {
  display: block;
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* Forms & Controls */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.field label {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 0.58rem 0.78rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.94rem;
}

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

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

/* AdSense-Compliant Slot Container */
.ad-container {
  margin-block: 1.25rem;
  padding: 0.75rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.8rem;
  min-height: 90px;
  display: grid;
  place-items: center;
}

/* SEO Guide & FAQ */
.guide-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  margin-block: 1.4rem;
}

.guide-card h2 {
  margin-top: 0;
  font-size: 1.25rem;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 0.9rem;
}

.step-item {
  background: var(--surface-alt);
  padding: 1rem;
  border-radius: var(--radius-sm);
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: inline-grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.85rem;
  margin-bottom: 0.45rem;
}

details.faq-item {
  border-bottom: 1px solid var(--border);
  padding-block: 0.85rem;
}

details.faq-item:last-child {
  border-bottom: none;
}

details.faq-item summary {
  cursor: pointer;
  font-weight: 700;
}

details.faq-item p {
  margin: 0.5rem 0 0;
  color: var(--ink-muted);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.2rem;
  left: 1.2rem;
  background: var(--ink);
  color: #fff;
  padding: 0.75rem 1.15rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  font-weight: 600;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Footer */
.site-footer {
  background: var(--ink);
  color: #cbd5e1;
  padding-block: 2rem;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-links {
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

.footer-links a:hover {
  color: #fff;
}

@media (max-width: 720px) {
  .header-inner {
    justify-content: center;
  }
}

/* PDF Editor & Split Workspaces */
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.1rem;
  align-items: start;
}

.editor-layout.no-sidebar {
  grid-template-columns: 1fr;
}

.editor-stage-wrap {
  overflow: auto;
  background: #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 2.5rem 0.65rem 1rem;
  min-height: 540px;
  max-height: 84vh;
  text-align: center;
}

.pdf-stage {
  position: relative;
  display: inline-block;
  direction: ltr;
  text-align: left;
  box-shadow: var(--shadow-lg);
  background: #fff;
}

.pdf-stage canvas {
  display: block;
  direction: ltr;
}

.overlay-layer {
  position: absolute;
  inset: 0;
  cursor: crosshair;
}

.anno-item {
  position: absolute;
  cursor: move;
  user-select: none;
  outline: 1.5px dashed transparent;
  outline-offset: 0;
  border-radius: 3px;
}

.anno-item.is-selected {
  outline-color: var(--accent);
  background: rgba(37, 99, 235, 0.06);
}

.anno-item.is-editing {
  cursor: text;
  user-select: text;
  outline: 1.5px solid var(--primary);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.14);
  min-width: 18px;
}

.anno-item.is-editing:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
  pointer-events: none;
}

.anno-item.is-word-mask {
  pointer-events: none;
}

.overlay-layer.mode-whiteout .anno-item.is-word-mask {
  pointer-events: auto;
}

.overlay-layer.mode-word .anno-item[data-type="text"] {
  cursor: text;
}

.anno-move-grip {
  position: absolute;
  top: -11px;
  left: -11px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  line-height: 20px;
  text-align: center;
  cursor: move;
  user-select: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  z-index: 4;
}

.anno-move-grip::before {
  content: "✥";
}

.resize-handle {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border: 2px solid #fff;
  border-radius: 3px;
  cursor: nwse-resize;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.pdf-hover-box {
  position: absolute;
  pointer-events: none;
  border: 2px dashed var(--primary);
  background: rgba(15, 118, 110, 0.14);
  border-radius: 4px;
  z-index: 5;
}

.draw-preview-box {
  position: absolute;
  pointer-events: none;
  border: 2px dashed var(--accent);
  background: rgba(255, 255, 255, 0.85);
  z-index: 6;
}

.floating-bar {
  position: absolute;
  z-index: 25;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
  max-width: min(360px, 95vw);
  background: #0f172a;
  color: #fff;
  padding: 0.28rem 0.4rem;
  border-radius: 9px;
  box-shadow: var(--shadow-lg);
  direction: rtl;
}

.floating-bar[hidden] {
  display: none;
}

.floating-bar button,
.floating-bar select {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  padding: 0.22rem 0.48rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.floating-bar select option {
  color: #0f172a;
  background: #fff;
}

.floating-bar button:hover {
  background: rgba(255, 255, 255, 0.24);
}

.floating-bar button.fb-del {
  background: rgba(220, 38, 38, 0.85);
}

.floating-bar input[type="color"] {
  width: 26px;
  height: 24px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
}

.tool-hint-bar {
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  color: #115e59;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
}

.side-panel {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.side-panel h3 {
  margin: 0 0 0.7rem;
  font-size: 1rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: grid;
  place-items: center;
  z-index: 90;
  padding: 1rem;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.3rem;
  width: min(460px, 100%);
  box-shadow: var(--shadow-lg);
}

@media (max-width: 960px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }
}

/* Tool Card Link + Mini Report Action */
.tool-card-live {
  position: relative;
}

.tool-card-live:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
}

.tool-card-link {
  color: inherit;
}

.tool-card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.tool-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.tool-card-foot .tool-cta {
  margin-top: 0;
}

.tool-report-mini {
  position: relative;
  z-index: 2;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink-muted);
  border-radius: 999px;
  padding: 0.22rem 0.6rem;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.15s ease;
  white-space: nowrap;
}

.tool-report-mini:hover {
  border-color: #f59e0b;
  background: var(--warn-soft);
  color: var(--warn);
}

/* Tool Page Report Button & Banner */
.tool-breadcrumb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.45rem;
}

.tool-breadcrumb-row .breadcrumb {
  margin-bottom: 0;
}

.tool-report-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid #fcd34d;
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  transition: 0.15s ease;
}

.tool-report-pill:hover {
  background: #fde68a;
  color: #92400e;
}

.tool-report-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-right: 4px solid #f59e0b;
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem;
  margin-top: 1.25rem;
  box-shadow: var(--shadow);
}

.tool-report-banner strong {
  display: block;
  font-size: 0.96rem;
  color: var(--ink);
}

.tool-report-banner span {
  font-size: 0.86rem;
  color: var(--ink-muted);
}

/* Issue Report Modal */
.report-modal-card {
  width: min(560px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  padding: 1.1rem 1.25rem;
  text-align: right;
}

.report-modal-card .field {
  margin-bottom: 0.65rem;
}

.report-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.report-modal-head h3 {
  margin: 0;
  font-size: 1.1rem;
  text-align: right;
}

.report-close-btn {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
}

.report-tool-badge {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.85rem;
}

.report-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.35rem;
}

.report-chip {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  border-radius: 999px;
  padding: 0.32rem 0.72rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.14s ease;
}

.report-chip.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.report-diag {
  margin: 0.75rem 0;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.report-diag pre {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  white-space: pre-wrap;
  word-break: break-word;
  direction: ltr;
  text-align: left;
  font-size: 0.75rem;
  margin: 0.4rem 0 0;
}

.report-fallback-box {
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  border-radius: var(--radius-sm);
  padding: 0.9rem;
  margin-top: 0.75rem;
}

.report-fallback-box p {
  margin: 0 0 0.7rem;
  font-size: 0.88rem;
}
