@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=Noto+Sans+Arabic:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&display=swap');

:root {
  --bg: #FAFAF9;
  --surface: #FFFFFF;
  --surface-2: #F2F2EF;
  --ink: #14151A;
  --ink-soft: #62636D;
  --ink-faint: #93949C;
  --border: #E5E5E1;
  --accent: #3454D1;
  --accent-ink: #FFFFFF;
  --accent-soft: #EAEEFC;
  --success: #158F58;
  --success-soft: #E4F5EC;
  --danger: #C23B3B;
  --danger-soft: #FBEAEA;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20,21,26,.04), 0 8px 24px rgba(20,21,26,.05);
  --font-display: 'Space Grotesk', 'Noto Sans Arabic', 'Noto Sans SC', sans-serif;
  --font-body: 'Inter', 'Noto Sans Arabic', 'Noto Sans SC', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E0F13; --surface: #16171D; --surface-2: #1C1E25;
    --ink: #F2F2F0; --ink-soft: #ACADB6; --ink-faint: #6E6F79;
    --border: #2A2C35; --accent: #7C97FF; --accent-ink: #0E0F13; --accent-soft: #1C2340;
    --success: #38C98A; --success-soft: #113526; --danger: #FF7A7A; --danger-soft: #3A1A1A;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 28px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  --bg: #0E0F13; --surface: #16171D; --surface-2: #1C1E25;
  --ink: #F2F2F0; --ink-soft: #ACADB6; --ink-faint: #6E6F79;
  --border: #2A2C35; --accent: #7C97FF; --accent-ink: #0E0F13; --accent-soft: #1C2340;
  --success: #38C98A; --success-soft: #113526; --danger: #FF7A7A; --danger-soft: #3A1A1A;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 28px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html {
  scroll-padding-top: env(safe-area-inset-top, 0px);
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transition: background .2s ease, color .2s ease;
}
[dir="rtl"] body { font-family: 'Noto Sans Arabic', var(--font-body); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0; }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3 { font-family: 'Noto Sans Arabic', var(--font-display); }
p { margin: 0; color: var(--ink-soft); }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.skip-link { position: absolute; top: 0; inset-inline-start: 0; transform: translateY(-200%); }
.skip-link:focus { transform: none; inset-inline-start: 1rem; top: 1rem; z-index: 100; background: var(--surface); padding: .5rem 1rem; border-radius: var(--radius-sm); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; cursor: pointer; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #123c80, #14d8df); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; box-shadow: 0 6px 14px rgba(20, 129, 194, .25); }
.brand-mark svg { width: 27px; height: 27px; }
.header-controls { display: flex; align-items: center; gap: 8px; }

.theme-switch { display: flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px; gap: 2px; }
.theme-switch button { width: 30px; height: 30px; border-radius: 999px; border: 0; background: transparent; color: var(--ink-soft); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.theme-switch button svg { width: 15px; height: 15px; }
.theme-switch button.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }

.lang-switch { position: relative; }
.lang-toggle { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--ink); cursor: pointer; font-size: .85rem; font-weight: 600; }
.lang-menu { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); min-width: 150px; padding: 6px; display: none; flex-direction: column; }
.lang-menu.open { display: flex; }
.lang-menu button { text-align: start; padding: 8px 10px; border-radius: 8px; border: 0; background: transparent; color: var(--ink); cursor: pointer; font-size: .9rem; }
.lang-menu button:hover { background: var(--surface-2); }
.lang-menu button.active { color: var(--accent); font-weight: 600; }

/* ---------- layout ---------- */
main { max-width: 1080px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 80px; }

.hero { padding: clamp(40px, 8vw, 88px) 0 clamp(28px, 5vw, 48px); max-width: 720px; }
.hero-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .78rem; font-weight: 600; margin-bottom: 18px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.1rem); letter-spacing: -0.02em; }
.hero-sub { margin-top: 16px; font-size: 1.05rem; line-height: 1.6; max-width: 58ch; }
.search-wrap { margin-top: 28px; }
#search-input {
  width: 100%; max-width: 460px; padding: 13px 18px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink); font-size: .95rem;
}
#search-input:focus { border-color: var(--accent); }

.ad-slot { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; min-height: 74px; margin: 0 0 34px; padding: 14px 20px; border: 1px dashed var(--border); border-radius: var(--radius); background: linear-gradient(135deg, color-mix(in srgb, var(--surface) 92%, var(--accent-soft)), var(--surface)); color: var(--ink-soft); text-align: center; }
.ad-slot strong { color: var(--ink); font-size: .92rem; }
.ad-slot > span:not(.ad-slot-label) { font-size: .78rem; }
.ad-slot-label { align-self: flex-start; padding: 3px 7px; border-radius: 5px; background: var(--surface-2); color: var(--ink-faint); font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; }

.tool-section { margin-top: 44px; }
.section-title { font-size: 1.1rem; color: var(--ink-soft); font-weight: 600; margin-bottom: 16px; font-family: var(--font-body); }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: 12px; }

