/* ==========================================================================
   ArtArk Internationalization & Global Edition Stylesheet
   Strictly aligned with design.md and 国际化版本.md
   ========================================================================== */

:root {
  --i18n-accent: #49f5f5;
  --i18n-accent-glow: rgba(73, 245, 245, 0.35);
  --i18n-accent-surface: rgba(73, 245, 245, 0.12);
  --i18n-primary: #165dff;
  --i18n-primary-hover: #0e42d2;
  --i18n-dark-bg: #171a1f;
  --i18n-dark-surface: #232730;
  --i18n-dark-border: #2e3440;
  --i18n-light-border: #e5e6eb;
}

/* --------------------------------------------------------------------------
   1. Brand Box Edition Badge & Right-Click Hint
   -------------------------------------------------------------------------- */
.brand-box {
  cursor: pointer;
  position: relative;
  user-select: none;
}

.brand-box:hover {
  opacity: 0.92;
}

/* 红框位置元素不用显示出来（模拟调用非功能UI） */
.edition-badge {
  display: none !important;
}

/* --------------------------------------------------------------------------
   2. Edition Switcher Context Menu (Right click on Red Box)
   -------------------------------------------------------------------------- */
.edition-context-overlay {
  position: fixed;
  inset: 0;
  z-index: 100080;
  background: rgba(19, 28, 38, 0.2);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.edition-context-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.edition-context-menu {
  position: absolute;
  width: 320px;
  background: #ffffff;
  border: 1px solid #c9cdd4;
  border-radius: 8px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(22, 93, 255, 0.1);
  padding: 12px;
  transform: scale(0.95);
  transform-origin: top left;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.15s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Roboto Flex', sans-serif;
  color: #1d2129;
}

.edition-context-overlay.show .edition-context-menu {
  transform: scale(1);
}

.edition-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid #e5e6eb;
}

.edition-menu-title {
  font-size: 13px;
  font-weight: 600;
  color: #1d2129;
  display: flex;
  align-items: center;
  gap: 6px;
}

.edition-menu-tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  background: #edf4ff;
  color: #165dff;
  font-weight: 500;
}

.edition-opt-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  margin-bottom: 6px;
  background: #f7f9fc;
}

.edition-opt-card:hover {
  background: #edf4ff;
  border-color: #b6c4ff;
}

.edition-opt-card.active {
  background: #eef4ff;
  border-color: #165dff;
  box-shadow: 0 0 0 1px #165dff;
}

.edition-opt-icon {
  font-size: 20px;
  line-height: 1.2;
}

.edition-opt-main {
  flex: 1;
}

.edition-opt-name {
  font-size: 13px;
  font-weight: 600;
  color: #1d2129;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.edition-opt-desc {
  font-size: 11px;
  color: #86909c;
  line-height: 1.4;
  margin-top: 3px;
}

.edition-opt-check {
  color: #165dff;
  font-weight: 700;
  font-size: 13px;
}

.edition-menu-tip {
  font-size: 11px;
  color: #86909c;
  background: #f2f3f5;
  padding: 6px 8px;
  border-radius: 4px;
  line-height: 1.35;
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   3. Settings Language Toggle (Frame 6.png)
   -------------------------------------------------------------------------- */
.settings-lang-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid #f2f3f5;
}

.settings-lang-group {
  display: inline-flex;
  align-items: center;
  background: #f2f3f5;
  border-radius: 6px;
  padding: 3px;
  gap: 2px;
}

