/* ================================================================
   Auth v2 - Two-Panel Gradient Login Page
   tarmilar.cn
   ================================================================ */

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Keyframes ── */
@keyframes auth-v2-bg-float {
  0%, 100% { opacity: 0.5; transform: translate(0, 0) scale(1); }
  50% { opacity: 0.8; transform: translate(-10px, -10px) scale(1.03); }
}
@keyframes auth-v2-card-in {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes auth-v2-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes auth-v2-register-in {
  from { opacity: 0; transform: translateY(30px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Page ── */
.auth-v2-page {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #f0f2f5 0%, #e8ecf1 40%, #f5f3ff 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

.auth-v2-page::before {
  content: '';
  position: absolute;
  top: -25%;
  left: -15%;
  width: 70%;
  height: 70%;
  background: radial-gradient(ellipse at center, rgba(83, 74, 183, 0.08) 0%, transparent 70%);
  border-radius: 50%;
  animation: auth-v2-bg-float 10s ease-in-out infinite;
  z-index: 0;
}
.auth-v2-page::after {
  content: '';
  position: absolute;
  bottom: -20%;
  right: -10%;
  width: 60%;
  height: 60%;
  background: radial-gradient(ellipse at center, rgba(127, 119, 221, 0.06) 0%, transparent 70%);
  border-radius: 50%;
  animation: auth-v2-bg-float 12s ease-in-out 2s infinite;
  z-index: 0;
}

/* ── Top-right Controls ── */
.auth-v2-controls {
  position: fixed;
  top: 16px;
  right: 20px;
  z-index: 100;
  display: flex;
  gap: 8px;
  align-items: center;
}
.auth-v2-btn-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(8px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  transition: all 0.2s;
}
.auth-v2-btn-icon:hover { background: rgba(255,255,255,0.95); color: #534AB7; }
.auth-v2-lang-dropdown { position: relative; }
.auth-v2-lang-menu {
  display: none;
  position: absolute;
  top: 44px;
  right: 0;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  padding: 6px;
  min-width: 110px;
  z-index: 101;
}
.auth-v2-lang-menu.show { display: block; }
.auth-v2-lang-menu a {
  display: block;
  padding: 8px 14px;
  font-size: 13px;
  color: #555;
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.15s;
}
.auth-v2-lang-menu a:hover { background: #f5f3ff; color: #534AB7; }
.auth-v2-lang-menu a.active { background: #f5f3ff; color: #534AB7; font-weight: 500; }

/* ── Two-Panel Container ── */
.auth-v2-container {
  position: relative;
  z-index: 1;
  display: flex;
  width: 760px;
  max-width: 94vw;
  min-height: 480px;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(83, 74, 183, 0.1), 0 2px 8px rgba(0,0,0,0.04);
  animation: auth-v2-card-in 0.5s ease-out;
}

/* ── Left: Brand Panel ── */
.auth-v2-brand {
  width: 42%;
  background: linear-gradient(160deg, #1a1458 0%, #3127A0 40%, #534AB7 70%, #7F77DD 100%);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
  text-align: center;
}
.auth-v2-brand-bg-circle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
}
.auth-v2-brand-bg-circle.a2c1 {
  top: -50px;
  right: -50px;
  width: 160px;
  height: 160px;
}
.auth-v2-brand-bg-circle.a2c2 {
  bottom: -40px;
  left: -40px;
  width: 110px;
  height: 110px;
  background: rgba(255,255,255,0.07);
}
.auth-v2-brand-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0.06) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  position: relative;
  z-index: 1;
}
.auth-v2-brand-logo svg { width: 28px; height: 28px; }
.auth-v2-brand-name {
  font-size: 19px;
  font-weight: 600;
  color: #EBE9FC;
  position: relative;
  z-index: 1;
  letter-spacing: 1px;
}
.auth-v2-brand-slogan {
  font-size: 13px;
  color: #B5AEE8;
  line-height: 1.6;
  position: relative;
  z-index: 1;
}
.auth-v2-brand-features {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 0 10px;
}
.auth-v2-feature-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #D4CFF6;
  padding: 6px 0;
}
.auth-v2-feature-pill::before {
  content: '';
  width: 5px;
  height: 5px;
  background: #AFA9EC;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Right: Form Panel ── */
.auth-v2-form-panel {
  flex: 1;
  padding: 2rem 2rem 1.5rem;
  display: flex;
  flex-direction: column;
}

/* ── Tabs ── */
.auth-v2-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #eee;
  margin-bottom: 24px;
  flex-shrink: 0;
}
.auth-v2-tab {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 400;
  color: #999;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  white-space: nowrap;
}
.auth-v2-tab:hover { color: #666; }
.auth-v2-tab.active {
  color: #534AB7;
  font-weight: 500;
  border-bottom-color: #534AB7;
}
.auth-v2-badge {
  position: absolute;
  top: 4px;
  right: -4px;
  font-size: 9px;
  background: linear-gradient(135deg, #FF6B6B, #FF8E53);
  color: #fff;
  padding: 1px 6px;
  border-radius: 8px;
  line-height: 1.4;
  font-weight: 500;
}

/* ── Tab Content ── */
.auth-v2-tab-content { flex: 1; display: flex; flex-direction: column; }
.auth-v2-tab-panel { display: none; flex-direction: column; flex: 1; }
.auth-v2-tab-panel.active { display: flex; }

/* ── Form Elements ── */
.auth-v2-field { margin-bottom: 14px; }
.auth-v2-field:last-child { margin-bottom: 0; }
.auth-v2-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-v2-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #bbb;
  z-index: 1;
  pointer-events: none;
  transition: color 0.2s;
}
.auth-v2-input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  font-size: 14px;
  color: #333;
  background: #fafafa;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  font-family: inherit;
}
.auth-v2-input:focus {
  border-color: #534AB7;
  box-shadow: 0 0 0 3px rgba(83,74,183,0.08);
  background: #fff;
}
.auth-v2-input:focus ~ .auth-v2-input-icon,
.auth-v2-input:focus + .auth-v2-input-icon,
.auth-v2-input-wrap:focus-within .auth-v2-input-icon { color: #534AB7; }
.auth-v2-input::placeholder { color: #ccc; }

.auth-v2-pw-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #bbb;
  padding: 4px;
  z-index: 1;
  transition: color 0.2s;
}
.auth-v2-pw-toggle:hover { color: #666; }

.auth-v2-error {
  display: none;
  font-size: 12px;
  color: #E24B4A;
  margin-top: 5px;
  padding-left: 4px;
}

/* ── Options Row ── */
.auth-v2-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  font-size: 13px;
}
.auth-v2-remember {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #888;
  cursor: pointer;
}
.auth-v2-remember input[type="checkbox"] { accent-color: #534AB7; width: 15px; height: 15px; }
.auth-v2-forgot {
  background: none;
  border: none;
  color: #534AB7;
  font-size: 13px;
  cursor: pointer;
}
.auth-v2-forgot:hover { text-decoration: underline; }

/* ── Submit Button ── */
.auth-v2-submit {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #534AB7 0%, #7F77DD 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 2px;
  transition: all 0.25s;
  font-family: inherit;
}
.auth-v2-submit:hover {
  background: linear-gradient(135deg, #3C3489 0%, #534AB7 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(83,74,183,0.3);
}
.auth-v2-submit:active { transform: translateY(0); }
.auth-v2-submit.loading {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Switch ── */
.auth-v2-switch {
  text-align: center;
  font-size: 13px;
  color: #999;
  margin-top: 16px;
}
.auth-v2-switch a {
  color: #534AB7;
  text-decoration: none;
  font-weight: 500;
}
.auth-v2-switch a:hover { text-decoration: underline; }

/* ── Back ── */
.auth-v2-back {
  text-align: center;
  margin-top: 10px;
}
.auth-v2-back a {
  font-size: 12px;
  color: #bbb;
  text-decoration: none;
}
.auth-v2-back a:hover { color: #534AB7; }

/* ── QR Code Section ── */
.auth-v2-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 14px;
}
.auth-v2-qr-box {
  width: 170px;
  height: 170px;
  border: 2px dashed #e0e0e0;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fafafa, #f5f5f5);
  overflow: hidden;
}
.auth-v2-qr-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.auth-v2-qr-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #bbb;
  font-size: 12px;
}
.auth-v2-qr-hint { font-size: 13px; color: #999; }
.auth-v2-qr-actions { display: flex; gap: 12px; }
.auth-v2-qr-refresh {
  background: none;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 13px;
  color: #534AB7;
  cursor: pointer;
  transition: all 0.2s;
}
.auth-v2-qr-refresh:hover { background: #f5f3ff; border-color: #534AB7; }
.auth-v2-qr-back { margin-top: 6px; }
.auth-v2-qr-back button {
  background: none;
  border: none;
  font-size: 12px;
  color: #aaa;
  cursor: pointer;
}
.auth-v2-qr-back button:hover { color: #534AB7; }

/* ── Register Overlay ── */
.auth-v2-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: auth-v2-overlay-in 0.2s ease-out;
}
.auth-v2-register-card {
  background: #fff;
  border-radius: 16px;
  padding: 2rem;
  width: 420px;
  max-width: 92vw;
  max-height: 90vh;
  overflow-y: auto;
  animation: auth-v2-register-in 0.3s ease-out;
}
.auth-v2-register-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.auth-v2-register-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: #333;
}
.auth-v2-register-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #f5f5f5;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  transition: all 0.2s;
}
.auth-v2-register-close:hover { background: #eee; color: #333; }

.auth-v2-field-row { display: flex; gap: 12px; margin-bottom: 14px; }
.auth-v2-field-row .auth-v2-field { flex: 1; margin-bottom: 0; }

/* ── Footer ── */
.auth-v2-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: #bbb;
}

/* ── RTL Support ── */
[dir="rtl"] .auth-v2-input-icon { left: auto; right: 14px; }
[dir="rtl"] .auth-v2-input { padding: 12px 40px 12px 14px; }
[dir="rtl"] .auth-v2-pw-toggle { right: auto; left: 12px; }
[dir="rtl"] .auth-v2-remember { flex-direction: row-reverse; }

/* ── Dark Mode ── */
.auth-v2-page.dark {
  background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 40%, #12121f 100%);
  color: #ccc;
}
.auth-v2-page.dark::before,
.auth-v2-page.dark::after { display: none; }
.auth-v2-page.dark .auth-v2-container {
  background: #1e1e2e;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}
.auth-v2-page.dark .auth-v2-btn-icon {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
  color: #aaa;
}
.auth-v2-page.dark .auth-v2-btn-icon:hover { background: rgba(255,255,255,0.1); color: #AFA9EC; }
.auth-v2-page.dark .auth-v2-lang-menu { background: #2a2a3e; border-color: rgba(255,255,255,0.08); }
.auth-v2-page.dark .auth-v2-lang-menu a { color: #ccc; }
.auth-v2-page.dark .auth-v2-lang-menu a:hover { background: rgba(83,74,183,0.15); color: #AFA9EC; }
.auth-v2-page.dark .auth-v2-lang-menu a.active { background: rgba(83,74,183,0.2); color: #AFA9EC; }
.auth-v2-page.dark .auth-v2-tabs { border-bottom-color: rgba(255,255,255,0.08); }
.auth-v2-page.dark .auth-v2-tab { color: #777; }
.auth-v2-page.dark .auth-v2-tab.active { color: #AFA9EC; border-bottom-color: #AFA9EC; }
.auth-v2-page.dark .auth-v2-input {
  background: #1a1a2e;
  border-color: rgba(255,255,255,0.08);
  color: #ddd;
}
.auth-v2-page.dark .auth-v2-input:focus {
  border-color: #7F77DD;
  background: #1e1e32;
  box-shadow: 0 0 0 3px rgba(127,119,221,0.15);
}
.auth-v2-page.dark .auth-v2-input::placeholder { color: #555; }
.auth-v2-page.dark .auth-v2-input-icon { color: #555; }
.auth-v2-page.dark .auth-v2-input-wrap:focus-within .auth-v2-input-icon { color: #7F77DD; }
.auth-v2-page.dark .auth-v2-options { color: #888; }
.auth-v2-page.dark .auth-v2-forgot { color: #AFA9EC; }
.auth-v2-page.dark .auth-v2-error { color: #F09595; }
.auth-v2-page.dark .auth-v2-qr-box { background: #1a1a2e; border-color: rgba(255,255,255,0.08); }
.auth-v2-page.dark .auth-v2-qr-refresh { border-color: rgba(255,255,255,0.1); color: #AFA9EC; }
.auth-v2-page.dark .auth-v2-qr-refresh:hover { background: rgba(83,74,183,0.1); border-color: #7F77DD; }
.auth-v2-page.dark .auth-v2-register-card { background: #1e1e2e; }
.auth-v2-page.dark .auth-v2-register-header h2 { color: #ddd; }
.auth-v2-page.dark .auth-v2-register-close { background: rgba(255,255,255,0.06); color: #888; }
.auth-v2-page.dark .auth-v2-register-close:hover { background: rgba(255,255,255,0.1); color: #ddd; }
.auth-v2-page.dark .auth-v2-switch { color: #888; }
.auth-v2-page.dark .auth-v2-switch a { color: #AFA9EC; }
.auth-v2-page.dark .auth-v2-back a { color: #555; }
.auth-v2-page.dark .auth-v2-back a:hover { color: #AFA9EC; }
.auth-v2-page.dark .auth-v2-footer { color: #555; }
.auth-v2-page.dark .auth-v2-submit:hover {
  box-shadow: 0 4px 16px rgba(127,119,221,0.3);
}

/* ── Responsive ── */
@media (max-width: 680px) {
  .auth-v2-container {
    flex-direction: column;
    max-width: 96vw;
    min-height: auto;
  }
  .auth-v2-brand {
    width: 100%;
    padding: 1.5rem 1.25rem;
    gap: 8px;
  }
  .auth-v2-brand-logo { width: 42px; height: 42px; border-radius: 12px; }
  .auth-v2-brand-logo svg { width: 22px; height: 22px; }
  .auth-v2-brand-name { font-size: 16px; }
  .auth-v2-brand-features { display: none; }
  .auth-v2-form-panel { padding: 1.5rem 1.25rem; }
  .auth-v2-tab { padding: 8px 14px; font-size: 13px; }
  .auth-v2-field-row { flex-direction: column; gap: 0; }
  .auth-v2-register-card { padding: 1.5rem; }
}
