/* ===== Auth Page Styles ===== */
.auth-page {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 24px;
  position: relative; overflow: hidden;
}
.auth-page::before {
  content: ''; position: absolute;
  top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle at 30% 30%, var(--primary-muted) 0%, transparent 50%),
              radial-gradient(circle at 70% 70%, rgba(18, 124, 134, 0.06) 0%, transparent 40%);
  animation: authBgPulse 8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes authBgPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}
.auth-logo {
  width: 80px; height: 80px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; margin-bottom: 24px;
  position: relative; z-index: 1;
  box-shadow: 0 8px 32px rgba(18, 124, 134, 0.3);
  animation: authLogoFloat 3s ease-in-out infinite, authLogoGlow 2s ease-in-out infinite alternate;
}
@keyframes authLogoFloat {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}
@keyframes authLogoGlow {
  from { box-shadow: 0 8px 32px rgba(18, 124, 134, 0.3); }
  to { box-shadow: 0 12px 40px rgba(18, 124, 134, 0.5); }
}
.auth-logo::after {
  content: ''; position: absolute; inset: -4px;
  border-radius: 28px; border: 2px solid var(--primary-light);
  opacity: 0; animation: authLogoRing 2s ease-out infinite;
}
@keyframes authLogoRing {
  0% { transform: scale(0.9); opacity: 0.6; }
  100% { transform: scale(1.3); opacity: 0; }
}
.auth-logo::before {
  content: ''; position: absolute; inset: -8px;
  border-radius: 32px; border: 1.5px solid var(--primary-light);
  opacity: 0; animation: authLogoRing2 3s ease-out infinite;
}
@keyframes authLogoRing2 {
  0% { transform: scale(0.85); opacity: 0.5; }
  100% { transform: scale(1.4); opacity: 0; }
}
.auth-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.auth-subtitle { font-size: 14px; color: var(--text-secondary); margin-bottom: 32px; }
.auth-form { width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 16px; }
.auth-input {
  width: 100%; padding: 16px 18px;
  border: 1.5px solid var(--border);
  border-radius: 16px; font-size: 16px;
  background: var(--card-bg-solid); color: var(--text-primary);
  outline: none; text-align: left; letter-spacing: 0;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-muted), 0 0 20px rgba(18, 124, 134, 0.12);
}
.auth-input::placeholder { color: var(--text-muted); opacity: 0.8; }
.auth-btn {
  width: 100%; padding: 15px;
  background: var(--cta-gradient);
  color: var(--cta-ink); border: none;
  border-radius: 16px; font-size: 16px; font-weight: 800;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--cta-shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.auth-btn:active { transform: scale(0.98); box-shadow: 0 2px 8px rgba(176, 122, 56, 0.28); }
.auth-btn:disabled { opacity: 0.6; }
.auth-links {
  display: flex;
  justify-content: flex-end;
}
.auth-link {
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
  cursor: pointer;
  padding: 4px 0;
}
.auth-link:hover { text-decoration: underline; }

/* SMS code row */
.sms-code-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.sms-code-btn {
  flex-shrink: 0;
  padding: 0 14px;
  height: 50px;
  border-radius: 14px;
  border: 1px solid var(--primary);
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
  min-width: 90px;
  text-align: center;
}
.sms-code-btn:active { background: var(--primary-muted); }
.sms-code-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Auth Page AI Network Background */
.auth-page .auth-network-bg {
  position: absolute; inset: 0;
  overflow: hidden; pointer-events: none; z-index: 0;
}
.auth-page .auth-network-bg svg { width: 100%; height: 100%; opacity: 0.15; }
@media (prefers-color-scheme: dark) {
  .auth-page .auth-network-bg svg { opacity: 0.2; }
}
.auth-page > *:not(.auth-network-bg) { position: relative; z-index: 1; }
.auth-branding {
  font-size: 12px; color: var(--text-muted);
  margin-top: 24px; letter-spacing: 1px; opacity: 0.7;
}
.auth-branding span {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; font-weight: 700;
}

/* Auth Transition */
.auth-page.fade-out { animation: authFadeOut 0.5s ease forwards; }
@keyframes authFadeOut { to { opacity: 0; transform: scale(0.96); } }
#mainApp.fade-in { animation: mainFadeIn 0.5s ease forwards; }
@keyframes mainFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Error message */
.auth-error {
  min-height: 20px;
  font-size: 13px; color: var(--error);
  text-align: center;
  animation: authShake 0.3s ease-out;
}
@keyframes authShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Shake on form */
.auth-form.shake { animation: authFormShake 0.4s ease-out; }
@keyframes authFormShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

/* ===== Enhanced Auth Inputs (icon + suffix) ===== */
.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-input-wrap .auth-input {
  padding-left: 44px;
  padding-right: 44px;
}
.auth-input-icon {
  position: absolute;
  left: 16px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  display: flex; align-items: center;
  pointer-events: none;
  transition: color 0.2s;
  z-index: 2;
}
.auth-input-wrap:focus-within .auth-input-icon {
  color: var(--primary);
}
.auth-input-suffix {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  width: 36px; height: 36px;
  border: none; background: transparent;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  cursor: pointer; border-radius: 10px;
  transition: background 0.15s, color 0.15s;
}
.auth-input-suffix:hover { background: var(--bg-secondary); color: var(--text-primary); }
.auth-input-suffix.active { color: var(--primary); }

/* 密码字段使用 CSS 模拟圆点，避免 iOS 键盘类型切换导致抖动 */
.pwd-field {
  -webkit-text-security: disc;
  text-security: disc;
}
.pwd-field.pwd-visible {
  -webkit-text-security: none;
  text-security: none;
}

/* 通用密码显示/隐藏切换按钮 */
.pwd-toggle-btn {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px;
  -webkit-tap-highlight-color: transparent; transition: all 0.2s;
  z-index: 3;
}
.pwd-toggle-btn:hover { background: var(--bg-secondary); color: var(--text-primary); }
.pwd-toggle-btn.active { color: var(--primary); }
.pwd-toggle-btn svg { width: 16px; height: 16px; }
.pwd-input-wrap { position: relative; }

/* Remember me checkbox */
.auth-remember-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: -4px;
}
.auth-remember {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
  font-size: 13px; color: var(--text-secondary);
}
.auth-remember input { display: none; }
.auth-remember-box {
  width: 16px; height: 16px;
  border-radius: 5px;
  border: 1.5px solid var(--border);
  background: var(--card-bg-solid);
  position: relative;
  transition: background 0.2s, border-color 0.2s;
}
.auth-remember input:checked + .auth-remember-box {
  background: var(--primary);
  border-color: var(--primary);
}
.auth-remember input:checked + .auth-remember-box::after {
  content: ''; position: absolute;
  left: 4px; top: 1px;
  width: 4px; height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Auth tips */
.auth-tips {
  width: 100%; max-width: 320px;
  margin-top: 28px;
}
.auth-tip-row {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px;
  background: rgba(18, 124, 134, 0.08);
  border-radius: 12px;
  font-size: 12px; color: var(--text-secondary);
  line-height: 1.6;
}
.auth-tip-icon { font-size: 14px; flex-shrink: 0; }

/* ===== Store Selector (multi-store selection) ===== */
.store-selector {
  position: fixed; inset: 0;
  background: var(--bg-primary);
  z-index: 100;
  display: flex; flex-direction: column;
  overflow-y: auto;
  animation: storeSelectorIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.store-selector[style*="display:none"] { animation: none; }
.store-selector.visible { display: flex !important; }
@keyframes storeSelectorIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.store-selector-bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(18, 124, 134, 0.18) 0%, transparent 50%),
    radial-gradient(circle at 80% 100%, rgba(42, 156, 170, 0.12) 0%, transparent 50%);
  pointer-events: none;
}
.store-selector > *:not(.store-selector-bg) { position: relative; z-index: 1; }
.store-selector-header {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-light, rgba(0,0,0,0.06));
}
.store-selector-avatar {
  width: 44px; height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(18, 124, 134, 0.3);
}
.store-selector-account { flex: 1; min-width: 0; }
.store-selector-account-label {
  font-size: 11px; color: var(--text-muted);
  margin-bottom: 2px;
}
.store-selector-account-phone {
  font-size: 16px; font-weight: 600; color: var(--text-primary);
  font-family: monospace;
}
.store-selector-logout {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--bg-secondary);
  border: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.store-selector-logout:hover { background: rgba(239, 68, 68, 0.12); color: var(--error); }

