/* ===========================
   محوّل فيكتور — أحمد الغريب
   Modern B/W theme — IBM Plex
=========================== */

:root {
  /* Light theme (default) */
  --bg: #ffffff;
  --bg-2: #f6f6f7;
  --bg-3: #ededee;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --border: #e5e5e7;
  --border-2: #d5d5d8;
  --text: #0a0a0b;
  --text-2: #3a3a3d;
  --text-3: #6c6c70;
  --muted: #8a8a8e;
  --accent: #0a0a0b;
  --accent-contrast: #ffffff;
  --ok: #0d8a4e;
  --warn: #b86b00;
  --err: #b3261e;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06), 0 1px 1px rgba(0,0,0,.04);
  --shadow-md: 0 6px 20px rgba(0,0,0,.07), 0 2px 6px rgba(0,0,0,.05);
  --shadow-lg: 0 18px 50px rgba(0,0,0,.10), 0 6px 18px rgba(0,0,0,.06);
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --grid: rgba(0,0,0,.045);
  --orb: rgba(0,0,0,.04);
}

[data-theme="dark"] {
  --bg: #0a0a0b;
  --bg-2: #111114;
  --bg-3: #17171b;
  --surface: #121215;
  --surface-2: #18181c;
  --border: #25252a;
  --border-2: #2f2f35;
  --text: #f5f5f7;
  --text-2: #c9c9cf;
  --text-3: #9a9aa1;
  --muted: #7a7a82;
  --accent: #ffffff;
  --accent-contrast: #0a0a0b;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 8px 24px rgba(0,0,0,.5), 0 2px 8px rgba(0,0,0,.4);
  --shadow-lg: 0 22px 60px rgba(0,0,0,.6), 0 8px 22px rgba(0,0,0,.5);
  --grid: rgba(255,255,255,.035);
  --orb: rgba(255,255,255,.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: "IBM Plex Sans Arabic", "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .35s ease, color .35s ease;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
code { font-family: "IBM Plex Mono", monospace; background: var(--bg-3); padding: 2px 6px; border-radius: 6px; font-size: .9em; }

.container {
  width: min(1200px, 92%);
  margin-inline: auto;
}

/* ====== Backgrounds ====== */
.bg-grid {
  position: fixed; inset: 0; z-index: -2;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 30%, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 30%, transparent 80%);
}
.bg-orbs { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.orb {
  position: absolute; width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, var(--orb) 0%, transparent 70%);
  filter: blur(20px);
  animation: orbFloat 18s ease-in-out infinite;
}
.orb-1 { top: -120px; right: -120px; }
.orb-2 { bottom: -180px; left: -120px; animation-delay: -6s; }
.orb-3 { top: 40%; left: 50%; transform: translate(-50%, -50%); width: 700px; height: 700px; animation-delay: -12s; opacity: .7; }
@keyframes orbFloat {
  0%,100% { transform: translate(0,0) scale(1); }
  50%     { transform: translate(20px, -20px) scale(1.05); }
}

/* ====== HEADER ====== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease, background-color .3s ease, box-shadow .3s ease, transform .35s ease;
}
.site-header.scrolled {
  border-bottom-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; padding: 14px 0;
}

.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.brand-text em { font-style: normal; font-size: 12px; color: var(--text-3); margin-top: 2px; }

.header-nav { display: flex; align-items: center; gap: 6px; }
.header-nav a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: 999px;
  color: var(--text-2); font-size: 14px; font-weight: 500;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}
.header-nav a:hover { background: var(--bg-3); color: var(--text); }

.header-actions { display: flex; align-items: center; gap: 10px; }

/* ====== Buttons ====== */
.icon-btn {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 12px; background: var(--surface);
  border: 1px solid var(--border); color: var(--text);
  transition: transform .2s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
  box-shadow: var(--shadow-sm);
}
.icon-btn:hover { transform: translateY(-1px); border-color: var(--border-2); box-shadow: var(--shadow-md); }
.icon-btn:active { transform: translateY(0); }

.primary-btn, .ghost-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 20px; border-radius: 12px; font-weight: 600; font-size: 14px;
  border: 1px solid transparent; transition: transform .2s ease, background .25s ease, color .25s ease, border-color .25s ease, box-shadow .25s ease;
  text-decoration: none;
}
.primary-btn {
  background: var(--accent); color: var(--accent-contrast);
  box-shadow: var(--shadow-md);
}
.primary-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.primary-btn:active { transform: translateY(0); }
.primary-btn:disabled { opacity: .5; cursor: not-allowed; }

.ghost-btn {
  background: transparent;
  color: var(--text);
  border-color: var(--border-2);
  backdrop-filter: blur(8px);
}
.ghost-btn:hover:not(:disabled) { background: var(--bg-3); border-color: var(--text-3); transform: translateY(-2px); }
.ghost-btn:active { transform: translateY(0); }
.ghost-btn:disabled { opacity: .45; cursor: not-allowed; }
.ghost-btn.lg { padding: 14px 22px; font-size: 15px; }
.ghost-btn.full { width: 100%; margin-top: 12px; }
.ghost-btn.danger { color: var(--err); border-color: color-mix(in oklab, var(--err) 50%, var(--border-2)); }
.ghost-btn.danger:hover { background: color-mix(in oklab, var(--err) 8%, transparent); }