.settings-lang-btn {
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: #4e5969;
  padding: 5px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.settings-lang-btn:hover {
  color: #1d2129;
}

.settings-lang-btn.active {
  background: #ffffff;
  color: #165dff;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* --------------------------------------------------------------------------
   4. Lovart-style Global Auth Modal (image.png)
   -------------------------------------------------------------------------- */
.auth-global-overlay {
  position: fixed;
  inset: 0;
  z-index: 100060;
  background: rgba(15, 18, 22, 0.65);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.auth-global-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.auth-global-modal {
  width: 440px;
  max-width: 92vw;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.24);
  padding: 36px 36px 32px;
  position: relative;
  text-align: center;
  transform: scale(0.96) translateY(12px);
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.auth-global-overlay.show .auth-global-modal {
  transform: scale(1) translateY(0);
}

.auth-global-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #86909c;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.auth-global-close:hover {
  background: #f2f3f5;
  color: #1d2129;
}

.auth-global-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.auth-global-logo-icon {
  width: 26px;
  height: 26px;
}

.auth-global-logo-text {
  font-size: 20px;
  font-weight: 700;
  color: #131c26;
  letter-spacing: -0.5px;
}

.auth-global-title {
  font-size: 24px;
  font-weight: 700;
  color: #131c26;
  margin: 0 0 6px 0;
  line-height: 1.25;
}

.auth-global-subtitle {
  font-size: 14px;
  color: #86909c;
  margin: 0 0 24px 0;
}

.auth-global-oauth-btn {
  width: 100%;
  height: 44px;
  border-radius: 8px;
  border: 1px solid #e5e6eb;
  background: #ffffff;
  color: #1d2129;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.18s ease;
  margin-bottom: 12px;
}

.auth-global-oauth-btn:hover {
  background: #f7f8fa;
  border-color: #c9cdd4;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.auth-global-oauth-btn svg {
  width: 20px;
  height: 20px;
  flex: none;
}

.auth-global-oauth-btn:disabled,
#btn-auth-global-submit:disabled {
  opacity: 0.5;
  cursor: default;
}

.auth-oauth-status {
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid #d8e3f7;
  border-radius: 8px;
  background: #f7f9ff;
  color: #434656;
  font-size: 12px;
  line-height: 1.6;
}

.auth-oauth-status[hidden] {
  display: none;
}

.auth-oauth-status button {
  display: block;
  margin: 6px auto 0;
  border: 0;
  background: none;
  color: #0047cf;
  cursor: pointer;
  font: inherit;
}

.auth-oauth-status button[hidden] {
  display: none;
}

.auth-global-input {
  width: 100%;
  height: 44px;
  border-radius: 8px;
  border: 1px solid #e5e6eb;
  padding: 0 14px;
  font-size: 14px;
  color: #1d2129;
  box-sizing: border-box;
  margin-bottom: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: #fafbfd;
}

.auth-global-input:focus {
  outline: none;
  background: #ffffff;
  border-color: #165dff;
  box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.12);
}