.tool-card {
  display: flex; gap: 12px; align-items: flex-start; padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.tool-card:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-1px); }
.tool-card-icon { width: 20px; height: 20px; flex: none; color: var(--accent); margin-top: 2px; }
.tool-card-body h3 { font-size: .95rem; font-weight: 600; margin-bottom: 4px; }
.tool-card-body p { font-size: .82rem; line-height: 1.45; }

/* ---------- animated folder cards ---------- */
.fm-folder-card {
  --folder-transition: 350ms;
  --folder-w: 120px;
  --folder-h: 80px;
  min-height: 198px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 12px 12px;
  overflow: visible;
  text-align: center;
  background: linear-gradient(135deg, #6dd5ed, #2193b0);
  border: 0;
  border-radius: 15px;
  box-shadow: 0 15px 30px rgba(0, 0, 0, .18);
  color: #fff;
  transition: transform var(--folder-transition) ease, box-shadow var(--folder-transition) ease, filter var(--folder-transition) ease;
}
.fm-folder-card:hover {
  border-color: transparent;
  box-shadow: 0 18px 34px rgba(0, 0, 0, .25);
  transform: translateY(-4px);
  filter: saturate(1.06);
}
.fm-folder-card:focus-visible { outline-color: #fff; outline-offset: 4px; }
.fm-folder-visual {
  position: relative;
  display: block;
  width: var(--folder-w);
  height: 102px;
  flex: none;
}
.fm-folder-shape {
  position: absolute;
  top: 12px;
  left: 0;
  width: var(--folder-w);
  height: var(--folder-h);
  animation: fm-folder-float 2.5s infinite ease-in-out;
  transition: transform var(--folder-transition) ease;
  transform-style: preserve-3d;
}
.fm-folder-front, .fm-folder-back {
  position: absolute;
  inset: 0;
  transform-origin: bottom center;
  transition: transform var(--folder-transition) ease;
}
.fm-folder-back {
  z-index: 0;
  background: rgba(255, 255, 255, .28);
  border-radius: 15px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .12);
}
.fm-folder-back::before, .fm-folder-back::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  display: block;
  background: rgba(255, 255, 255, .46);
  border-radius: 15px;
  transform-origin: bottom center;
  transition: transform var(--folder-transition) ease;
}
.fm-folder-front { z-index: 1; }
.fm-folder-tab {
  position: absolute;
  top: -10px;
  left: 0;
  z-index: 2;
  width: 80px;
  height: 20px;
  background: linear-gradient(135deg, #ff9a56, #ff6f56);
  border-radius: 12px 12px 0 0;
  box-shadow: 0 5px 15px rgba(0, 0, 0, .18);
}
.fm-folder-cover {
  display: block;
  width: var(--folder-w);
  height: var(--folder-h);
  background: linear-gradient(135deg, #ffe563, #ffc663);
  border-radius: 10px;
  box-shadow: 0 15px 30px rgba(0, 0, 0, .25);
}
.fm-folder-card:hover .fm-folder-shape { transform: scale(1.05); }
.fm-folder-card:hover .fm-folder-front { transform: rotateX(-40deg) skewX(15deg); }
.fm-folder-card:hover .fm-folder-back::before { transform: rotateX(-5deg) skewX(5deg); }
.fm-folder-card:hover .fm-folder-back::after { transform: rotateX(-15deg) skewX(12deg); }
.fm-folder-label {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .2);
  box-shadow: 0 10px 20px rgba(0, 0, 0, .1);
  color: #fff;
  font-size: .94rem;
  font-weight: 700;
  line-height: 1.3;
  transition: background var(--folder-transition) ease;
}
.fm-folder-card:hover .fm-folder-label { background: rgba(255, 255, 255, .34); }
.fm-folder-description {
  display: block;
  width: 100%;
  min-height: 2.5em;
  color: rgba(255, 255, 255, .86);
  font-size: .76rem;
  line-height: 1.35;
}
@keyframes fm-folder-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* ---------- tool page ---------- */
.tool-page { max-width: 680px; margin: 0 auto; padding-top: 32px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; color: var(--ink-soft); margin-bottom: 22px; }
.back-link svg { width: 15px; height: 15px; }
[dir="rtl"] .back-link svg { transform: scaleX(-1); }
.tool-header { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 20px; }
.tool-page-icon { width: 30px; height: 30px; color: var(--accent); flex: none; margin-top: 4px; }
.tool-header h1 { font-size: 1.6rem; margin-bottom: 6px; }
.tool-header p { font-size: .95rem; }

.note { padding: 12px 16px; border-radius: var(--radius-sm); font-size: .85rem; margin-bottom: 20px; line-height: 1.5; }
.note-limit { background: var(--accent-soft); color: var(--accent); }

.dropzone {
  border: 1.5px dashed var(--border); border-radius: var(--radius); padding: 40px 20px; text-align: center;
  cursor: pointer; background: var(--surface); transition: border-color .15s ease, background .15s ease;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon { width: 30px; height: 30px; color: var(--ink-faint); margin-bottom: 10px; }
.drop-title { font-weight: 600; color: var(--ink); font-size: .98rem; }
.drop-sub { font-size: .84rem; margin-top: 4px; }

.file-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.file-list li { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: .86rem; }
.file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--ink-faint); font-size: .78rem; }
.file-remove { border: 0; background: transparent; color: var(--ink-faint); font-size: 1.1rem; cursor: pointer; line-height: 1; padding: 2px 6px; }
.file-remove:hover { color: var(--danger); }

