/* ═══════════════════════════════════════
   VECTOWL — Dark/Light Theme System
   Brand: Green (#4ade80 / #16a34a)
   Default: Dark mode
   ═══════════════════════════════════════ */

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

/* ── Dark Theme (default) ── */
:root, [data-theme="dark"] {
  --bg: #0c0f14;
  --surface: #12161e;
  --surface-2: #1a1f2b;
  --surface-3: #242a38;
  --border: #1f2737;
  --border-hover: #2d3a4f;
  --text: #eaf0f6;
  --text-dim: #8b97ad;
  --text-muted: #4f5d73;
  --green: #4ade80;
  --green-dim: rgba(74,222,128,0.12);
  --green-dark: #16a34a;
  --green-glow: 0 0 20px rgba(74,222,128,0.15);
  --accent: #4ade80;
  --accent-dim: rgba(74,222,128,0.1);
  --checker-a: #0f1420;
  --checker-b: transparent;
  --card-shadow: 0 2px 8px rgba(0,0,0,0.3);
  --success: #34d399;
  --success-bg: rgba(52,211,153,0.1);
  --danger: #f87171;
  --danger-bg: rgba(248,113,113,0.1);
  --theme-toggle-bg: var(--surface-2);
}

/* ── Light Theme ── */
[data-theme="light"] {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #eef0f4;
  --border: #d4d9e1;
  --border-hover: #b8c0cc;
  --text: #111827;
  --text-dim: #4b5563;
  --text-muted: #9ca3af;
  --green: #16a34a;
  --green-dim: rgba(22,163,74,0.08);
  --green-dark: #15803d;
  --green-glow: 0 0 12px rgba(22,163,74,0.1);
  --accent: #16a34a;
  --accent-dim: rgba(22,163,74,0.06);
  --checker-a: #e5e7eb;
  --checker-b: transparent;
  --card-shadow: 0 2px 8px rgba(0,0,0,0.06);
  --success: #059669;
  --success-bg: rgba(5,150,105,0.08);
  --danger: #dc2626;
  --danger-bg: rgba(220,38,38,0.06);
  --theme-toggle-bg: var(--surface-3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100vh; overflow-x: hidden;
  transition: background 0.35s, color 0.35s;
}
[dir="rtl"] { direction: rtl; text-align: right; }
[dir="rtl"] .topnav-inner,
[dir="rtl"] .nav-links,
[dir="rtl"] .cookie-inner { flex-direction: row-reverse; }
[dir="rtl"] .file-item,
[dir="rtl"] .range-wrap { flex-direction: row-reverse; }

body::before {
  content: ''; position: fixed; top: -30%; left: -10%;
  width: 60vw; height: 60vw;
  background: radial-gradient(circle, rgba(74,222,128,0.04) 0%, transparent 55%);
  pointer-events: none; z-index: 0;
}

.app { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: 40px 24px 60px; }

/* ── Nav ── */
.topnav {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background 0.35s;
}
.topnav-inner { max-width: 1100px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; }
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text);
  font-family: 'Space Grotesk', sans-serif; font-size: 1.2rem; font-weight: 700;
}
.nav-brand .owl-icon {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, #4ade80, #16a34a);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #0c0f14; font-weight: 800;
}
.nav-brand .brand-green { color: var(--green); }
.nav-right { display: flex; align-items: center; gap: 16px; }
.nav-links { display: flex; gap: 22px; }
.nav-links a { color: var(--text-dim); text-decoration: none; font-size: 0.85rem; font-weight: 500; transition: color 0.2s; }
.nav-links a:hover { color: var(--green); }

/* Theme toggle */
.theme-toggle {
  width: 36px; height: 20px; border-radius: 100px; cursor: pointer;
  background: var(--theme-toggle-bg); border: 1px solid var(--border);
  position: relative; transition: all 0.3s; flex-shrink: 0;
}
.theme-toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--green); transition: transform 0.3s, background 0.3s;
}
[data-theme="light"] .theme-toggle::after { transform: translateX(16px); background: var(--green-dark); }
.theme-toggle .icon-sun, .theme-toggle .icon-moon { display: none; }

