/* ============================================================
   Launchpad — Heebo, Light / Dark
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;600;700;800;900&display=swap');

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

/* ===== LIGHT THEME (default) ===== */
:root,
[data-theme="light"] {
  --bg:       #f0f2f5;
  --surface:  #ffffff;
  --border:   #d8dce4;
  --text:     #0d0e12;
  --text-2:   #3a3d4a;
  --muted:    #60636f;
  --primary:  #4338ca;
  --primary-hover: #3730a3;
  --accent:   #4338ca;
  --card-shadow: 0 2px 16px rgba(0,0,0,.09);
}

/* ===== DARK THEME ===== */
[data-theme="dark"] {
  --bg:        #0d0f1a;
  --surface:   #181b2e;
  --border:    #2e3155;
  --text:      #eef0fa;
  --text-2:    #b8bcdc;
  --muted:     #8a90b8;
  --primary:   #6366f1;
  --primary-hover: #4f52d4;
  --accent:    #6366f1;
  --card-shadow: 0 4px 28px rgba(0,0,0,.55);
}

/* ===== BASE ===== */
html { scroll-behavior: smooth; }

body,
h1, h2, h3, h4, h5, h6,
p, span, a, li, td, th, label, small, strong, em {
  font-family: 'Heebo', sans-serif;
}

body {
  font-family: 'Heebo', sans-serif;
  direction: rtl;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  transition: background .25s, color .25s;
}

input, button, label, select, textarea { font-family: 'Heebo', sans-serif; }

/* ===== HEADER ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  transition: background .25s, border-color .25s;
}

.header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo { display: flex; align-items: center; gap: .6rem; }
.logo-icon { font-size: 1.6rem; line-height: 1; }
.logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.logo-title { font-size: 1.1rem; font-weight: 800; color: var(--text); }
.logo-sub   { font-size: .7rem;  color: var(--muted); font-weight: 400; }

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.header-nav a {
  font-size: .88rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: color .2s;
}
.header-nav a:hover { color: var(--text); }

.theme-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .3rem .55rem;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  transition: border-color .2s, background .2s;
}
.theme-btn:hover { background: var(--border); }

/* ===== HERO ===== */
.hero {
  text-align: center;
  padding: 4rem 1.5rem 2.5rem;
  max-width: 640px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-block;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--primary);
  background: rgba(99,102,241,.13);
  border: 1px solid rgba(99,102,241,.3);
  border-radius: 100px;
  padding: .3rem 1rem;
  margin-bottom: 1.4rem;
}

[data-theme="light"] .hero-badge {
  color: #3730a3;
  background: rgba(99,102,241,.09);
  border-color: rgba(99,102,241,.25);
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -.03em;
  color: var(--text);
  margin-bottom: 1.1rem;
}

.hero-accent {
  color: var(--primary);
}

[data-theme="light"] .hero-accent {
  color: #3730a3;
}

.hero-sub {
  font-size: 1rem;
  color: var(--text-2);
  line-height: 1.8;
  font-weight: 400;
}

/* ===== UPLOAD SECTION ===== */
.upload-section {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

/* ===== CARD ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem;
  box-shadow: var(--card-shadow);
  margin-bottom: 1rem;
  transition: background .25s, border-color .25s;
}

.card h2 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 1.5rem;
}

/* ===== HOW-TO TIP ===== */
.html-tip {
  background: var(--surface-2, rgba(99,102,241,.07));
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .65rem 1rem;
  margin-bottom: 1.2rem;
  font-size: .88rem;
  color: var(--text-2);
}
.html-tip summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
  list-style: none;
  user-select: none;
}
.html-tip summary::-webkit-details-marker { display: none; }
.html-tip summary::before { content: '▸ '; font-size: .8em; }
details[open].html-tip summary::before { content: '▾ '; }
.html-tip ol {
  margin: .75rem 0 .25rem 0;
  padding-right: 1.3rem;
  line-height: 2;
}
.tip-sub {
  font-size: .82rem;
  color: var(--text-3, var(--text-2));
  opacity: .8;
}

