/* ===== LangExchange — страница профиля ===== */

:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eff6ff;
  --green: #10b981;
  --green-soft: #ecfdf5;
  --ink: #111827;
  --muted: #4b5563;
  --line: #e5e7eb;
  --soft: #f9fafb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--soft);
  color: var(--ink);
}

.page { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- Шапка ---------- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
  padding: 0 80px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: inherit; }
.brand-mark {
  width: 32px; height: 32px;
  background: var(--blue);
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 16px;
}
.brand-name { font-size: 20px; font-weight: 700; white-space: nowrap; }

.nav { display: flex; align-items: center; gap: 32px; height: 76px; }
.nav-link {
  display: inline-flex; align-items: center;
  height: 76px;
  font-size: 16px; font-weight: 500;
  color: var(--muted); text-decoration: none;
  border-bottom: 2px solid transparent;
  box-sizing: border-box;
}
.nav-link:hover { color: var(--blue); }

.header-actions { display: flex; align-items: center; gap: 12px; }
.profile-link {
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
}
.profile-link:hover { color: var(--blue); }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 18px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-secondary:hover { background: var(--soft); border-color: #cbd5e1; }
.btn-sm { padding: 8px 14px; font-size: 13px; }

/* ---------- Контент ---------- */
.content { flex: 1; display: flex; justify-content: center; }
.inner {
  width: 100%;
  max-width: 720px;
  padding: 48px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ---------- Карточка профиля ---------- */
.profile-card {
  padding: 32px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,.04);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 20px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  flex-shrink: 0;
  text-transform: uppercase;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.profile-name {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
  word-wrap: break-word;
}
.profile-email {
  font-size: 15px;
  color: var(--muted);
  word-wrap: break-word;
}

.profile-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
}
.badge-level {
  background: var(--blue-soft);
  color: var(--blue);
}
.badge-admin {
  background: var(--green-soft);
  color: var(--green);
}

.divider {
  height: 1px;
  background: var(--line);
}

/* ---------- Строки с данными ---------- */
.info-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  align-items: start;
}
.info-label {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}
.info-value {
  font-size: 15px;
  color: var(--ink);
  word-wrap: break-word;
}
.info-value.is-empty {
  color: var(--muted);
  font-style: italic;
}

/* ---------- Действия ---------- */
.profile-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 22px;
  background: var(--blue);
  color: #fff;
  border: 0;
  border-radius: 10px;
  font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: background .15s;
}
.btn-primary:hover { background: var(--blue-dark); }

/* ---------- Состояния ---------- */
.state-box {
  padding: 48px;
  text-align: center;
  font-size: 15px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
}

/* ---------- Уведомление ---------- */
.lx-toast {
  position: fixed;
  left: 50%; bottom: 32px;
  transform: translate(-50%, 20px);
  background: var(--ink); color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 600; font-size: 14px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 9999;
}
.lx-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.lx-toast.is-success { background: var(--green); }

/* ============================================================
   МОБИЛЬНАЯ АДАПТАЦИЯ — profile
   ============================================================ */

@media (max-width: 900px) {

  /* Шапка — в 2 строки */
  .header {
    display: flex !important;
    flex-wrap: wrap !important;
    height: auto !important;
    padding: 10px 16px 0 16px !important;
    gap: 0 !important;
    align-items: center !important;
  }

  .brand { order: 1; flex: 1 1 auto; min-width: 0; }
  .brand-mark { width: 28px !important; height: 28px !important; font-size: 14px !important; }
  .brand-name { font-size: 17px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .header-actions { order: 2; flex: 0 0 auto; gap: 0 !important; }
  .profile-link { display: none !important; }
  .header-actions .btn-secondary {
    padding: 8px 14px !important;
    font-size: 13px !important;
    height: 36px !important;
    white-space: nowrap;
  }

  .nav {
    order: 3;
    display: flex !important;
    flex-basis: 100%;
    width: 100%;
    height: 44px !important;
    gap: 6px;
    margin: 10px -16px 0 -16px !important;
    padding: 8px 32px 8px 16px !important;
    overflow-x: auto;
    overflow-y: hidden;
    border-top: 1px solid var(--line);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    align-items: center;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-link {
    flex: 0 0 auto !important;
    display: inline-flex;
    align-items: center;
    height: 32px !important;
    padding: 0 14px !important;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
    border-bottom: 0 !important;
    border-radius: 100px;
    white-space: nowrap;
  }

  /* Контент */
  .inner {
    padding: 24px 12px 56px !important;
    gap: 20px !important;
  }
  .profile-card {
    padding: 22px 18px !important;
    border-radius: 14px !important;
    gap: 20px !important;
  }

  .profile-head {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
  }
  .profile-avatar {
    width: 72px;
    height: 72px;
    font-size: 26px;
  }
  .profile-info { align-items: center; }
  .profile-name { font-size: 22px; }
  .profile-email { font-size: 14px; }
  .profile-badges { justify-content: center; }

  .info-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .info-label {
    font-size: 13px;
    color: var(--muted);
  }
  .info-value { font-size: 15px; }

  .profile-actions {
    flex-direction: column;
    gap: 10px;
  }
  .profile-actions .btn-primary,
  .profile-actions .btn-secondary {
    width: 100%;
    height: 46px;
  }
}

/* ============================================================
   ПОСЛЕДНИЕ РЕЗУЛЬТАТЫ ТЕСТОВ
   ============================================================ */

.results-block {
  padding: 24px 28px;
  background: #fff;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,.04);
}

.results-title {
  margin: 0 0 16px;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink, #111827);
}

.results-empty {
  padding: 24px 0;
  font-size: 14px;
  color: var(--muted, #4b5563);
  text-align: center;
}
.results-empty a {
  color: var(--blue, #2563eb);
  font-weight: 600;
  text-decoration: none;
}
.results-empty a:hover { text-decoration: underline; }

.results-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--soft, #f9fafb);
  text-decoration: none;
  color: inherit;
  border-left: 3px solid var(--line, #e5e7eb);
  transition: background .15s, transform .15s, border-color .15s;
}
.result-row:hover {
  background: #f1f5f9;
  transform: translateX(2px);
}

.result-row.is-good { border-left-color: #10b981; }
.result-row.is-mid  { border-left-color: #f59e0b; }
.result-row.is-bad  { border-left-color: #ef4444; }

.result-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.result-level {
  display: inline-flex;
  padding: 3px 8px;
  background: #eff6ff;
  color: #2563eb;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.result-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-score {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.result-num {
  font-size: 13px;
  font-weight: 600;
  color: #4b5563;
}

.result-percent {
  font-size: 15px;
  font-weight: 800;
  color: #111827;
}
.result-row.is-good .result-percent { color: #10b981; }
.result-row.is-mid  .result-percent { color: #f59e0b; }
.result-row.is-bad  .result-percent { color: #ef4444; }

.result-date {
  font-size: 12px;
  color: #4b5563;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .results-block { padding: 20px 18px; border-radius: 14px; }
  .results-title { font-size: 16px; margin-bottom: 14px; }

  .result-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
  }
  .result-main { width: 100%; }
  .result-title { font-size: 14px; }

  .result-score {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 8px;
  }
  .result-num { font-size: 12px; }
  .result-percent { font-size: 16px; }
  .result-date { font-size: 12px; }
}
