@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Noto+Sans+SC:wght@400;500;600;700&display=swap");

:root {
  --relaxlink-font: "Inter", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}

html, body, .font-sans {
  font-family: var(--relaxlink-font) !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
pre, code, kbd, samp, .font-mono, [class*="font-mono"], .terminal-body, .terminal-body * {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace !important;
}


.text-gradient.text-3xl.font-bold {
  font-family: var(--relaxlink-font) !important;
  font-weight: 800 !important;
  letter-spacing: -0.03em !important;
  font-size: 2.35rem !important;
  line-height: 1.15 !important;
}

/* Login / Register: enlarge logo, remove Sub2API tile effect */
.mb-4.inline-flex.h-16.w-16,
.mb-4.inline-flex.h-16.w-16.items-center.justify-center,
.mb-4.inline-flex.h-16.w-16.items-center.justify-center.overflow-hidden.rounded-2xl,
.mb-4.inline-flex.h-16.w-16.items-center.justify-center.overflow-hidden.rounded-2xl.shadow-lg {
  height: 7.5rem !important;
  width: 7.5rem !important;
  min-height: 7.5rem !important;
  min-width: 7.5rem !important;
  padding: 0 !important;
  margin-bottom: 1.25rem !important;
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
  --tw-shadow: 0 0 #0000 !important;
  --tw-shadow-colored: 0 0 #0000 !important;
  border: none !important;
  border-radius: 1.25rem !important;
  overflow: visible !important;
}

.mb-4.inline-flex.h-16.w-16 img {
  display: block !important;
  height: 7.5rem !important;
  width: 7.5rem !important;
  min-height: 7.5rem !important;
  min-width: 7.5rem !important;
  max-height: none !important;
  max-width: none !important;
  object-fit: contain !important;
  background: transparent !important;
  border: none !important;
  border-radius: 1.25rem !important;
  box-shadow: 0 14px 36px rgba(20, 184, 166, 0.42) !important;
  transform: none !important;
}

/* Sidebar / dashboard header logo */
.sidebar-logo,
.sidebar-header .sidebar-logo {
  height: 3.75rem !important;
  width: 3.75rem !important;
  min-height: 3.75rem !important;
  min-width: 3.75rem !important;
  flex-shrink: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
  --tw-shadow: 0 0 #0000 !important;
  border: none !important;
  border-radius: 1rem !important;
  overflow: visible !important;
}

.sidebar-logo img,
.sidebar-header .sidebar-logo img {
  display: block !important;
  height: 3.75rem !important;
  width: 3.75rem !important;
  min-height: 3.75rem !important;
  min-width: 3.75rem !important;
  object-fit: contain !important;
  background: transparent !important;
  border: none !important;
  border-radius: 1rem !important;
  box-shadow: 0 8px 20px rgba(20, 184, 166, 0.32) !important;
}

.sidebar-brand-title {
  font-family: var(--relaxlink-font) !important;
  font-weight: 800 !important;
  letter-spacing: -0.03em !important;
  font-size: 1.25rem !important;
}

.mb-8.text-center .text-sm.text-gray-500,
.mb-8.text-center .text-sm.dark\\:text-dark-400 {
  font-family: var(--relaxlink-font) !important;
}

/* Home page (/home) header nav logo */
header nav .h-10.w-10.overflow-hidden.rounded-xl.shadow-md {
  height: 5.5rem !important;
  width: 5.5rem !important;
  min-height: 5.5rem !important;
  min-width: 5.5rem !important;
  padding: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
  --tw-shadow: 0 0 #0000 !important;
  border: none !important;
  border-radius: 1rem !important;
  overflow: visible !important;
}

header nav .h-10.w-10.overflow-hidden.rounded-xl.shadow-md img {
  display: block !important;
  height: 5.5rem !important;
  width: 5.5rem !important;
  min-height: 5.5rem !important;
  min-width: 5.5rem !important;
  object-fit: contain !important;
  background: transparent !important;
  border: none !important;
  border-radius: 1rem !important;
  box-shadow: 0 10px 24px rgba(20, 184, 166, 0.35) !important;
}

/* Sidebar: Docs + Pricing below 仪表盘 (links live inside inner div) */
.sidebar-nav > div {
  display: flex !important;
  flex-direction: column !important;
}

.sidebar-nav > div > a.sidebar-link[href="/dashboard"] {
  order: 1 !important;
}

.sidebar-nav > div > a.sidebar-link[href="/custom/docs"] {
  order: 2 !important;
}

.sidebar-nav > div > a.sidebar-link[href="/custom/pricing"] {
  order: 3 !important;
}

.sidebar-nav > div > a.sidebar-link:not([href="/dashboard"]):not([href="/custom/docs"]):not([href="/custom/pricing"]) {
  order: 4 !important;
}

html[data-rl-locale="zh"] a.sidebar-link[href="/custom/docs"] > span.sidebar-label {
  font-size: 0 !important;
  line-height: 1.25rem;
}
html[data-rl-locale="zh"] a.sidebar-link[href="/custom/docs"] > span.sidebar-label::after {
  content: "使用指南";
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
}
html[data-rl-locale="zh"] a.sidebar-link.sidebar-link-collapsed[href="/custom/docs"] > span.sidebar-label::after {
  content: none;
}

/* Pricing tables (sidebar markdown + public page) */
.markdown-page-content table,
.custom-page-layout .markdown-page-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  table-layout: auto;
}