/* ===== DROP ZONE ===== */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 2.25rem 1.5rem;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .55rem;
  margin-bottom: 1.25rem;
  transition: border-color .2s, background .2s;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--text);
  background: var(--border);
}

.drop-icon { font-size: 2rem; }
.drop-text { font-size: .92rem; font-weight: 500; color: var(--text-2); }
.drop-hint { font-size: .76rem; color: var(--muted); }

/* ===== SELECTED FILE ===== */
.selected-file {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .65rem 1rem;
  margin-bottom: 1.25rem;
  font-size: .87rem;
}

.file-icon { font-size: 1.1rem; }
.file-name { flex: 1; font-weight: 700; color: var(--text); word-break: break-all; }

.clear-file {
  background: none;
  border: none;
  font-size: .85rem;
  color: var(--muted);
  cursor: pointer;
  padding: .2rem .35rem;
  border-radius: 5px;
  transition: color .2s;
}
.clear-file:hover { color: var(--text); }

/* ===== FORM GROUP ===== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-bottom: 1.25rem;
}

.form-group label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.form-group input {
  font-family: 'Heebo', sans-serif;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .7rem 1rem;
  font-size: .93rem;
  color: var(--text);
  background: var(--bg);
  direction: rtl;
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .25s;
}

.form-group input:focus {
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgba(0,0,0,.06);
  background: var(--surface);
}

[data-theme="dark"] .form-group input:focus {
  box-shadow: 0 0 0 3px rgba(255,255,255,.06);
}

.form-group input::placeholder { color: var(--muted); }

/* ===== MODE CARDS ===== */
.mode-group { margin-bottom: 1.5rem; }

.mode-label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .65rem;
}

.mode-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .75rem;
}

.mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: .35rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem .8rem;
  cursor: pointer;
  background: var(--bg);
  transition: border-color .2s, background .2s;
}

.mode-card:hover { border-color: var(--text-2); }

.mode-card.selected {
  border-color: var(--primary);
  background: var(--surface);
}

.mode-icon { font-size: 1.6rem; line-height: 1; }
.mode-card strong { font-size: .9rem;  font-weight: 800; color: var(--text); }
.mode-card small  { font-size: .77rem; color: var(--text-2); line-height: 1.5; }

/* ===== MODE EXPLANATION ===== */
.mode-explanation {
  margin-top: .85rem;
  padding: .75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .85rem;
  line-height: 1.7;
  color: var(--text-2);
  min-height: 1rem;
  transition: background .25s, border-color .25s;
}
.mode-explanation:empty { display: none; }
.mex-row { margin: 0; }
.mex-row code {
  background: var(--surface-2, rgba(99,102,241,.1));
  padding: .05em .35em;
  border-radius: 4px;
  font-size: .9em;
}
.mex-warning {
  color: #f97316;
  margin-top: .3rem;
  padding-top: .35rem;
  border-top: 1px solid var(--border);
}

/* ===== PREVIEW ===== */
.preview-wrap {
  width: 100%;
  margin: .5rem 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.preview-frame {
  width: 100%;
  height: 420px;
  border: none;
  display: block;
  background: #fff;
}
.preview-note {
  font-size: .8rem;
  color: var(--text-2);
  padding: .4rem .75rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  margin: 0;
}
.preview-note:empty { display: none; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .8rem 1.4rem;
  border-radius: 9px;
  font-size: .95rem;
  font-weight: 700;
  font-family: 'Heebo', sans-serif;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background .2s, color .2s, border-color .2s, transform .12s;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  width: 100%;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

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

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-2);
  font-weight: 600;
}

.btn-outline:hover { border-color: var(--text); color: var(--text); }

/* Full-width outline buttons (result/error cards only) */
.result-card .btn-outline,
.error-card  .btn-outline {
  width: 100%;
  margin-top: .5rem;
}

