/* ══════════════════════════════════════════════════
   Matspen Design System
   Brand: #63D7FB · #5480F1 · #520CF4 · #000
   Chillax Bold/Semibold → Latin titles
   Chillax Medium        → Latin body text
   Heebo                 → Hebrew text (fallback for all)
   ══════════════════════════════════════════════════ */

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

:root {
  --cyan:   #63D7FB;
  --blue:   #5480F1;
  --violet: #520CF4;
  --black:  #000000;

  --grad:       linear-gradient(135deg, var(--violet), var(--blue), var(--cyan));
  --grad-btn:   linear-gradient(135deg, var(--violet) 0%, var(--blue) 55%, var(--cyan) 100%);
  --grad-user:  linear-gradient(135deg, var(--violet) 0%, var(--blue) 100%);

  --bg:        #07070F;
  --surface-1: #0D0D1C;
  --surface-2: #121226;
  --surface-3: #18182E;

  --text:       #EEEEFD;
  --text-dim:   #9898BB;
  --text-muted: #55558A;

  --border:        rgba(99, 215, 251, .10);
  --border-hover:  rgba(84, 128, 241, .40);
  --border-active: rgba(99, 215, 251, .35);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow:    0 0 40px rgba(82, 12, 244, .18);
  --glow:      0 0 24px rgba(99, 215, 251, .12);
  --header-h:  58px;

  /* Chillax for Latin, Heebo for Hebrew */
  --font-latin:  'Chillax', 'Segoe UI', Arial, sans-serif;
  --font-hebrew: 'Heebo', 'Arial Hebrew', Arial, sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Hebrew pages use Heebo; English pages use Chillax */
[lang="he"], [lang="he"] * { font-family: var(--font-hebrew); }
[lang="en"], [lang="en"] * { font-family: var(--font-latin); }

/* ══════════════════════════════════
   LANGUAGE PICKER / INTRO SCREEN
   ══════════════════════════════════ */
#lang-picker {
  position: fixed;
  inset: 0;
  background: var(--black);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  overflow-y: auto;
  padding: 24px 16px;
  transition: opacity .4s ease;
}

#lang-picker.fade-out {
  opacity: 0;
  pointer-events: none;
}

.lang-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 44px 40px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow), var(--glow);
  max-width: 480px;
  width: 100%;
}

.lang-logo {
  width: 220px;
  height: auto;
  object-fit: contain;
}

/* Intro copy — always uses Chillax regardless of page lang */
.lang-intro {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.lang-intro-en {
  font-family: var(--font-latin);
  font-weight: 500;   /* Chillax Medium */
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.7;
  text-align: left;
  direction: ltr;
}

.lang-intro-he {
  font-family: var(--font-hebrew);
  font-weight: 500;
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.7;
  text-align: right;
  direction: rtl;
}

.lang-prompt {
  font-family: var(--font-latin);
  font-weight: 700;   /* Chillax Bold */
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  text-align: center;
}

.lang-options {
  display: flex;
  gap: 14px;
  width: 100%;
}

.lang-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: background .18s, border-color .18s, transform .15s, box-shadow .18s;
}

.lang-btn:hover {
  background: var(--surface-3);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--glow);
}

.lang-btn:active { transform: translateY(0); }

.lang-flag  { font-size: 26px; }
.lang-label {
  font-family: var(--font-latin);
  font-weight: 700;   /* Chillax Bold */
  font-size: 15px;
}

/* ══════════════════════════════════
   APP SHELL
   ══════════════════════════════════ */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 780px;
  margin: 0 auto;
}

#app.hidden { display: none; }

/* ── Header ── */
#header {
  background: var(--bg);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 24px;
}

.header-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
  opacity: .9;
}

.miluimtech-link {
  display: flex;
  align-items: center;
  opacity: .55;
  transition: opacity .2s;
  text-decoration: none;
}

.miluimtech-link:hover { opacity: .85; }

.miluimtech-logo {
  height: 54px;
  width: auto;
  object-fit: contain;
}

/* ── Progress Bar ── */
#progress-bar {
  height: 3px;
  background: var(--surface-3);
  overflow: hidden;
}

#progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--violet), var(--blue), var(--cyan));
  transition: width 0.5s ease;
}

/* ── Step View ── */
#step-view {
  flex: 1;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

#step-view.hidden { display: none; }

#step-view::-webkit-scrollbar { width: 4px; }
#step-view::-webkit-scrollbar-track { background: transparent; }
#step-view::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }

.step-card {
  max-width: 560px;
  width: 100%;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: var(--shadow);
  transition: background .2s, border-color .2s, box-shadow .2s;
}

.step-card.loading {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

#step-question {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.step-error {
  font-size: 13px;
  color: #F15454;
}

.step-error.hidden { display: none; }

/* ── Widget Zone (inside .step-card) ── */
#widget-zone { }
#widget-zone:empty { display: none; }

/* ── Text Input Zone (inside .step-card) ── */
.input-row { display: flex; gap: 10px; align-items: flex-end; }

#user-input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  resize: none;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  direction: inherit;
}

#user-input::placeholder { color: var(--text-muted); }

#user-input:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px rgba(99, 215, 251, .07);
}

#send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--grad-btn);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity .15s, transform .1s;
  box-shadow: 0 2px 14px rgba(82, 12, 244, .45);
}

#send-btn:hover  { opacity: .88; }
#send-btn:active { transform: scale(.94); }
#send-btn:disabled {
  background: var(--surface-3);
  box-shadow: none;
  color: var(--text-muted);
  cursor: not-allowed;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid rgba(84, 128, 241, 0.3);
  border-radius: 8px;
  color: var(--blue);
  opacity: 0.65;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, opacity .15s, border-color .15s;
  margin-bottom: 8px;
}
.back-btn:hover {
  background: linear-gradient(135deg, rgba(82,12,244,.07), rgba(84,128,241,.1), rgba(99,215,251,.07));
  border-color: rgba(84, 128, 241, 0.55);
  opacity: 1;
}

.input-meta { display: flex; justify-content: flex-end; margin-top: 5px; }
.char-counter      { font-size: 11px; color: var(--text-muted); }
.char-counter.warn { color: #F1A054; }
.char-counter.over { color: #F15454; font-weight: 600; }

/* ── RTL ↔ LTR ── */
[dir="ltr"] .header-inner { flex-direction: row; }
[dir="ltr"] #user-input   { direction: ltr; }
/* ══════════════════════════════════
   MATCHES DISPLAY
   ══════════════════════════════════ */
#matches-container {
  flex: 1;
  padding: 40px 20px;
  background: var(--bg);
  overflow-y: auto;
}

#matches-container.hidden {
  display: none;
}

#matches-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.mentor-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all 0.3s ease;
}

.mentor-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
  transform: translateY(-4px);
}

.mentor-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.mentor-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.mentor-role {
  font-size: 14px;
  color: var(--cyan);
  margin-top: 4px;
  font-weight: 500;
}

.mentor-company {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 2px;
}

.mentor-bio {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
}

.mentor-location {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.mentor-links {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.mentor-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--cyan);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}

.mentor-link:hover {
  background: var(--surface-3);
  border-color: var(--border-hover);
  color: var(--text);
}

.request-button {
  background: var(--grad-btn);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  margin-top: 8px;
}

.request-button:hover {
  opacity: 0.9;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(82, 12, 244, .25);
}

.request-button:active {
  transform: translateY(0);
}

.request-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}