:root {
  --primary: #e8823a;
  --primary-dark: #c46a26;
  --primary-light: #fef3eb;
  --bg: #fafaf7;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --text-faded: #9ca3af;
  --border: #e5e7eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.1);
}

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

html, body { height: 100%; }

body {
  font-family: 'Tajawal', 'Segoe UI', Tahoma, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Navigation */
.nav {
  padding: 20px 0;
  border-bottom: 1px solid transparent;
  position: sticky;
  top: 0;
  background: rgba(250, 250, 247, 0.85);
  backdrop-filter: blur(12px);
  z-index: 50;
}

.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.logo-mark {
  width: 36px; height: 36px;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900;
  font-size: 20px;
}

.nav-links { display: flex; gap: 28px; align-items: center; font-size: 15px; color: var(--text-muted); }
.nav-links a:hover { color: var(--text); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface); border-color: var(--text-muted); }
.btn-lg { padding: 16px 32px; font-size: 17px; border-radius: 12px; }

/* Hero */
.hero {
  padding: 80px 0 60px;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  padding: 6px 14px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 24px;
}

.hero h1 {
  font-size: clamp(36px, 6vw, 64px);
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-weight: 800;
  margin-bottom: 24px;
}
.hero h1 span { color: var(--primary); }

.hero p {
  font-size: 19px;
  color: var(--text-muted);
  max-width: 620px;
  margin: 0 auto 40px;
  line-height: 1.6;
}

.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Feature cards */
.features {
  padding: 60px 0;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  transition: all 0.2s ease;
}
.feature:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.feature-icon {
  width: 48px; height: 48px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin-bottom: 18px;
  font-weight: 700;
}

.feature h3 {
  font-size: 20px;
  margin-bottom: 10px;
  font-weight: 700;
}

.feature p {
  font-size: 15px;
  color: var(--text-muted);
}

/* Comparison section */
.comparison {
  padding: 80px 0;
}
.section-title {
  text-align: center;
  margin-bottom: 48px;
}
.section-title h2 {
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -0.02em;
  font-weight: 800;
  margin-bottom: 12px;
}
.section-title p { color: var(--text-muted); font-size: 17px; }

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.compare-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}
.compare-card.good {
  border: 2px solid var(--primary);
  background: var(--primary-light);
}
.compare-card h3 {
  font-size: 18px;
  margin-bottom: 20px;
  font-weight: 700;
}
.compare-list { list-style: none; }
.compare-list li {
  padding: 10px 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 15px;
}
.compare-list li:last-child { border: none; }
.compare-card.bad .compare-list li::before { content: "✕"; color: var(--danger); font-weight: 700; }
.compare-card.good .compare-list li::before { content: "✓"; color: var(--primary-dark); font-weight: 700; }

/* Upload page */
.upload-container {
  max-width: 540px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.upload-header {
  text-align: center;
  margin-bottom: 40px;
}
.upload-header h1 {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.upload-header p { color: var(--text-muted); font-size: 16px; }

.upload-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.form-field { margin-bottom: 20px; }
.form-field label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text);
}
.form-field input[type="text"],
.form-field input[type="email"] {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.15s;
}
.form-field input:focus {
  outline: none;
  border-color: var(--primary);
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  background: #fafaf7;
}
.dropzone:hover { border-color: var(--primary); background: var(--primary-light); }
.dropzone.dragging { border-color: var(--primary); background: var(--primary-light); }
.dropzone-icon { font-size: 36px; margin-bottom: 8px; opacity: 0.5; }
.dropzone-text { font-weight: 600; font-size: 15px; }
.dropzone-hint { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.dropzone.has-file { border-color: var(--success); background: #ecfdf5; }
.dropzone.has-file .dropzone-icon { opacity: 1; }

.error-msg {
  background: #fef2f2;
  color: var(--danger);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  margin-top: 16px;
  display: none;
}
.error-msg.show { display: block; }

.btn-submit { width: 100%; margin-top: 8px; padding: 16px; font-size: 16px; }
.btn-submit:disabled { opacity: 0.6; cursor: wait; }

.loading-dots::after {
  content: '...';
  animation: dots 1.4s infinite;
}
@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* Profile page */
.profile-container { padding: 40px 0 80px; }

.profile-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 24px;
  display: flex;
  gap: 24px;
  align-items: center;
}
.profile-avatar {
  width: 80px; height: 80px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  font-weight: 800;
  flex-shrink: 0;
}
.profile-info h2 { font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.profile-info .title { color: var(--primary); font-weight: 600; margin-bottom: 8px; }
.profile-info .summary { color: var(--text-muted); font-size: 15px; }

.profile-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
.meta-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.meta-label { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.meta-value { font-size: 22px; font-weight: 800; margin-top: 6px; }

.skills-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 32px;
}
.skills-card h3 { font-size: 18px; margin-bottom: 16px; font-weight: 700; }
.skill-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-tag {
  padding: 6px 14px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
}

.matches-section h3 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.matches-section .sub {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 15px;
}

.job-grid { display: grid; gap: 16px; }

.job-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all 0.15s;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
}
.job-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-1px); }

.job-logo {
  width: 52px; height: 52px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 22px;
}

.job-body h4 { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.job-meta { color: var(--text-muted); font-size: 14px; margin-bottom: 10px; }
.job-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.job-tag {
  padding: 3px 10px;
  background: #f3f4f6;
  border-radius: 100px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.job-tag.matched { background: #dcfce7; color: #166534; }

.job-score {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 140px;
}
.score-ring {
  width: 72px; height: 72px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 20px;
  margin: 0 auto;
}
.score-high { background: #dcfce7; color: #166534; }
.score-mid { background: #fef3c7; color: #854d0e; }
.score-low { background: #fee2e2; color: #991b1b; }
.score-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }

.transparency {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.transparency .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
}
.transparency .dot.warning { background: var(--warning); }
.transparency .dot.danger { background: var(--danger); }

.salary {
  font-weight: 700;
  color: var(--primary-dark);
  margin-top: 6px;
}

.footer {
  padding: 40px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  border-top: 1px solid var(--border);
  margin-top: 80px;
}

@media (max-width: 820px) {
  .features-grid, .compare-grid { grid-template-columns: 1fr; }
  .profile-header { flex-direction: column; text-align: center; }
  .profile-meta { grid-template-columns: repeat(2, 1fr); }
  .job-card { grid-template-columns: 1fr; }
  .job-score { flex-direction: row; justify-content: center; min-width: 0; }
  .hero { padding: 60px 0 40px; }
  .nav-links { display: none; }
}

.spinner-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  gap: 16px;
}
.spinner {
  width: 48px; height: 48px;
  border: 4px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