/* ===== SPINNER ===== */
.spinner {
  width: 16px; height: 16px;
  border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin .65s linear infinite;
}

[data-theme="light"] .spinner { border-color: rgba(255,255,255,.35); border-top-color: #fff; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== PROGRESS CARD ===== */
.progress-card { text-align: center; padding: 2.5rem 2rem; }

.progress-steps {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

.step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .45rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  max-width: 110px;
  position: relative;
  transition: color .3s;
}

.step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 7px;
  left: calc(-50% + 8px);
  width: calc(100% - 16px);
  height: 2px;
  background: var(--border);
  z-index: 0;
  transition: background .4s;
}

.step.done:not(:last-child)::after { background: var(--text); }

.step-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--border);
  position: relative; z-index: 1;
  transition: background .3s, box-shadow .3s;
}

.step.active { color: var(--text); }
.step.done   { color: var(--text); }
.step.active .step-dot { background: var(--text); box-shadow: 0 0 0 4px rgba(0,0,0,.1); }
.step.done   .step-dot { background: var(--text); }

[data-theme="dark"] .step.active .step-dot { box-shadow: 0 0 0 4px rgba(255,255,255,.1); }

.progress-message { font-size: .88rem; color: var(--text-2); }

/* ===== RESULT CARD ===== */
.result-card { text-align: center; }
.result-icon { font-size: 2.6rem; line-height: 1; margin-bottom: .5rem; }

.result-details {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: .9rem 1.1rem;
  margin: 1.1rem 0;
  text-align: start;
  font-size: .85rem;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.result-details span  { color: var(--muted); }
.result-details strong{ color: var(--text); font-weight: 700; }

.next-step {
  margin-top: .3rem;
  padding: .65rem .85rem;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 7px;
  font-size: .82rem;
  line-height: 1.5;
  color: var(--text);
}
.next-step code {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  padding: .1em .35em;
  border-radius: 4px;
  font-size: .9em;
}

/* ===== ERROR CARD ===== */
.error-card { text-align: center; }

.error-message {
  font-size: .88rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: .8rem 1rem;
  margin: 1rem 0;
  text-align: start;
}

/* ===== HOW IT WORKS ===== */
.how-section {
  max-width: 860px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.how-section h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 2rem;
  letter-spacing: -.01em;
}

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

.how-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem 1.2rem;
  text-align: center;
  transition: background .25s, border-color .25s, transform .2s, box-shadow .2s;
}

.how-step:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow);
}

.how-icon { font-size: 1.8rem; margin-bottom: .6rem; line-height: 1; }
.how-step h3 { font-size: .95rem; font-weight: 800; color: var(--text); margin-bottom: .4rem; }
.how-step p  { font-size: .84rem; color: var(--text-2); line-height: 1.7; }

/* ===== ABOUT ===== */
.about-section {
  max-width: 860px;
  margin: 0 auto 3rem;
  padding: 2rem 2.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: background .25s, border-color .25s;
}

.about-section h2 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 1rem;
}

.about-section p {
  font-size: .93rem;
  color: var(--text-2);
  line-height: 1.85;
  margin-bottom: .7rem;
}
.about-section p:last-child { margin-bottom: 0; }
.about-section strong { color: var(--text); font-weight: 700; }
.about-contact {
  margin-top: 1.2rem !important;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: .88rem !important;
}
.about-contact a { color: var(--accent); text-decoration: none; }
.about-contact a:hover { text-decoration: underline; }

/* ===== FOOTER ===== */
.site-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: .8rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
  transition: background .25s, border-color .25s;
}

/* ===== UTILITIES ===== */
.hidden { display: none !important; }

/* ===== RESPONSIVE ===== */
@media (max-width: 520px) {
  .mode-cards { grid-template-columns: 1fr; }
  .header-nav a { display: none; }
  .card { padding: 1.5rem; }
  .about-section { padding: 1.5rem; }
}