/* Language selector */
.lang-switch { display: flex; gap: 3px; padding: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.lang-btn {
  padding: 4px 8px; border: none; background: transparent;
  color: var(--text-muted); font-family: inherit; font-size: 0.7rem; font-weight: 600;
  cursor: pointer; border-radius: 6px; transition: all 0.2s;
}
.lang-btn:hover { color: var(--text-dim); }
.lang-btn.active { background: var(--green-dim); color: var(--green); }
@media (max-width: 700px) {
  .nav-links { display: none; }
  .lang-btn { padding: 3px 6px; font-size: 0.65rem; }
}

/* ── Header ── */
header { text-align: center; margin-bottom: 36px; }
header .badge {
  display: inline-block; font-size: 11px; font-weight: 600;
  letter-spacing: 1.3px; text-transform: uppercase;
  color: var(--green); background: var(--green-dim);
  border: 1px solid rgba(74,222,128,0.15);
  padding: 5px 16px; border-radius: 100px; margin-bottom: 18px;
}
header h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 700;
  letter-spacing: -0.03em; line-height: 1.15; margin-bottom: 10px;
}
header h1 em { font-style: normal; color: var(--green); }
header p { color: var(--text-dim); font-size: 1rem; max-width: 520px; margin: 0 auto; line-height: 1.6; }

/* ── Cards / Workspace ── */
.workspace { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
@media (max-width: 768px) { .workspace { grid-template-columns: 1fr; } }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 22px; box-shadow: var(--card-shadow);
  transition: border-color 0.3s, background 0.35s, box-shadow 0.35s;
}
.card:hover { border-color: var(--border-hover); }
.card-label { font-size: 10px; font-weight: 600; letter-spacing: 1.4px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 14px; }

/* ── Dropzone ── */
.dropzone {
  position: relative; border: 2px dashed var(--border); border-radius: 14px;
  padding: 44px 20px; text-align: center; cursor: pointer; transition: all 0.3s;
  background: var(--surface); overflow: hidden;
}
.dropzone:hover, .dropzone.drag-over { border-color: var(--green); box-shadow: var(--green-glow); }
.dropzone-icon {
  width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 12px;
  background: var(--green-dim); border: 1px solid rgba(74,222,128,0.12);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.3s;
}
.dropzone:hover .dropzone-icon { transform: translateY(-2px); }
.dropzone-icon svg { color: var(--green); }
.dropzone h3 { font-size: 0.92rem; font-weight: 600; margin-bottom: 3px; }
.dropzone p { font-size: 0.8rem; color: var(--text-muted); }
.dropzone input { display: none; }