/* ====== HERO ====== */
.hero { padding: 70px 0 40px; }
.hero-inner {
  display: grid; grid-template-columns: 1.1fr .9fr;
  gap: 50px; align-items: center;
}
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px;
  background: var(--bg-3); color: var(--text-2);
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--border);
}
.hero h1 {
  margin: 18px 0 14px; font-size: clamp(30px, 4.6vw, 54px);
  line-height: 1.15; font-weight: 700; letter-spacing: -.5px;
}
.hero h1 .grad {
  background: linear-gradient(135deg, var(--text) 0%, var(--text-3) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--text-2); font-size: 17px; max-width: 56ch; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }

.hero-visual { position: relative; }
.hero-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-lg);
  animation: floatCard 6s ease-in-out infinite;
}
@keyframes floatCard {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-8px); }
}
.hc-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; color: var(--text-3); font-size: 12px; }
.hc-row .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border-2); }
.hc-row em { margin-inline-start: auto; font-style: normal; font-family: "IBM Plex Mono", monospace; }
.hc-svg { width: 100%; height: auto; color: var(--text); }
.hc-foot { display: flex; gap: 14px; margin-top: 12px; color: var(--text-3); font-size: 13px; }
.hc-foot span { display: inline-flex; align-items: center; gap: 6px; }

/* ====== STATS ====== */
.stats { padding: 30px 0; }
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.stat-card {
  display: flex; align-items: center; gap: 14px;
  padding: 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-2); }
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--bg-3); color: var(--text);
  font-size: 18px;
}
.stat-info { display: flex; flex-direction: column; }
.stat-num { font-family: "IBM Plex Mono", monospace; font-size: 24px; font-weight: 700; color: var(--text); }
.stat-label { color: var(--text-3); font-size: 13px; }

/* ====== Section heads ====== */
.section-head { text-align: center; margin: 40px 0 28px; }
.section-head h2 {
  margin: 0 0 10px; font-size: clamp(24px, 3vw, 34px);
  font-weight: 700; letter-spacing: -.3px;
  display: inline-flex; align-items: center; gap: 12px;
}
.section-head p { color: var(--text-3); margin: 0; font-size: 15px; }

/* ====== CONVERTER ====== */
.converter { padding: 30px 0 60px; }

.dropzone {
  border: 2px dashed var(--border-2);
  border-radius: var(--radius-xl);
  padding: 50px 24px;
  text-align: center;
  background: var(--surface);
  transition: border-color .25s ease, background .25s ease, transform .25s ease;
  cursor: pointer;
  position: relative;
}
.dropzone:hover, .dropzone:focus-visible {
  border-color: var(--text);
  background: var(--surface-2);
}
.dropzone.drag {
  border-color: var(--text);
  background: var(--bg-3);
  transform: scale(1.01);
}
.dz-inner { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.dz-icon {
  width: 72px; height: 72px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg-3); color: var(--text);
  font-size: 28px; margin-bottom: 6px;
  border: 1px solid var(--border);
}
.dropzone h3 { margin: 6px 0 4px; font-size: 20px; font-weight: 600; }
.dropzone p { color: var(--text-3); margin: 0 0 14px; font-size: 14px; }

/* Settings */
.settings {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; margin-top: 18px;
}
.setting {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
}
.setting > span {
  font-size: 13px; color: var(--text-3);
  display: inline-flex; align-items: center; gap: 8px;
}
.setting select {
  appearance: none; -webkit-appearance: none;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: 10px; padding: 10px 12px;
  font-family: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; outline: none;
  transition: border-color .2s ease, background .2s ease;
}
.setting select:hover { border-color: var(--text-3); }
.setting select:focus { border-color: var(--text); }

/* Action bar */
.action-bar {
  margin-top: 18px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.ab-info { display: flex; flex-wrap: wrap; gap: 8px; }
.ab-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 999px;
  background: var(--bg-3); border: 1px solid var(--border);
  font-size: 13px; font-weight: 500; color: var(--text-2);
}
.chip.ok { color: var(--ok); border-color: color-mix(in oklab, var(--ok) 35%, var(--border)); }
.chip.warn { color: var(--warn); border-color: color-mix(in oklab, var(--warn) 35%, var(--border)); }
.chip span { font-family: "IBM Plex Mono", monospace; }

/* Global progress */
.global-progress {
  margin-top: 16px; padding: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.gp-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.gp-bar { height: 8px; background: var(--bg-3); border-radius: 999px; overflow: hidden; }
.gp-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--text), var(--text-3));
  border-radius: 999px; transition: width .35s ease;
}