/* Cloudflare Turnstile Mock Widget */
.auth-turnstile-box {
  width: 100%;
  height: 64px;
  background: #fafafa;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-sizing: border-box;
  margin-bottom: 16px;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.auth-turnstile-box:hover {
  border-color: #ccc;
  background: #f7f7f7;
}

.auth-turnstile-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-turnstile-checkbox {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 2px solid #0051c3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  transition: all 0.2s ease;
}

.auth-turnstile-box.verified .auth-turnstile-checkbox {
  background: #00875a;
  border-color: #00875a;
}

.auth-turnstile-label {
  font-size: 14px;
  font-weight: 500;
  color: #2e3440;
}

.auth-turnstile-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.auth-turnstile-brand {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #f38020;
}

.auth-turnstile-links {
  font-size: 10px;
  color: #86909c;
}

.auth-turnstile-links a {
  color: #86909c;
  text-decoration: none;
}

.auth-turnstile-links a:hover {
  text-decoration: underline;
}

.auth-global-submit-btn {
  width: 100%;
  height: 44px;
  border-radius: 8px;
  border: none;
  background: #131c26;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  margin-bottom: 20px;
}

.auth-global-submit-btn:hover {
  background: #28313b;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.auth-global-submit-btn:disabled {
  background: #e5e6eb;
  color: #86909c;
  cursor: not-allowed;
}

.auth-global-terms {
  font-size: 12px;
  color: #86909c;
  line-height: 1.5;
  margin: 0;
}

.auth-global-terms a {
  color: #4e5969;
  text-decoration: underline;
}

.auth-global-terms a:hover {
  color: #165dff;
}

/* --------------------------------------------------------------------------
   5. Global billing history
   -------------------------------------------------------------------------- */
.global-bill-card {
  border: 1px solid #eceef2;
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
}

.global-bill-head,
.global-bill-row {
  display: grid;
  grid-template-columns: minmax(110px, 1.3fr) minmax(100px, 1.4fr) minmax(62px, 0.8fr) minmax(40px, 0.6fr) minmax(60px, 0.7fr);
  gap: 8px;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  font-size: 13px;
}

.global-bill-head {
  background: #f7f8fa;
  color: #6b7280;
  font-weight: 600;
}

.global-bill-row {
  padding-top: 8px;
  padding-bottom: 8px;
  line-height: 1.5;
  border-top: 1px solid #f1f3f6;
  color: #30343a;
}

.global-bill-category {
  min-width: 0;
  overflow-wrap: anywhere;
}

.global-bill-row button {
  justify-self: start;
  border: 0;
  background: transparent;
  color: #8b919a;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}

.global-bill-row button:hover { color: #1677ff; }

.global-bill-end {
  padding: 18px 16px 16px;
  text-align: center;
  color: #b0b6bf;
  font-size: 12px;
}

/* --------------------------------------------------------------------------
   8. English Layout Adaptations (lang-en)
   Ensuring beauty and harmony with longer English words
   -------------------------------------------------------------------------- */
html[lang='en'] .brand-title,
body.lang-en .brand-title {
  letter-spacing: -0.3px;
}

/* Nav Item text spacing in English */
html[lang='en'] .nav-item span,
body.lang-en .nav-item span {
  font-size: 13px;
}

/* Filter Tab pills adaptation */
html[lang='en'] .case-filter-btn,
body.lang-en .case-filter-btn {
  padding: 4px 12px;
  white-space: nowrap;
}

/* Prompt Card title handling */
html[lang='en'] .prompt-card-title,
body.lang-en .prompt-card-title {
  font-size: 13px;
  line-height: 1.35;
}

/* Subscription Plan features line-height */
html[lang='en'] .plan-feature-row,
body.lang-en .plan-feature-row {
  line-height: 1.4;
}

/* Billing status badge in English */
.billing-col-actions-group {
  display: inline-flex;
  gap: 6px;
}

.billing-action-btn-sm {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #165dff;
  cursor: pointer;
  transition: all 0.15s ease;
}

.billing-action-btn-sm:hover {
  background: #edf4ff;
  border-color: #165dff;
}

/* Global edition email verification and account profile */
.auth-code-step[hidden], .auth-email-step[hidden] { display: none !important; }
#auth-password-step[hidden], #auth-set-password-step[hidden] { display: none !important; }
.auth-password-field { margin-top: 18px; text-align: left; }
.auth-field-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; color: #4e5969; font-size: 13px; }
.auth-text-action { padding: 0; border: 0; background: transparent; color: #64748b; font: inherit; cursor: pointer; }
.auth-text-action:hover { color: #165dff; }
.auth-password-input-wrap { position: relative; }
.auth-password-field .auth-global-input { margin: 0; padding-right: 46px; }
.auth-password-field .auth-global-input[readonly] { color: #64748b; }
.auth-password-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #8993a4; cursor: pointer; }
.auth-password-toggle:hover { color: #131c26; background: #edf0f4; }
.auth-method-back { color: #64748b; margin-top: 22px; }
.auth-demo-accounts { margin-top: 18px; padding: 12px 14px; border: 1px solid #e5e6eb; border-radius: 10px; background: #fafbfd; text-align: left; }
.auth-demo-heading { margin-bottom: 8px; color: #8993a4; font-size: 11px; }
.auth-demo-accounts button { display: flex; flex-wrap: wrap; gap: 4px 12px; width: 100%; padding: 5px 0; border: 0; background: transparent; color: #4e5969; font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.auth-demo-accounts button:hover strong { color: #165dff; }
.auth-demo-accounts strong { font-weight: 500; overflow-wrap: anywhere; }
.auth-demo-accounts p { margin: 0 0 6px; color: #8993a4; font-size: 11px; }
.auth-global-submit-btn:disabled { opacity: .6; cursor: wait; }
.auth-code-back { border: 0; background: transparent; color: #64748b; cursor: pointer; display: block; margin: -4px 0 12px; padding: 4px 0; font-size: 13px; }
.auth-code-email { color: #1d2129; font-size: 14px; font-weight: 600; margin: 8px 0 18px; word-break: break-all; }
.auth-code-inputs { display: flex; justify-content: center; gap: 8px; margin: 14px 0; }
.auth-code-input { width: 46px; height: 52px; border: 1px solid #d9dce3; border-radius: 9px; background: #fafbfd; color: #131c26; font-size: 23px; font-weight: 700; text-align: center; }
.auth-code-input:focus { outline: none; border-color: #165dff; box-shadow: 0 0 0 3px rgba(22,93,255,.12); background: #fff; }
.auth-code-error { min-height: 19px; margin: 4px 0 8px; color: #e34d59; font-size: 12px; }
.auth-code-resend { border: 0; background: transparent; color: #165dff; cursor: pointer; font-size: 13px; margin-top: 12px; }
.auth-code-demo { color: #9aa1ad; font-size: 11px; margin: 12px 0 0; }
.global-account-profile { display: flex; align-items: center; gap: 12px; padding: 0 0 18px; border-bottom: 1px solid #eeeeeb; }
.global-account-avatar { width: 54px; height: 54px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: #111827; color: #63ebdc; font-size: 21px; font-weight: 700; flex: 0 0 auto; }
.global-account-avatar img { width: 100%; height: 100%; object-fit: cover; }
.global-account-profile-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.global-account-profile-main strong { color: #30332f; font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.global-account-profile-main span { color: #8b918c; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.global-account-input { width: 180px; border: 1px solid #e2e5e9; border-radius: 5px; padding: 6px 8px; color: #30332f; background: #fff; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease; }
.global-account-input[readonly] { background: #fafafa; color: #575b56; cursor: default; }
.global-account-input:focus { outline: none; border-color: #165dff; box-shadow: 0 0 0 2px rgba(22,93,255,.1); }
.global-username-editor { display: inline-flex; align-items: center; gap: 7px; }
.global-username-action { width: 34px; height: 34px; display: inline-grid; place-items: center; border: 0; border-radius: 50%; color: #6d746e; background: transparent; cursor: pointer; transition: color .15s ease, background .15s ease, transform .15s ease; }
.global-username-action:hover { color: #165dff; background: #edf4ff; }
.global-username-action:active { transform: scale(.94); }
.global-username-action.is-editing { color: #11866f; }
.global-username-action.is-editing:hover { color: #0c6f5d; background: #e8faf5; }
.global-username-action .global-username-check-icon { display: none; }
.global-username-action.is-editing .global-username-edit-icon { display: none; }
.global-username-action.is-editing .global-username-check-icon { display: block; }
.global-account-readonly { color: #747b75; }
.sidebar-footer .avatar, .account-summary .avatar { overflow: hidden; }
.sidebar-footer .avatar img, .account-summary .avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
@media (max-width: 560px) { .auth-code-input { width: 40px; height: 48px; } .global-account-profile { flex-wrap: wrap; } }

/* Visitor actions, shared by every sidebar. */
.sidebar-footer {
  position: relative;
}

body.guest-mode .sidebar-footer {
  gap: 8px;
  flex-shrink: 0;
}

body.guest-mode .guest-login-entry {
  flex: 1;
  min-width: 0;
  width: auto;
}

.guest-more-entry {
  display: inline-flex;
  flex: 0 0 36px;
  align-items: center;
  justify-content: center;
  height: 36px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
}

.guest-more-entry:hover,
.guest-more-entry[aria-expanded='true'] {
  background: #f3f5f1;
  color: var(--text-primary);
}

.guest-more-entry:focus-visible,
.guest-menu-item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.guest-menu,
.guest-language-menu {
  position: absolute;
  z-index: 120;
  padding: 6px;
  border: 1px solid #e5e6eb;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  font-size: 13px;
}

.guest-menu {
  bottom: calc(100% + 2px);
  right: 12px;
  left: 12px;
}

.guest-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 30px;
  padding: 5px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #2b2e29;
  font-size: 13px;
  line-height: 20px;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.guest-menu-item:hover,
.guest-menu-item:focus-visible,
.guest-menu-item[aria-expanded='true'] {
  background: #f3f5f1;
}

.guest-menu-item svg {
  flex-shrink: 0;
}

.guest-menu-chevron,
.guest-language-check {
  margin-left: auto;
}

.guest-language-group {
  position: relative;
}

.guest-language-menu {
  bottom: 0;
  left: calc(100% + 8px);
  width: 230px;
  max-height: min(540px, calc(100vh - 32px));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.guest-language-menu::before {
  position: absolute;
  top: -1px;
  right: 100%;
  bottom: -1px;
  width: 9px;
  content: '';
}

.guest-language-menu [aria-checked='false'] .guest-language-check {
  visibility: hidden;
}

body:not(.guest-mode) .guest-more-entry,
body:not(.guest-mode) .guest-menu,
.guest-menu[hidden],
.guest-language-group[hidden],
.guest-language-menu[hidden] {
  display: none;
}

@media (max-width: 460px) {
  .guest-language-menu {
    top: auto;
    bottom: calc(100% + 8px);
    left: 0;
    width: 100%;
  }

  .guest-language-menu::before {
    top: 100%;
    right: 0;
    bottom: auto;
    left: 0;
    width: auto;
    height: 9px;
  }
}
