/* ============================================
   ToolCraftX — Global Styles
   ============================================ */

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

:root {
  --brand: #f97316;
  --brand-dark: #ea580c;
  --brand-light: #fff7ed;
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --border: #e2e8f0;
  --border-soft: #f1f5f9;
  --success: #10b981;
  --danger: #ef4444;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow: 0 8px 24px rgba(15,23,42,.08);
  --shadow-lg: 0 24px 64px -12px rgba(15,23,42,.15);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;
  --font-en: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-ar: 'Noto Kufi Arabic', 'Tahoma', 'Segoe UI', sans-serif;
}

body {
  font-family: var(--font-en);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.ar { font-family: var(--font-ar); direction: rtl; line-height: 1.9; font-size: 1.05em; color: var(--ink-soft); }

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); font-size: 14px; }
.space-between { justify-content: space-between; }
.flex { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.w-full { width: 100%; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }

/* ================ NAV ================ */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.9);
  backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--border-soft);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 72px;
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink);
}
.brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--brand), #fb923c);
  color: #fff; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: 0 6px 16px -4px rgba(249,115,22,.4);
}
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-en { font-weight: 800; font-size: 16px; letter-spacing: -.01em; }
.brand-ar { font-family: var(--font-ar); font-size: 12px; color: var(--muted); margin-top: 3px; font-weight: 600; }

.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a { text-decoration: none; color: var(--ink-soft); font-size: 14px; font-weight: 500; transition: color .15s; }
.nav-links a:hover { color: var(--brand); }
.nav-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; }

.lang-toggle {
  font-family: var(--font-ar);
  padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff; cursor: pointer;
  font-size: 13px; font-weight: 600;
  transition: all .15s;
}
.lang-toggle:hover { border-color: var(--brand); color: var(--brand); }

