/* ─── Auth pages (login / signup) ─────────────────────────────────────────── */

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

body.auth-page {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  min-height: 100vh;
  background: linear-gradient(135deg, #0d1117 0%, #161b22 45%, #1a1040 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* ---- Language switcher ---- */
.lang-switcher {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}
.auth-lang-wrap {
  display: flex;
  justify-content: center;
  margin-top: 18px;
  position: relative;
  z-index: 5;
}
.lang-switcher .lang-switcher-btn.btn,
.lang-switcher .lang-switcher-btn {
  min-width: 142px;
  height: 38px;
  border: 1px solid #dbe3ef;
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  color: #334155;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: .84rem;
  font-weight: 700;
  padding: 0 11px;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
  backdrop-filter: blur(10px);
  line-height: 1;
}
.lang-switcher .lang-switcher-btn:hover,
.lang-switcher .lang-switcher-btn:focus,
.lang-switcher.lang-open .lang-switcher-btn {
  border-color: #b9c7da;
  background: #f8fafc;
  color: #0f172a;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .12);
}
.lang-switcher-btn .bi { font-size: .7rem; opacity: .8; color: #64748b; }
.lang-switcher-btn * { pointer-events: none; }
[data-lang-current] {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.lang-flag {
  display: inline-block;
  width: 22px;
  height: 15px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(15,23,42,.16);
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}
.flag-us { background: repeating-linear-gradient(to bottom,#b91c1c 0 1.15px,#fff 1.15px 2.3px); }
.flag-us::before { content: ''; position: absolute; inset: 0 auto auto 0; width: 9px; height: 8px; background: #1d4ed8; }
.flag-es { background: linear-gradient(to bottom,#c1121f 0 25%,#facc15 25% 75%,#c1121f 75%); }
.flag-fr { background: linear-gradient(to right,#1d4ed8 0 33.33%,#fff 33.33% 66.66%,#dc2626 66.66%); }
.flag-cn { background: #dc2626; }
.flag-cn::before { content: ''; position: absolute; left: 4px; top: 3px; width: 5px; height: 5px; background: #facc15; clip-path: polygon(50% 0,61% 35%,98% 35%,68% 56%,79% 91%,50% 70%,21% 91%,32% 56%,2% 35%,39% 35%); }
.lang-label {
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lang-menu {
  top: calc(100% + 10px) !important;
  min-width: 172px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .18);
  z-index: 3000;
  margin-top: 0;
}
.lang-switcher.lang-open .lang-menu { display: block; }
.lang-menu .dropdown-item {
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: .86rem;
  font-weight: 600;
  color: #334155;
}
.lang-menu .dropdown-item.active,
.lang-menu .dropdown-item:active {
  background: #eef2ff;
  color: #4f46e5;
}

/* ─── Card ─────────────────────────────────────────────────────────────────── */

.auth-card {
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 32px 80px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.06);
  overflow: visible;
  width: 100%;
  max-width: 920px;
  display: flex;
  min-height: 580px;
}

/* ─── Left brand panel ─────────────────────────────────────────────────────── */

.auth-left {
  flex: 0 0 42%;
  background: linear-gradient(155deg, #4338ca 0%, #7c3aed 55%, #a21caf 100%);
  padding: 52px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.auth-left::before {
  content: '';
  position: absolute;
  top: -90px; right: -90px;
  width: 320px; height: 320px;
  background: rgba(255,255,255,.07);
  border-radius: 50%;
}
.auth-left::after {
  content: '';
  position: absolute;
  bottom: -70px; left: -70px;
  width: 260px; height: 260px;
  background: rgba(255,255,255,.05);
  border-radius: 50%;
}

.auth-logo {
  width: 58px; height: 58px;
  background: rgba(255,255,255,.18);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  margin-bottom: 28px;
  border: 1px solid rgba(255,255,255,.25);
  backdrop-filter: blur(8px);
  position: relative;
}

.auth-brand-title {
  font-size: 25px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 10px;
}

.auth-brand-sub {
  font-size: 14px;
  opacity: .75;
  line-height: 1.65;
  margin-bottom: 36px;
}

.auth-features { display: flex; flex-direction: column; gap: 14px; position: relative; }

.auth-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  opacity: .9;
}

.auth-feature-icon {
  width: 34px; height: 34px;
  background: rgba(255,255,255,.15);
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

/* ─── Right form panel ─────────────────────────────────────────────────────── */

.auth-right {
  flex: 1;
  padding: 52px 52px 52px 50px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-title {
  font-size: 27px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 30px;
}

/* ─── Form controls ─────────────────────────────────────────────────────────── */

.auth-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 7px;
  letter-spacing: .025em;
}

.input-wrap { position: relative; }

.input-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 16px;
  pointer-events: none;
}

.auth-input {
  width: 100%;
  padding: 12px 44px 12px 42px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 15px;
  color: #0f172a;
  background: #f8fafc;
  transition: border-color .2s, box-shadow .2s, background .2s;
  outline: none;
}
.auth-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
  background: #fff;
}
.auth-input::placeholder { color: #c8d3e0; }
.auth-input.is-invalid { border-color: #ef4444; }

.btn-eye {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  color: #94a3b8; cursor: pointer;
  padding: 4px; font-size: 16px;
  line-height: 1;
  transition: color .15s;
}
.btn-eye:hover { color: #6366f1; }

/* Two-column grid */
.auth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ─── Password strength ──────────────────────────────────────────────────────── */

.strength-wrap { margin-top: 8px; }
.strength-bar {
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  overflow: hidden;
}
.strength-fill {
  height: 100%;
  border-radius: 2px;
  width: 0%;
  transition: width .3s, background .3s;
}
.strength-label {
  font-size: 11px;
  font-weight: 500;
  margin-top: 4px;
  min-height: 16px;
}

/* ─── Checkbox ───────────────────────────────────────────────────────────────── */

.auth-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #64748b;
  cursor: pointer;
  user-select: none;
}
.auth-check input[type=checkbox] {
  width: 16px; height: 16px;
  accent-color: #6366f1;
  cursor: pointer;
}

/* ─── Submit button ──────────────────────────────────────────────────────────── */

.btn-auth {
  width: 100%;
  padding: 13px 24px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .1s, box-shadow .2s, opacity .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 22px;
}
.btn-auth:hover { transform: translateY(-1px); box-shadow: 0 8px 26px rgba(79,70,229,.35); }
.btn-auth:active { transform: translateY(0); }
.btn-auth:disabled { opacity: .68; cursor: not-allowed; transform: none; box-shadow: none; }

/* ─── Footer link ────────────────────────────────────────────────────────────── */

.auth-footer { text-align: center; font-size: 14px; color: #64748b; }
.auth-link { color: #6366f1; font-weight: 600; text-decoration: none; transition: color .15s; }
.auth-link:hover { color: #4f46e5; text-decoration: underline; }

/* ─── Alerts ─────────────────────────────────────────────────────────────────── */

.auth-alert {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.auth-alert.error   { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; }
.auth-alert.success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #16a34a; }
.auth-alert i { flex-shrink: 0; margin-top: 1px; }

/* ─── Responsive ─────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  body.auth-page { padding: 16px; align-items: flex-start; }
  .auth-card { flex-direction: column; border-radius: 20px; max-width: 480px; min-height: auto; }
  .auth-left { flex: 0 0 auto; padding: 28px 28px 24px; }
  .auth-brand-sub, .auth-features { display: none; }
  .auth-right { padding: 32px 28px 36px; }
  .auth-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  body.auth-page { padding: 0; background: #fff; }
  .lang-switcher-btn {
    min-width: 132px;
    height: 34px;
  }
  .auth-card { border-radius: 0; box-shadow: none; min-height: 100svh; }
  .auth-left { min-height: 160px; }
}

/* ─── Profile page extras ───────────────────────────────────────────────────── */

.avatar-circle {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: .05em;
  flex-shrink: 0;
}

.avatar-circle.sm { width: 36px; height: 36px; font-size: 14px; }

.role-badge-admin {
  background: #fef3c7; color: #92400e;
  border: 1px solid #fde68a;
  font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: .06em;
}
.role-badge-user {
  background: #eff6ff; color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: .06em;
}

.profile-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 28px 32px;
  margin-bottom: 20px;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-bottom: 24px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 24px;
}

.profile-tabs .nav-link {
  color: #64748b;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 20px;
  border-radius: 8px;
  transition: color .15s, background .15s;
}
.profile-tabs .nav-link:hover { background: #f1f5f9; color: #1e293b; }
.profile-tabs .nav-link.active {
  background: #f1f5f9;
  color: #4f46e5;
  font-weight: 600;
}

.profile-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  color: #0f172a;
  background: #f8fafc;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.profile-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,.1);
  background: #fff;
}
.profile-input::placeholder { color: #cbd5e1; }

.profile-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.btn-save {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .1s, box-shadow .2s;
}
.btn-save:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(79,70,229,.3); }

.profile-toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: #0f172a;
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  display: flex; align-items: center; gap: 8px;
  box-shadow: 0 8px 30px rgba(0,0,0,.25);
  transform: translateY(80px);
  opacity: 0;
  transition: transform .3s, opacity .3s;
  z-index: 9999;
}
.profile-toast.show { transform: translateY(0); opacity: 1; }
.profile-toast.error { background: #dc2626; }
.profile-toast.success { background: #16a34a; }