.markdown-page-content th,
.markdown-page-content td,
.custom-page-layout .markdown-page-content th,
.custom-page-layout .markdown-page-content td {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  vertical-align: middle;
}

.markdown-page-content th:first-child,
.markdown-page-content td:first-child,
.custom-page-layout .markdown-page-content th:first-child,
.custom-page-layout .markdown-page-content td:first-child {
  text-align: left !important;
}

.markdown-page-content th:not(:first-child):not(:last-child),
.markdown-page-content td:not(:first-child):not(:last-child),
.custom-page-layout .markdown-page-content th:not(:first-child):not(:last-child),
.custom-page-layout .markdown-page-content td:not(:first-child):not(:last-child) {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

.markdown-page-content th:last-child,
.markdown-page-content td:last-child,
.custom-page-layout .markdown-page-content th:last-child,
.custom-page-layout .markdown-page-content td:last-child {
  text-align: center !important;
}

.markdown-page-content thead th,
.custom-page-layout .markdown-page-content thead th {
  color: #94a3b8;
  font-weight: 600;
  white-space: nowrap;
}

.markdown-page-content tbody tr:hover td,
.custom-page-layout .markdown-page-content tbody tr:hover td {
  background: rgba(148, 163, 184, 0.06);
}

html.dark .markdown-page-content tbody tr:hover td,
html.dark .custom-page-layout .markdown-page-content tbody tr:hover td {
  background: rgba(148, 163, 184, 0.08);
}

/* Pricing iframe (sidebar embed — region-aware via nginx) */
.custom-embed-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: calc(100vh - 7rem);
}

.custom-embed-frame {
  flex: 1;
  width: 100%;
  min-height: calc(100vh - 8rem);
  border: none;
  background: transparent;
}

/* Sidebar pricing label: CN shows 模型定价, INTL keeps Pricing from config */
html[data-rl-locale="zh"] a.sidebar-link[href="/custom/pricing"] > span.sidebar-label {
  font-size: 0 !important;
  line-height: 1.25rem;
}
html[data-rl-locale="zh"] a.sidebar-link[href="/custom/pricing"] > span.sidebar-label::after {
  content: "模型定价";
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
}
html[data-rl-locale="zh"] a.sidebar-link.sidebar-link-collapsed[href="/custom/pricing"] > span.sidebar-label::after {
  content: none;
}

