:root {
  --bg-dark: #0d111c;
  --bg-mid: #1a2133;
  --card: #121827;
  --yellow: #fbb91b;
  --text: #c9ced9;
}

body { font-family: 'Barlow', sans-serif; background: var(--bg-dark); color: var(--text); }
h1, h2, h3, h4, h5, h6, .brand { font-family: 'Oswald', sans-serif; color: #fff; }
.text-yellow, a.text-yellow { color: var(--yellow) !important; }

.topbar { background: var(--bg-mid); font-size: 14px; }
.topbar i { color: var(--yellow); margin-inline-end: 6px; }
.topbar a { color: inherit; text-decoration: none; }
.topbar a:hover { color: var(--yellow); }
.topbar-days { font-size: 12px; opacity: .7; }

.main-nav { background: var(--bg-dark); padding: 14px 0; }
.brand { font-size: 28px; font-weight: 700; letter-spacing: 1px; }
.brand i { color: var(--yellow); }
.main-nav .nav-link { color: #fff; font-weight: 500; margin: 0 6px; }
.main-nav .nav-link:hover { color: var(--yellow); }

.btn-garagak {
  background: var(--yellow); color: #111; font-weight: 600;
  text-transform: uppercase; border-radius: 0; padding: 10px 24px; border: none;
}
.btn-garagak:hover { background: #e5a600; color: #111; }
.btn-filter { background: var(--bg-mid); color: #fff; border-radius: 0; border: 1px solid transparent; }
.btn-filter:hover, .btn-filter.active { background: var(--yellow); color: #111; }

.hero {
  min-height: 560px; display: flex; align-items: center;
  position: relative; overflow: hidden; background: #0d111c;
}
.eyebrow { color: var(--yellow); text-transform: uppercase; letter-spacing: 1px; font-size: 14px; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 700; line-height: 1.15; }
.hero-icon { font-size: 14rem; color: var(--yellow); opacity: .9; }

/* ===== Hero background photo ===== */
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url('../img/hero.jpg') center 35% / cover no-repeat;
  transform: scaleX(-1);          /* نقلب الصورة عشان الميكانيكي يصير عكس النص */
  z-index: 0;
}
.hero::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(270deg, rgba(13,17,28,.96) 0%, rgba(13,17,28,.82) 45%, rgba(13,17,28,.3) 100%);
  z-index: 0;
}
.hero > .container { position: relative; z-index: 1; }

/* بالإنجليزي النص على الشمال، فبنعكس الاتجاه */
html[dir="ltr"] .hero::before { transform: none; }
html[dir="ltr"] .hero::after {
  background: linear-gradient(90deg, rgba(13,17,28,.96) 0%, rgba(13,17,28,.82) 45%, rgba(13,17,28,.3) 100%);
}

.features { margin-top: -70px; position: relative; z-index: 2; }
.feature-card { background: var(--bg-mid); padding: 28px; height: 100%; }
.feature-card.active { background: var(--yellow); color: #111; }
.feature-card.active h5 { color: #111; }

.section { padding: 80px 0; }
.section-alt { background: var(--bg-mid); }

.step { background: var(--bg-mid); padding: 28px; height: 100%; text-align: center; }
.step i { font-size: 2.5rem; color: var(--yellow); }
.section-alt .step { background: var(--card); }

.form-box { background: var(--bg-mid); padding: 28px; }
.form-box label { color: #fff; font-weight: 500; margin-bottom: 6px; display: block; }
.form-box .form-control { border-radius: 0; background: #fff; color: #111; margin-bottom: 16px; }

.result-box { background: var(--bg-mid); padding: 28px; }

.cat-card { background: var(--card); position: relative; height: 100%; transition: transform .2s; }
.cat-card:hover { transform: translateY(-6px); }
.cat-visual {
  height: 160px; display: grid; place-items: center;
  background: linear-gradient(135deg, #1a2133, #0d111c); color: var(--yellow); font-size: 4rem;
}
.history-img { width: 100%; height: 200px; object-fit: cover; }
.cat-card .icon-badge {
  position: absolute; top: 0; right: 0; background: var(--yellow); color: #111;
  width: 48px; height: 48px; display: grid; place-items: center; font-size: 22px; z-index: 1;
}
.cat-card .body { padding: 20px; color: var(--text); }
.cat-card .more { color: var(--yellow); text-transform: uppercase; font-size: 14px; }

.garage-card { background: var(--bg-mid); padding: 22px; height: 100%; border-left: 4px solid var(--yellow); }
.garage-card .tag {
  background: var(--yellow); color: #111; font-size: 12px; font-weight: 600;
  padding: 2px 8px; text-transform: uppercase;
}
.garage-card h5 { margin-top: 10px; }

.sev-low { background: #28a745; }
.sev-medium { background: #fd7e14; }
.sev-high { background: #dc3545; }

.footer { background: var(--bg-mid); font-size: 14px; }

/* Arabic / RTL */
html[lang="ar"] body,
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3,
html[lang="ar"] h4, html[lang="ar"] h5, html[lang="ar"] h6,
html[lang="ar"] .brand { font-family: 'Cairo', sans-serif; }

html[lang="ar"] .eyebrow,
html[lang="ar"] .brand,
html[lang="ar"] .btn-garagak,
html[lang="ar"] .cat-card .more,
html[lang="ar"] .auth-card .btn-warning { letter-spacing: 0; text-transform: none; }

html[dir="rtl"] .bi-arrow-right { display: inline-block; transform: scaleX(-1); }
html[dir="rtl"] .cat-card .icon-badge { right: auto; left: 0; }
html[dir="rtl"] .garage-card { border-left: none; border-right: 4px solid var(--yellow); }

/* صفحة الدخول والتسجيل: صورة الكراج */
.auth-stage {
  position: relative; min-height: 600px; display: flex; align-items: center; justify-content: center;
  padding: 60px 16px;
  background: linear-gradient(rgba(13,17,28,.82), rgba(13,17,28,.9)), url('../img/auth-bg.jpg') center/cover no-repeat;
}
.auth-card {
  position: relative; width: 100%; max-width: 440px; margin-bottom: 0; padding: 36px 40px;
  background: rgba(18,24,39,.94); border: 1px solid rgba(255,255,255,.1); border-top: 4px solid var(--yellow);
  border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.5); color: var(--text);
}
.auth-card h2 { color: #fff; margin-bottom: 24px; }
.auth-card .form-label { color: var(--text); }
.auth-card .form-control { background: var(--bg-mid); border-color: rgba(255,255,255,.12); color: #fff; }
.auth-card .btn-warning { background: var(--yellow); border-color: var(--yellow); color: #0d111c; font-weight: 700; text-transform: uppercase; }
.auth-card a { color: var(--yellow); }

/* صفحة التشخيص */
.dx-page { background: radial-gradient(circle at 85% 10%, rgba(251,185,27,.12), transparent 40%), var(--bg-dark); }
.dx-title { font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 700; line-height: 1.15; margin-bottom: 10px; }
.dx-tagline { color: var(--yellow); font-weight: 500; margin-bottom: 14px; }
html[lang="ar"] .dx-title { line-height: 1.4; }
.dx-sub { font-size: 1.1rem; max-width: 760px; line-height: 1.8; }
.dx-chips { display: flex; flex-wrap: wrap; gap: 12px; }
.dx-chip { border: 1px solid rgba(255,255,255,.15); padding: 8px 16px; border-radius: 30px; font-size: 14px; color: #fff; }
.dx-chip b { color: var(--yellow); }
.dx-box { background: var(--card); border: 1px solid rgba(255,255,255,.08); border-top: 4px solid var(--yellow); border-radius: 10px; padding: 30px; }
.dx-box h4 { color: #fff; margin-bottom: 4px; }
.dx-hint { font-size: 13px; opacity: .8; margin-bottom: 12px; }
.dx-label { color: #fff; margin-bottom: 6px; display: block; }
.dx-box .form-control { background: var(--bg-mid); border-color: rgba(255,255,255,.12); color: #fff; border-radius: 8px; }
.dx-box .form-control:focus { background: var(--bg-mid); color: #fff; border-color: var(--yellow); box-shadow: 0 0 0 .2rem rgba(251,185,27,.2); }
.dx-box textarea.form-control { height: 190px; resize: none; }
.dx-box input[type="file"] { display: none; }
.dx-drop { height: 190px; border: 2px dashed rgba(251,185,27,.5); border-radius: 8px; background: rgba(251,185,27,.04); display: flex; align-items: center; justify-content: center; text-align: center; cursor: pointer; overflow: hidden; color: #fff; }
.dx-drop:hover, .dx-drop.drag { background: rgba(251,185,27,.1); }
.dx-drop i { display: block; font-size: 2.4rem; color: var(--yellow); }
.dx-drop img { width: 100%; height: 100%; object-fit: cover; }
html[lang="ar"] .dx-box .btn-garagak { letter-spacing: 0; text-transform: none; }

/* زر المايك */
.dx-textwrap { position: relative; }
.dx-textwrap textarea.form-control { padding-bottom: 56px; }
.dx-mic {
  position: absolute; bottom: 12px; inset-inline-end: 12px;
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: var(--yellow); color: #111; font-size: 20px;
  display: grid; place-items: center; cursor: pointer; transition: transform .15s;
}
.dx-mic:hover { transform: scale(1.08); }
.dx-mic.rec { background: #dc3545; color: #fff; animation: micPulse 1.2s infinite; }
@keyframes micPulse {
  0% { box-shadow: 0 0 0 0 rgba(220,53,69,.6); }
  100% { box-shadow: 0 0 0 16px rgba(220,53,69,0); }
}
.dx-mic-status { color: var(--yellow); min-height: 20px; }
#dxProblem, #dxSolution { white-space: pre-line; line-height: 1.9; }

/* ===== Garages page filters ===== */
.g-filters { display: flex; flex-wrap: wrap; gap: .5rem; }
.g-filter {
  background: transparent; color: var(--text);
  border: 1px solid rgba(255, 255, 255, .2);
  padding: .45rem 1.1rem; border-radius: 50px;
  font-family: inherit; transition: .2s;
}
.g-filter:hover { border-color: var(--yellow); color: #fff; }
.g-filter.active {
  background: var(--yellow); border-color: var(--yellow);
  color: #0d111c; font-weight: 700;
}
.g-note { color: #9aa3b5; }

/* ===== Category flags ===== */
.cat-flag {
  font-size: 5rem;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .55);
  border: 2px solid rgba(255, 255, 255, .15);
  transition: transform .25s;
}
.cat-card:hover .cat-flag { transform: scale(1.08); }

/* ===== How it works: steps ===== */
.step {
  position: relative; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .06);
  border-top: 3px solid transparent;
  border-radius: 10px; padding: 34px 28px;
  transition: transform .3s, box-shadow .3s, border-color .3s;
}
.step:hover {
  transform: translateY(-8px);
  border-top-color: var(--yellow);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45), 0 0 0 1px rgba(251, 185, 27, .25);
}

/* الأيقونة بدائرة */
.step i {
  display: grid; place-items: center;
  width: 76px; height: 76px; margin: 0 auto 16px;
  border-radius: 50%; font-size: 2rem;
  background: rgba(251, 185, 27, .12);
  border: 2px solid rgba(251, 185, 27, .35);
  transition: background .3s, color .3s, transform .3s;
}
.step:hover i {
  background: var(--yellow); color: #111;
  transform: scale(1.08) rotate(-6deg);
}

/* الرقم الكبير الباهت */
.step::before {
  position: absolute; top: 4px; inset-inline-end: 16px;
  font-family: 'Oswald', sans-serif; font-size: 3.6rem; font-weight: 700;
  color: rgba(255, 255, 255, .05); line-height: 1;
}
.row > :nth-child(1) > .step::before { content: '01'; }
.row > :nth-child(2) > .step::before { content: '02'; }
.row > :nth-child(3) > .step::before { content: '03'; }

/* ظهور تدريجي أثناء النزول بالصفحة (كروم وإيدج) */
@supports (animation-timeline: view()) {
  .step {
    animation: stepIn linear backwards;
    animation-timeline: view();
    animation-range: entry 0% entry 55%;
  }
  @keyframes stepIn {
    from { opacity: 0; transform: translateY(40px); }
    to   { opacity: 1; transform: none; }
  }
}

/* ===== Logo ===== */
.brand-logo { height: 48px; width: auto; transition: transform .25s; }
.brand:hover .brand-logo { transform: rotate(-8deg) scale(1.08); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-size: 26px; font-weight: 700; color: #fff; }
.brand-tag { font-size: 11px; font-weight: 500; color: var(--yellow); letter-spacing: .5px; }
html[lang="ar"] .brand-tag { letter-spacing: 0; font-size: 12px; }

/* ===== History page ===== */
.hist-card {
  background: var(--card); border: 1px solid rgba(255,255,255,.08);
  border-inline-start: 4px solid var(--yellow); border-radius: 10px; padding: 22px;
}
.hist-date { color: #9aa3b5; margin-inline-end: 10px; }
.hist-chip {
  font-size: 12px; border: 1px solid rgba(255,255,255,.2);
  border-radius: 20px; padding: 2px 10px; color: var(--text);
}
.hist-desc { color: var(--text); }
.hist-text { white-space: pre-line; line-height: 1.9; }
.hist-card h6 { color: var(--yellow); }

/* ===== About page ===== */
.about-card {
  background: var(--card); border: 1px solid rgba(255,255,255,.08);
  border-top: 4px solid var(--yellow); border-radius: 10px; padding: 26px; height: 100%;
}
.about-card i { font-size: 2rem; color: var(--yellow); }
.about-card h5 { margin: 12px 0 8px; }
.about-card p { line-height: 1.9; }

/* روابط نتيجة قطع الغيار */
#ptResult a:not(.btn) {
  color: var(--yellow);
  text-decoration: underline;
  text-underline-offset: 3px;
}
#ptResult a:not(.btn):hover {
  color: #fff;
}
.form-control::placeholder {
  color: #8a93a6;
  opacity: 1;
}
/* حقول صفحة قطع الغيار: نفس مظهر صفحة التشخيص */
#ptForm .form-control {
  background: var(--bg-mid);
  border: 1px solid #2a3350;
  color: #fff;
}
#ptForm .form-control:focus {
  background: var(--bg-mid);
  border-color: var(--yellow);
  box-shadow: 0 0 0 .2rem rgba(251, 185, 27, .2);
  color: #fff;
}
.form-control::placeholder {
  color: #8a93a6;
  opacity: 1;
}
#ptSources a {
  unicode-bidi: isolate;
}