/* ── File list ── */
.file-list { margin-top: 12px; display: flex; flex-direction: column; gap: 5px; max-height: 220px; overflow-y: auto; }
.file-list::-webkit-scrollbar { width: 3px; }
.file-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.file-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; background: var(--surface-2); border-radius: 8px; animation: slideIn 0.3s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; } }
.file-item-thumb { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; background: var(--surface-3); flex-shrink: 0; }
.file-item-info { flex: 1; min-width: 0; }
.file-item-name { font-size: 0.8rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item-size { font-size: 0.7rem; color: var(--text-muted); margin-top: 1px; }
.file-item-remove { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 3px; border-radius: 6px; transition: all 0.2s; flex-shrink: 0; }
.file-item-remove:hover { color: var(--danger); background: var(--danger-bg); }

/* ── Settings ── */
.settings { display: flex; flex-direction: column; gap: 16px; }
.setting-group label { display: block; font-size: 0.8rem; font-weight: 500; margin-bottom: 5px; }
.setting-group .hint { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; line-height: 1.5; }
.range-wrap { display: flex; align-items: center; gap: 12px; }
.range-wrap input[type="range"] { flex: 1; -webkit-appearance: none; height: 3px; background: var(--surface-3); border-radius: 3px; outline: none; }
.range-wrap input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; background: var(--green); border-radius: 50%; cursor: pointer; box-shadow: var(--green-glow); }
.range-value { font-size: 0.8rem; font-weight: 600; color: var(--green); min-width: 32px; text-align: right; font-variant-numeric: tabular-nums; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; background: var(--surface-2); border-radius: 8px; border: 1px solid var(--border); cursor: pointer; transition: border-color 0.2s; }
.toggle-row:hover { border-color: var(--border-hover); }
.toggle-row span { font-size: 0.85rem; }
.toggle { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.toggle input { display: none; }
.toggle-track { position: absolute; inset: 0; background: var(--surface-3); border-radius: 100px; transition: background 0.25s; cursor: pointer; }
.toggle input:checked + .toggle-track { background: linear-gradient(135deg, #4ade80, #16a34a); }
.toggle-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; background: white; border-radius: 50%; transition: transform 0.25s; }
.toggle input:checked + .toggle-track::after { transform: translateX(18px); }

.detected-bg { display: none; align-items: center; gap: 8px; padding: 7px 10px; background: var(--surface-2); border-radius: 8px; border: 1px solid var(--border); font-size: 0.75rem; color: var(--text-dim); }
.detected-bg.visible { display: flex; }
.detected-bg .color-dot { width: 13px; height: 13px; border-radius: 4px; border: 1px solid var(--border-hover); flex-shrink: 0; }
.res-buttons { display: flex; gap: 5px; flex-wrap: wrap; }
.res-btn { padding: 6px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; color: var(--text-dim); font-family: inherit; font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.res-btn:hover { border-color: var(--green); color: var(--green); }
.res-btn.active { border-color: var(--green); color: var(--green); background: var(--green-dim); }

/* ── Buttons ── */
.action-bar { display: flex; gap: 10px; align-items: center; }
.btn-process {
  flex: 1; padding: 13px 24px;
  background: linear-gradient(135deg, #4ade80, #16a34a);
  color: #0c0f14; border: none; border-radius: 14px;
  font-family: inherit; font-size: 0.92rem; font-weight: 700;
  cursor: pointer; transition: all 0.3s;
  box-shadow: 0 4px 16px rgba(74,222,128,0.2);
}
.btn-process:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(74,222,128,0.28); }
.btn-process:disabled { opacity: 0.35; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn-download-all { padding: 13px 18px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; color: var(--text-dim); font-family: inherit; font-size: 0.85rem; font-weight: 500; cursor: pointer; transition: all 0.2s; white-space: nowrap; display: none; }
.btn-download-all.visible { display: flex; align-items: center; gap: 6px; }
.btn-download-all:hover { border-color: var(--success); color: var(--success); }

/* ── Progress ── */
.progress-bar-wrap { height: 3px; background: var(--surface-3); border-radius: 3px; margin-top: 12px; overflow: hidden; display: none; }
.progress-bar-wrap.visible { display: block; }
.progress-bar { height: 100%; background: linear-gradient(90deg, #4ade80, #16a34a); border-radius: 3px; width: 0%; transition: width 0.4s; }
.status-msg { text-align: center; font-size: 0.8rem; color: var(--text-dim); margin-top: 8px; min-height: 18px; }

/* ── Preview ── */
.preview-section { margin-top: 24px; display: none; }
.preview-section.visible { display: block; }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.preview-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; animation: fadeUp 0.4s ease both; box-shadow: var(--card-shadow); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; } }
.preview-card .preview-img-wrap {
  position: relative; height: 180px; display: flex; align-items: center; justify-content: center;
  background-image: linear-gradient(45deg, var(--checker-a) 25%, var(--checker-b) 25%), linear-gradient(-45deg, var(--checker-a) 25%, var(--checker-b) 25%), linear-gradient(45deg, var(--checker-b) 75%, var(--checker-a) 75%), linear-gradient(-45deg, var(--checker-b) 75%, var(--checker-a) 75%);
  background-size: 14px 14px; background-position: 0 0, 0 7px, 7px -7px, -7px 0; background-color: var(--surface-2);
}
.preview-card img { max-width: 90%; max-height: 165px; object-fit: contain; position: relative; z-index: 1; }
.preview-card .status-badge { position: absolute; top: 7px; right: 7px; font-size: 9px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; padding: 3px 9px; border-radius: 100px; z-index: 2; background: var(--success-bg); color: var(--success); border: 1px solid rgba(52,211,153,0.15); }
.preview-card-info { padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); }
.preview-card-name { font-size: 0.75rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; }
.preview-card-actions { display: flex; gap: 4px; }
.btn-icon { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; color: var(--text-dim); cursor: pointer; transition: all 0.2s; }
.btn-icon:hover { border-color: var(--green); color: var(--green); background: var(--green-dim); }
.btn-icon.download:hover { border-color: var(--success); color: var(--success); background: var(--success-bg); }

/* ── Modal ── */
.comparison-modal { display: none; position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,0.85); backdrop-filter: blur(10px); align-items: center; justify-content: center; padding: 24px; }
.comparison-modal.open { display: flex; }
.comparison-inner { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px; max-width: 660px; width: 100%; position: relative; }
.comparison-close { position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 50%; color: var(--text-dim); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; z-index: 2; }
.comparison-close:hover { color: var(--text); border-color: var(--green); }
.comparison-images { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
.comparison-col { text-align: center; }
.comp-label { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 6px; }
.comparison-col img { max-width: 100%; max-height: 280px; border-radius: 8px; object-fit: contain; }
.comp-original-bg { background: var(--surface-2); border-radius: 8px; padding: 8px; }
.comp-result-bg { border-radius: 8px; padding: 8px; background-image: linear-gradient(45deg, var(--checker-a) 25%, var(--checker-b) 25%), linear-gradient(-45deg, var(--checker-a) 25%, var(--checker-b) 25%), linear-gradient(45deg, var(--checker-b) 75%, var(--checker-a) 75%), linear-gradient(-45deg, var(--checker-b) 75%, var(--checker-a) 75%); background-size: 14px 14px; background-position: 0 0, 0 7px, 7px -7px, -7px 0; background-color: var(--surface-2); }

/* ── Content sections ── */
.content-section { margin-top: 52px; padding-top: 24px; }
.content-section h2 { font-family: 'Space Grotesk', sans-serif; font-size: 1.7rem; font-weight: 700; text-align: center; margin-bottom: 28px; letter-spacing: -0.02em; }
.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 700px) { .steps-grid { grid-template-columns: 1fr; } }
.step-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px; text-align: center; box-shadow: var(--card-shadow); transition: background 0.35s, border-color 0.3s; }
.step-num { width: 34px; height: 34px; margin: 0 auto 10px; border-radius: 10px; background: var(--green-dim); border: 1px solid rgba(74,222,128,0.12); color: var(--green); font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; }
.step-card h3 { font-size: 0.88rem; font-weight: 600; margin-bottom: 5px; }
.step-card p { font-size: 0.8rem; color: var(--text-dim); line-height: 1.55; }
.features-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (max-width: 600px) { .features-grid { grid-template-columns: 1fr; } }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; transition: border-color 0.3s, background 0.35s; box-shadow: var(--card-shadow); }
.feature:hover { border-color: var(--border-hover); }
.feature-icon { font-size: 1.3rem; margin-bottom: 8px; }
.feature h3 { font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; }
.feature p { font-size: 0.8rem; color: var(--text-dim); line-height: 1.5; }