/* Sub2API CustomPageView hardcodes 目录 — translate TOC for INTL */
html[data-rl-region="intl"] .custom-page-layout .toc-title,
html.rl-intl .custom-page-layout .toc-title {
  font-size: 0 !important;
  line-height: 0 !important;
}
html[data-rl-region="intl"] .custom-page-layout .toc-title::after,
html.rl-intl .custom-page-layout .toc-title::after {
  content: "Contents";
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
}
html[data-rl-region="intl"] .custom-page-layout .toc-toggle-btn span.ml-1,
html.rl-intl .custom-page-layout .toc-toggle-btn span.ml-1 {
  font-size: 0 !important;
}
html[data-rl-region="intl"] .custom-page-layout .toc-toggle-btn span.ml-1::after,
html.rl-intl .custom-page-layout .toc-toggle-btn span.ml-1::after {
  content: "Contents";
  font-size: 0.75rem;
  line-height: 1rem;
}

/* Sub2API CustomPageView hardcodes 目录 — translate TOC for INTL */
html[data-rl-region="intl"] .custom-page-layout .toc-title,
html.rl-intl .custom-page-layout .toc-title {
  font-size: 0 !important;
  line-height: 0 !important;
}
html[data-rl-region="intl"] .custom-page-layout .toc-title::after,
html.rl-intl .custom-page-layout .toc-title::after {
  content: "Contents";
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
}
html[data-rl-region="intl"] .custom-page-layout .toc-toggle-btn span.ml-1,
html.rl-intl .custom-page-layout .toc-toggle-btn span.ml-1 {
  font-size: 0 !important;
}
html[data-rl-region="intl"] .custom-page-layout .toc-toggle-btn span.ml-1::after,
html.rl-intl .custom-page-layout .toc-toggle-btn span.ml-1::after {
  content: "Contents";
  font-size: 0.75rem;
  line-height: 1rem;
}

/* Recharge page: regional payment guide */
.rl-recharge-help {
  border-radius: 1rem;
  border: 1px solid rgba(20, 184, 166, 0.28);
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.1) 0%, rgba(6, 182, 212, 0.05) 100%);
  padding: 1rem 1.25rem;
}

html.dark .rl-recharge-help,
.dark .rl-recharge-help {
  border-color: rgba(45, 212, 191, 0.22);
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.14) 0%, rgba(6, 182, 212, 0.07) 100%);
}

.rl-recharge-help-inner {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.rl-recharge-help-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.rl-recharge-help-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #0f766e;
  margin: 0 0 0.5rem;
}

html.dark .rl-recharge-help-title,
.dark .rl-recharge-help-title {
  color: #5eead4;
}

.rl-recharge-help-list {
  margin: 0;
  padding-left: 1.125rem;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: #374151;
}

html.dark .rl-recharge-help-list,
.dark .rl-recharge-help-list {
  color: #d1d5db;
}

.rl-recharge-help-list li + li {
  margin-top: 0.25rem;
}

.rl-recharge-help-footer {
  margin: 0.625rem 0 0;
  font-size: 0.8125rem;
}

.rl-recharge-help-footer a {
  color: #0d9488;
  font-weight: 500;
  text-decoration: none;
}

.rl-recharge-help-footer a:hover {
  text-decoration: underline;
}

html.dark .rl-recharge-help-footer a,
.dark .rl-recharge-help-footer a {
  color: #2dd4bf;
}

/* User sidebar: hide channel + subscription (admin /admin/* unaffected) */
.sidebar-nav a.sidebar-link[href="/monitor"],
.sidebar-nav a.sidebar-link[href="/available-channels"],
.sidebar-nav a.sidebar-link[href="/subscriptions"],
.sidebar-nav a.sidebar-link[href="/orders"] {
  display: none !important;
}