/* Files grid */
.files-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px; margin-top: 18px;
}
.file-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: transform .25s ease, box-shadow .25s ease;
  animation: fcIn .35s ease both;
}
.file-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
@keyframes fcIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fc-thumb {
  position: relative;
  aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden;
  background: var(--bg-3); display: grid; place-items: center;
}
.fc-thumb img, .fc-thumb svg, .fc-thumb .svg-wrap { width: 100%; height: 100%; object-fit: contain; }
.fc-thumb .svg-wrap { display: grid; place-items: center; padding: 8px; }
.fc-thumb .svg-wrap svg { max-width: 100%; max-height: 100%; }
.fc-status {
  position: absolute; top: 8px; inset-inline-start: 8px;
  display: inline-flex; align-items: center; gap: 6px;
  background: color-mix(in oklab, var(--bg) 70%, transparent);
  backdrop-filter: blur(6px);
  padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600; color: var(--text-2);
  border: 1px solid var(--border);
}
.fc-status.ok { color: var(--ok); border-color: color-mix(in oklab, var(--ok) 40%, var(--border)); }
.fc-status.run { color: var(--warn); }
.fc-status.err { color: var(--err); border-color: color-mix(in oklab, var(--err) 40%, var(--border)); }
.fc-status .fa-spinner { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.fc-name {
  font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  direction: ltr; text-align: left;
}
.fc-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); }
.fc-progress {
  height: 6px; background: var(--bg-3); border-radius: 999px; overflow: hidden;
}
.fc-progress > i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--text), var(--text-3));
  transition: width .25s ease;
}
.fc-actions { display: flex; gap: 8px; }
.fc-actions button {
  flex: 1; padding: 8px 10px; font-size: 12px; border-radius: 10px;
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-weight: 500; transition: background .2s ease, border-color .2s ease, transform .2s ease;
}
.fc-actions button:hover:not(:disabled) { background: var(--bg-2); border-color: var(--border-2); transform: translateY(-1px); }
.fc-actions button:disabled { opacity: .45; cursor: not-allowed; }

/* ====== FEATURES ====== */
.features { padding: 60px 0; }
.feat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.feat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--border-2); }
.feat-card i {
  width: 44px; height: 44px; border-radius: 12px;
  display: inline-grid; place-items: center;
  background: var(--bg-3); color: var(--text);
  font-size: 18px; margin-bottom: 12px;
}
.feat-card h4 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.feat-card p { margin: 0; color: var(--text-3); font-size: 14px; }

/* ====== ABOUT ====== */
.about { padding: 30px 0 70px; }
.about-inner { display: grid; grid-template-columns: 1.3fr .8fr; gap: 30px; align-items: center; }
.about-inner h2 { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.about-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.about-list li { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 15px; }
.about-list li i { color: var(--ok); }
.about-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px;
  box-shadow: var(--shadow-md);
}
.ac-head { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; margin-bottom: 8px; }
.about-card p { color: var(--text-3); margin: 0 0 14px; }

/* ====== FOOTER ====== */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.footer-inner {
  display: grid; grid-template-columns: 1.4fr .8fr 1fr;
  gap: 30px; padding: 50px 0 24px;
}
.foot-col h5 {
  margin: 0 0 14px; font-size: 14px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 10px;
  text-transform: uppercase; letter-spacing: 1px; color: var(--text-2);
}
.foot-desc { color: var(--text-3); font-size: 14px; max-width: 50ch; margin: 12px 0 0; }
.foot-links { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.foot-links a { color: var(--text-2); font-size: 14px; transition: color .2s ease; }
.foot-links a:hover { color: var(--text); }
.socials { display: flex; gap: 10px; flex-wrap: wrap; }
.socials a {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: transparent; border: 1px solid var(--border-2);
  color: var(--text); transition: transform .2s ease, background .2s ease, border-color .2s ease;
}
.socials a:hover { transform: translateY(-2px); background: var(--bg-3); border-color: var(--text); }

.foot-bottom {
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 0; color: var(--text-3); font-size: 13px;
}
.foot-bottom .fa-heart { color: var(--err); }
.foot-bottom .container { display: contents; }

/* ====== Toast ====== */
.toast {
  position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--accent-contrast);
  padding: 12px 20px; border-radius: 12px;
  font-weight: 500; font-size: 14px;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: transform .35s ease, opacity .35s ease;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ====== Reveal animations ====== */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }

/* ====== Header hide on scroll down ====== */
.site-header.hide-on-scroll { transform: translateY(-100%); }

/* ====== Responsive ====== */
@media (max-width: 980px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-visual { order: -1; max-width: 480px; margin-inline: auto; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .feat-grid { grid-template-columns: repeat(2, 1fr); }
  .about-inner { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .header-nav { display: none; }
}
@media (max-width: 620px) {
  .hero { padding: 40px 0 20px; }
  .settings { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .feat-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .action-bar { flex-direction: column; align-items: stretch; }
  .ab-buttons { justify-content: stretch; }
  .ab-buttons button { flex: 1; }
  .brand-text em { display: none; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* Selection */
::selection { background: var(--text); color: var(--accent-contrast); }