/* ================ BUTTONS ================ */
.btn-primary, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 600; text-decoration: none;
  cursor: pointer; border: 1px solid transparent;
  transition: all .15s ease;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff; box-shadow: 0 8px 20px -8px rgba(249,115,22,.5);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 24px -8px rgba(249,115,22,.55); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-ghost {
  background: #fff; color: var(--ink); border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-lg { padding: 14px 26px; font-size: 15px; border-radius: 12px; }

/* ================ HERO ================ */
.hero {
  padding: 96px 0 80px;
  background:
    radial-gradient(circle at 10% 10%, rgba(249,115,22,.08), transparent 40%),
    radial-gradient(circle at 90% 20%, rgba(234,88,12,.06), transparent 40%),
    linear-gradient(180deg, #fffaf2 0%, #ffffff 100%);
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(249,115,22,.08) 1px, transparent 0);
  background-size: 24px 24px; pointer-events: none;
}
.hero-inner {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 1.1fr 1fr;
  align-items: center; gap: 48px;
}
.badge-pill {
  display: inline-block;
  padding: 6px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
  margin-bottom: 28px;
}
.hero-title {
  font-size: 56px; font-weight: 800; letter-spacing: -.02em; line-height: 1.05;
  margin-bottom: 20px;
}
.gradient {
  background: linear-gradient(135deg, var(--brand), #fb923c, #fbbf24);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub {
  font-size: 18px; color: var(--muted); max-width: 540px; margin-bottom: 32px;
}
.hero-cta { display: flex; gap: 12px; margin-bottom: 40px; }
.hero-stats { display: flex; gap: 40px; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong { font-size: 24px; font-weight: 800; color: var(--ink); }
.hero-stats span { font-size: 13px; color: var(--muted); }

/* Hero visual card (mock preview) */
.hero-visual { display: flex; justify-content: center; align-items: center; }
.hero-card {
  width: 100%; max-width: 480px;
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-soft);
  overflow: hidden;
  transform: perspective(1000px) rotateY(-6deg) rotateX(4deg);
  transition: transform .4s ease;
}
.hero-card:hover { transform: perspective(1000px) rotateY(0deg) rotateX(0deg); }
.hero-card-head {
  background: #f8fafc; border-bottom: 1px solid var(--border-soft);
  padding: 14px 18px; display: flex; align-items: center; gap: 8px;
}
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.r { background: #ef4444; }
.dot.y { background: #f59e0b; }
.dot.g { background: #10b981; }
.hero-card-title { font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-left: 8px; }
.hero-card-body { padding: 24px; }
.hero-in {
  background: var(--bg-soft); border-radius: var(--radius-sm);
  padding: 14px; font-size: 13px; color: var(--ink-soft); margin-bottom: 16px;
}
.hero-loader { display: flex; gap: 4px; margin: 16px 0; justify-content: center; }
.hero-loader span {
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand); opacity: .3;
  animation: pulse 1.2s ease infinite;
}
.hero-loader span:nth-child(2) { animation-delay: .2s; }
.hero-loader span:nth-child(3) { animation-delay: .4s; }
@keyframes pulse { 0%,100% { opacity: .2; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.1); } }
.hero-out {
  background: var(--brand-light);
  border: 1px dashed #fdba74;
  border-radius: var(--radius-sm);
  padding: 16px; font-size: 14px; line-height: 1.8;
  color: var(--ink-soft);
}

/* ================ SECTIONS ================ */
.section { padding: 96px 0; }
.section-light { background: var(--bg-soft); }
.section-head { text-align: center; max-width: 620px; margin: 0 auto 56px; }
.section-head .eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; color: var(--brand); text-transform: uppercase; margin-bottom: 12px; display: block; }
.section-head h2 { font-size: 42px; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; margin-bottom: 14px; }
.section-head p { color: var(--muted); font-size: 16px; }

/* ================ TOOL CARDS ================ */
.tool-card {
  display: block; text-decoration: none;
  background: #fff; border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); padding: 28px;
  transition: all .2s ease;
  position: relative; overflow: hidden;
}
.tool-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--brand), transparent);
  opacity: 0; transition: opacity .2s;
}
.tool-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: #fed7aa; }
.tool-card:hover::before { opacity: 1; }
.tool-card h3 { font-size: 18px; font-weight: 700; margin: 16px 0 8px; color: var(--ink); }
.tool-card p { color: var(--muted); font-size: 14px; line-height: 1.6; margin-bottom: 16px; }
.tool-card .tool-action { font-size: 13px; font-weight: 600; color: var(--brand); }
.tool-card.pro { background: linear-gradient(180deg, #fffaf2 0%, #fff 100%); border-color: #fed7aa; }
.pro-badge {
  position: absolute; top: 14px; right: 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 8px;
  letter-spacing: .05em;
}

.tool-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.tool-icon-lg { width: 64px; height: 64px; font-size: 28px; border-radius: 16px; }
.icon-orange { background: var(--brand-light); color: var(--brand-dark); }
.icon-blue { background: #dbeafe; color: #1d4ed8; }
.icon-purple { background: #ede9fe; color: #6d28d9; }
.icon-green { background: #dcfce7; color: #166534; }
.icon-pink { background: #fce7f3; color: #9d174d; }
.icon-yellow { background: #fef9c3; color: #854d0e; }
.icon-red { background: #fee2e2; color: #991b1b; }
.icon-indigo { background: #e0e7ff; color: #3730a3; }
.icon-gray { background: #f1f5f9; color: #334155; }

/* ================ STEP CARDS ================ */
.step-card {
  background: #fff; border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); padding: 32px;
  position: relative;
}
.step-num {
  font-size: 48px; font-weight: 800; color: var(--brand);
  letter-spacing: -.02em; line-height: 1;
  margin-bottom: 16px; opacity: .3;
}
.step-card h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.step-card p { color: var(--muted); font-size: 14px; line-height: 1.6; }

/* ================ PRICING ================ */
.pricing-grid { max-width: 1000px; margin: 0 auto; }
.price-card {
  background: #fff; border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); padding: 36px 28px;
  display: flex; flex-direction: column;
  position: relative;
}
.price-card h3 { font-size: 18px; font-weight: 700; color: var(--ink-soft); margin-bottom: 8px; }
.price { font-size: 48px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 6px; display: flex; align-items: flex-start; }
.price span { font-size: 22px; margin-top: 12px; margin-right: 4px; color: var(--muted); font-weight: 600; }
.price small { font-size: 14px; color: var(--muted); font-weight: 500; margin-left: 6px; margin-top: 22px; }
.price-card ul { list-style: none; margin: 20px 0; flex: 1; }
.price-card li { font-size: 14px; padding: 8px 0; color: var(--ink-soft); border-bottom: 1px solid var(--border-soft); }
.price-card li:last-child { border-bottom: none; }
.price-pop {
  border-color: var(--brand);
  box-shadow: 0 16px 48px -16px rgba(249,115,22,.3);
  transform: translateY(-8px);
  background: linear-gradient(180deg, #fffaf2 0%, #ffffff 40%);
}
.price-pop-tag {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--brand); color: #fff; padding: 6px 14px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
}

/* ================ CTA ================ */
.cta-section {
  padding: 64px 0;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
}
.cta-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 32px; flex-wrap: wrap;
}
.cta-inner h2 { font-size: 32px; color: #fff; font-weight: 800; margin-bottom: 8px; }
.cta-inner p { color: rgba(255,255,255,.85); font-size: 16px; max-width: 520px; }
.cta-inner .btn-primary {
  background: #fff; color: var(--brand-dark); box-shadow: none;
}
.cta-inner .btn-primary:hover { background: #fff7ed; transform: translateY(-2px); }

/* ================ FOOTER ================ */
.footer { background: #0f172a; color: #cbd5e1; padding: 64px 0 0; margin-top: 0; }
.footer-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr; gap: 32px; padding-bottom: 48px; }
.footer-grid .nav-brand { margin-bottom: 16px; }
.footer-grid .nav-brand .brand-en { color: #fff; }
.footer-desc { color: #94a3b8; font-size: 14px; line-height: 1.6; max-width: 280px; }
.footer h4 { color: #fff; font-size: 14px; font-weight: 700; margin-bottom: 16px; }
.footer ul { list-style: none; }
.footer li { margin-bottom: 10px; font-size: 14px; }
.footer a { color: #94a3b8; text-decoration: none; transition: color .15s; }
.footer a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid #1e293b; padding: 24px 0; margin-top: 0; }
.footer-bottom .container { display: flex; justify-content: space-between; font-size: 13px; color: #64748b; }

/* ================ TOOLS PAGE ================ */
.tool-hero {
  padding: 64px 0 24px;
  background: linear-gradient(180deg, #fffaf2 0%, #ffffff 100%);
  border-bottom: 1px solid var(--border-soft);
}
.tool-hero-inner { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.tool-hero h1 { font-size: 36px; font-weight: 800; margin-bottom: 8px; letter-spacing: -.01em; }
.tool-hero p { color: var(--muted); font-size: 15px; max-width: 500px; }
.tool-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: #fff;
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  cursor: pointer; transition: all .15s;
}
.pill:hover { border-color: var(--brand); color: var(--brand); }
.pill.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.pill.pro { border-color: var(--brand); color: var(--brand); }

.tool-workspace { padding: 40px 0 80px; background: var(--bg-soft); }
.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

.panel {
  background: #fff; border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-sm);
  min-height: 520px;
}
.panel-head {
  padding: 24px; border-bottom: 1px solid var(--border-soft);
  display: flex; gap: 16px; align-items: center;
}
.panel-head h2 { font-size: 20px; font-weight: 700; }
.panel-head p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.panel-body { padding: 24px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 8px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; font-family: inherit; color: var(--ink);
  background: #fff; transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(249,115,22,.1);
}
.field textarea { resize: vertical; min-height: 100px; line-height: 1.6; }
.field textarea.arabic { font-family: var(--font-ar); direction: rtl; font-size: 15px; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.output-box {
  min-height: 240px;
  background: var(--bg-soft);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px; font-size: 14px; line-height: 1.8;
  color: var(--ink-soft);
  overflow: auto;
}
.output-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 200px; text-align: center;
}
.output-empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .4; }
.output-box.arabic {
  font-family: var(--font-ar); direction: rtl; text-align: right;
  font-size: 16px; line-height: 2.1; color: var(--ink);
}

.output-box.loading { opacity: .7; }
.spinner-inline { display: inline-block; width: 14px; height: 14px; border: 2px solid #fff; border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

.usage-box {
  margin-top: 20px; padding: 16px;
  background: var(--brand-light); border-radius: 12px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 13px;
}
.usage-box strong { color: var(--ink); font-size: 14px; }

/* ================ AUTH PAGE ================ */
.auth-wrap {
  min-height: 100vh;
  background: linear-gradient(135deg, #fffaf2 0%, #fff 50%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 24px;
}
.auth-card {
  background: #fff; border-radius: var(--radius-lg);
  padding: 40px; width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg); border: 1px solid var(--border-soft);
}
.auth-card h1 { font-size: 24px; font-weight: 800; margin-bottom: 8px; }
.tabs { border-bottom: 1px solid var(--border-soft); padding-bottom: 0; }
.tab-btn {
  background: none; border: none; padding: 12px 4px;
  margin-right: 20px; font-size: 15px; font-weight: 600;
  color: var(--muted); cursor: pointer; position: relative;
}
.tab-btn.active { color: var(--ink); }
.tab-btn.active::after {
  content: ""; position: absolute; bottom: -1px; left: 0; right: 0;
  height: 2px; background: var(--brand); border-radius: 2px;
}

/* ================ RESPONSIVE ================ */
@media (max-width: 960px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .hero-title { font-size: 40px; }
  .hero-cta, .hero-stats { justify-content: center; flex-wrap: wrap; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .tool-grid { grid-template-columns: 1fr; }
  .cta-inner { flex-direction: column; text-align: center; }
  .price-pop { transform: none; }
}

@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-toggle { display: block; }
  .nav-links.active {
    display: flex; flex-direction: column; gap: 16px;
    position: absolute; top: 72px; left: 0; right: 0;
    background: #fff; padding: 24px;
    border-bottom: 1px solid var(--border-soft);
    box-shadow: var(--shadow);
  }
  .grid-3 { grid-template-columns: 1fr; }
  .hero-title { font-size: 32px; }
  .hero-stats { gap: 24px; }
  .hero-stats strong { font-size: 20px; }
  .section { padding: 64px 0; }
  .section-head h2 { font-size: 28px; }
  .footer-grid { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 22px; }
}

/* RTL overrides for pages with dir="rtl" */
html[dir="rtl"] body { font-family: var(--font-ar); }
html[dir="rtl"] .ar { direction: rtl; }
html[dir="rtl"] .hero-card { transform: perspective(1000px) rotateY(6deg) rotateX(4deg); }