/* FAQ */
.faq-list { max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; gap: 5px; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; transition: background 0.35s; }
.faq-item summary { padding: 12px 16px; font-size: 0.88rem; font-weight: 500; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; color: var(--green); font-size: 1rem; font-weight: 300; }
.faq-item[open] summary::after { content: '−'; }
.faq-item p { padding: 0 16px 12px; font-size: 0.82rem; color: var(--text-dim); line-height: 1.6; }

/* ── Ads ── */
.ad-container { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px; text-align: center; margin: 22px 0; min-height: 80px; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; transition: background 0.35s; }
.ad-label { position: absolute; top: 4px; left: 9px; font-size: 8px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--text-muted); opacity: 0.5; }
[dir="rtl"] .ad-label { left: auto; right: 9px; }

/* ── Footer ── */
.site-footer { border-top: 1px solid var(--border); margin-top: 64px; padding: 32px 24px 24px; transition: border-color 0.35s; }
.footer-inner { max-width: 1100px; margin: 0 auto; text-align: center; }
.footer-brand span { font-family: 'Space Grotesk', sans-serif; font-size: 1.05rem; font-weight: 700; }
.footer-brand .brand-green { color: var(--green); }
.footer-brand p { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.footer-links { display: flex; gap: 18px; justify-content: center; margin: 14px 0; flex-wrap: wrap; }
.footer-links a { color: var(--text-dim); text-decoration: none; font-size: 0.75rem; transition: color 0.2s; }
.footer-links a:hover { color: var(--green); }
.footer-copy { font-size: 0.7rem; color: var(--text-muted); }

/* ── Cookie ── */
.cookie-banner { position: fixed; bottom: 0; left: 0; right: 0; z-index: 999; background: var(--surface); border-top: 1px solid var(--border); padding: 12px 20px; animation: slideUp 0.4s ease; transition: background 0.35s; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.cookie-banner.hidden { display: none; }
.cookie-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.cookie-inner p { font-size: 0.8rem; color: var(--text-dim); line-height: 1.4; flex: 1; min-width: 200px; }
.cookie-inner a { color: var(--green); text-decoration: none; }
.cookie-actions { display: flex; gap: 6px; flex-shrink: 0; }
.cookie-btn { padding: 8px 16px; border-radius: 8px; font-family: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.cookie-btn.primary { background: linear-gradient(135deg, #4ade80, #16a34a); color: #0c0f14; border: none; }
.cookie-btn.secondary { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.cookie-btn.secondary:hover { border-color: var(--green); color: var(--green); }