.opts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 22px; }
.opt { display: flex; flex-direction: column; gap: 6px; font-size: .84rem; color: var(--ink-soft); }
.opt select, .opt input[type="text"], .opt input[type="password"], .opt input[type="number"] {
  padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--ink); font-size: .88rem;
}
.opt input[type="range"] { accent-color: var(--accent); }

.actions { display: flex; gap: 10px; margin-top: 26px; flex-wrap: wrap; }
.btn { padding: 12px 22px; border-radius: 999px; border: 1px solid transparent; font-weight: 600; font-size: .9rem; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary:not(:disabled):hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); }

.status { margin-top: 24px; padding: 16px 18px; border-radius: var(--radius); font-size: .9rem; }
.status-busy { background: var(--surface-2); display: flex; flex-direction: column; gap: 10px; }
.status-busy > span { color: var(--ink); font-weight: 500; }
.status-done { background: var(--success-soft); color: var(--success); }
.status-error { background: var(--danger-soft); color: var(--danger); }
.result-actions { margin-top: 12px; display: flex; gap: 10px; flex-wrap: wrap; }
.result-actions .btn { background: var(--success); color: #fff; }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--border); border-top-color: var(--accent); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-bar { height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--accent); transition: width .2s ease; }

.privacy-note { margin-top: 28px; font-size: .78rem; color: var(--ink-faint); line-height: 1.6; max-width: 60ch; }

.site-footer { border-top: 1px solid var(--border); padding: 28px clamp(16px, 4vw, 40px) calc(28px + env(safe-area-inset-bottom, 0px)); text-align: center; color: var(--ink-faint); font-size: .8rem; }
.footer-brand { margin-bottom: 7px; color: var(--ink); font-family: var(--font-display); font-size: 1rem; font-weight: 700; }
#footer-safe { margin-top: 5px; }
#footer-made { margin-top: 8px; color: var(--accent); font-weight: 700; }
.social-links { display: flex; justify-content: center; gap: 14px; margin-top: 18px; }
.social-link { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border: 0; border-radius: 13px; background: #2b2b2b; color: #fff; box-shadow: 0 8px 18px rgba(0, 0, 0, .12); transition: transform .18s ease, color .18s ease, background .18s ease, box-shadow .18s ease; }
.social-link svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.social-tiktok svg, .social-facebook svg, .social-x svg { fill: currentColor; stroke: none; }
.social-link:hover, .social-link:focus-visible, .social-link:active { transform: translateY(-3px); color: #fff; box-shadow: 0 10px 22px rgba(0, 0, 0, .2); }
.social-instagram:hover, .social-instagram:focus-visible, .social-instagram:active { background: linear-gradient(135deg, #833ab4, #fd1d1d 55%, #fcb045); }
.social-tiktok:hover, .social-tiktok:focus-visible, .social-tiktok:active { background: #000; }
.social-facebook:hover, .social-facebook:focus-visible, .social-facebook:active { background: #1877f2; }
.social-x:hover, .social-x:focus-visible, .social-x:active { background: #000; }
@media (max-width: 430px) {
  .social-link { width: 56px; height: 56px; }
  .social-link svg { width: 30px; height: 30px; }
}
.legal-page { max-width: 760px; margin: 0 auto; padding: 48px clamp(16px, 4vw, 40px) 80px; }
.legal-page h1 { margin-bottom: 8px; font-size: clamp(2rem, 5vw, 3rem); }
.legal-page h2 { margin: 30px 0 8px; font-size: 1.2rem; }
.legal-page p { line-height: 1.85; }
.legal-updated { color: var(--ink-faint); font-size: .85rem; }
.contact-list { display: flex; flex-direction: column; gap: 10px; margin: 24px 0; }
.contact-list a { padding: 13px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--accent); font-weight: 600; transition: background .18s ease, transform .18s ease; }
.contact-list a:hover { background: var(--accent-soft); transform: translateY(-2px); }
.legal-links { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; margin-top: 18px; }
.legal-links a { color: var(--ink-soft); font-size: .78rem; }
.legal-links a:hover { color: var(--accent); text-decoration: underline; }

@media (max-width: 560px) {
  .tool-grid { grid-template-columns: 1fr 1fr; }
  .hero { padding-top: 28px; }
}
@media (max-width: 380px) {
  .tool-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* no horizontal scroll on any device */
html, body { max-width: 100%; overflow-x: hidden; }
img, svg, video, canvas, iframe { max-width: 100%; }