/* Purchase nav: 充值 / Recharge (not 充值/订阅) */
html[data-rl-locale="zh"] a.sidebar-link[href="/purchase"] > span.sidebar-label {
  font-size: 0 !important;
  line-height: 1.25rem;
}
html[data-rl-locale="zh"] a.sidebar-link[href="/purchase"] > span.sidebar-label::after {
  content: "充值";
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
}
html[data-rl-locale="en"] a.sidebar-link[href="/purchase"] > span.sidebar-label {
  font-size: 0 !important;
  line-height: 1.25rem;
}
html[data-rl-locale="en"] a.sidebar-link[href="/purchase"] > span.sidebar-label::after {
  content: "Recharge";
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
}
html[data-rl-locale="zh"] a.sidebar-link.sidebar-link-collapsed[href="/purchase"] > span.sidebar-label::after,
html[data-rl-locale="en"] a.sidebar-link.sidebar-link-collapsed[href="/purchase"] > span.sidebar-label::after {
  content: none;
}

/* Home terminal: preserve colors/animation when content is replaced by relaxlink-region.js */
.terminal-body .code-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  opacity: 0;
  animation: rl-line-appear 0.5s ease forwards;
}
.terminal-body .line-1 { animation-delay: 0.3s; }
.terminal-body .line-2 { animation-delay: 1s; }
.terminal-body .line-3 { animation-delay: 1.8s; }
.terminal-body .line-4 { animation-delay: 2.5s; }
.terminal-body .line-5 { animation-delay: 3.1s; }
@keyframes rl-line-appear {
  0% { opacity: 0; transform: translateY(5px); }
  100% { opacity: 1; transform: translateY(0); }
}
.terminal-body .code-prompt { color: #22c55e; font-weight: 700; }
.terminal-body .code-cmd { color: #38bdf8; }
.terminal-body .code-flag { color: #a78bfa; }
.terminal-body .code-url { color: #14b8a6; }
.terminal-body .code-comment { color: #64748b; font-style: italic; }
.terminal-body .code-success {
  color: #22c55e; background: rgba(34, 197, 94, 0.15);
  padding: 2px 8px; border-radius: 4px; font-weight: 600;
}
.terminal-body .code-response { color: #fbbf24; }
.terminal-body .cursor {
  display: inline-block; width: 8px; height: 16px; background: #22c55e;
  animation: rl-cursor-blink 1s step-end infinite;
}
@keyframes rl-cursor-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Home provider badges → docs */
[data-rl-provider-link="1"] {
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
[data-rl-provider-link="1"]:hover {
  transform: translateY(-2px);
  border-color: rgba(20, 184, 166, 0.45) !important;
  box-shadow: 0 6px 16px rgba(20, 184, 166, 0.12);
}

/* Provider brand icons on home */
.rl-provider-icon {
  background: rgba(255, 255, 255, 0.95) !important;
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
html.dark .rl-provider-icon,
.dark .rl-provider-icon {
  background: rgba(30, 41, 59, 0.95) !important;
  border-color: rgba(148, 163, 184, 0.22);
}
.rl-provider-icon svg {
  display: block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
[data-rl-provider-link="1"] .rl-provider-icon {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
[data-rl-provider-link="1"]:hover .rl-provider-icon {
  transform: scale(1.06);
  box-shadow: 0 4px 12px rgba(20, 184, 166, 0.18);
}
/* Logo + provider icon load polish */
header img[data-rl-logo-opt="1"] {
  object-fit: contain;
  background: transparent;
}
.rl-provider-icon {
  opacity: 1;
}
.rl-provider-icon svg {
  display: block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-header[data-rl-home-link="1"] {
  transition: background-color 0.15s ease, opacity 0.15s ease;
}
.sidebar-header[data-rl-home-link="1"]:hover {
  background: rgba(20, 184, 166, 0.06);
}
.dark .sidebar-header[data-rl-home-link="1"]:hover {
  background: rgba(20, 184, 166, 0.1);
}