.store-selector-title-wrap { padding: 24px 20px 12px; }
.store-selector-title {
  font-size: 22px; font-weight: 700; color: var(--text-primary);
  margin-bottom: 6px;
}
.store-selector-sub {
  font-size: 13px; color: var(--text-secondary);
}

.store-selector-list {
  padding: 8px 16px 24px;
  display: flex; flex-direction: column; gap: 12px;
}
.store-selector-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px;
  background: var(--card-bg, #fff);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.store-selector-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(18, 124, 134, 0.12);
}
.store-selector-card:active { transform: scale(0.99); }
.store-selector-card.is-current {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(18, 124, 134, 0.05), rgba(42, 156, 170, 0.05));
}

.store-selector-logo {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  color: white; font-weight: 600; font-size: 18px;
}
.store-selector-logo img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.store-selector-logo-initial {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 600;
  color: white;
}
.store-selector-info { flex: 1; min-width: 0; }
.store-selector-name {
  font-size: 15px; font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.store-selector-meta {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.store-selector-tag {
  background: var(--primary-muted);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  flex-shrink: 0;
}
.store-selector-addr {
  overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1; min-width: 0;
}
.store-selector-arrow {
  font-size: 24px;
  color: var(--text-muted);
  font-weight: 300;
  flex-shrink: 0;
  transition: transform 0.15s;
}
.store-selector-card:hover .store-selector-arrow {
  color: var(--primary);
  transform: translateX(2px);
}

.store-selector-footer {
  text-align: center;
  font-size: 12px; color: var(--text-muted);
  padding: 16px 20px 32px;
  letter-spacing: 0.5px;
}

/* ===== Card title badge ===== */
.card-title-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 8px;
  margin-left: 8px;
  background: var(--primary-muted);
  color: var(--primary);
  border-radius: 11px;
  font-size: 12px; font-weight: 600;
}

/* ===== Store Switcher (settings list) ===== */
.store-switcher-hint {
  font-size: 12px; color: var(--text-muted);
  margin-bottom: 14px;
  padding: 0 4px;
}
.store-switcher-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 12px;
  margin-bottom: 8px;
  transition: background 0.2s;
}
.store-switcher-item.is-current {
  background: linear-gradient(135deg, rgba(18, 124, 134, 0.1), rgba(42, 156, 170, 0.08));
  border: 1px solid rgba(18, 124, 134, 0.2);
}
.store-switcher-info { flex: 1; min-width: 0; }
.store-switcher-name {
  font-size: 14px; font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
  display: flex; align-items: center; gap: 6px;
}
.store-current-tag {
  font-size: 10px;
  padding: 1px 6px;
  background: var(--primary);
  color: white;
  border-radius: 4px;
  font-weight: 500;
}
.store-switcher-meta {
  font-size: 12px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.store-switcher-btn {
  padding: 6px 14px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s, transform 0.15s;
}
.store-switcher-btn:active { transform: scale(0.96); }
.store-switcher-btn:disabled { opacity: 0.6; }
.store-switcher-status {
  font-size: 12px;
  color: var(--success, #10B981);
  padding: 4px 10px;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 6px;
}

/* ===== Home Dashboard Store Switcher Hint ===== */
.dash-header-store {
  display: flex; align-items: center; gap: 8px;
}
.dash-store-switcher {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 8px;
  background: rgba(18, 124, 134, 0.12);
  color: var(--primary);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s;
}
.dash-store-switcher:hover { background: rgba(18, 124, 134, 0.2); }
.dash-store-switcher svg { transition: transform 0.2s; }
.dash-store-switcher:hover svg { transform: translateX(2px); }
