/* ===== YCCY Custom Theme - 云创次元科技蓝 ===== */

/* Force dark colors on light theme */
.light {
  --background: 222 47% 6% !important;
  --foreground: 210 40% 96% !important;
  --card: 222 47% 9% !important;
  --card-foreground: 210 40% 96% !important;
  --popover: 222 47% 9% !important;
  --popover-foreground: 210 40% 96% !important;
  --primary: 217 91% 60% !important;
  --primary-foreground: 0 0% 100% !important;
  --secondary: 217 33% 14% !important;
  --secondary-foreground: 210 40% 90% !important;
  --muted: 217 33% 14% !important;
  --muted-foreground: 215 20% 65% !important;
  --accent: 217 33% 17% !important;
  --accent-foreground: 210 40% 96% !important;
  --destructive: 0 63% 31% !important;
  --border: 217 33% 17% !important;
  --input: 217 33% 17% !important;
  --ring: 217 91% 60% !important;
  --sidebar: 222 47% 7% !important;
  --sidebar-foreground: 210 40% 90% !important;
  --sidebar-primary: 217 91% 60% !important;
  --sidebar-primary-foreground: 0 0% 100% !important;
  --sidebar-accent: 217 33% 14% !important;
  --sidebar-accent-foreground: 210 40% 96% !important;
  --sidebar-border: 217 33% 14% !important;
  --sidebar-ring: 217 91% 60% !important;
  color-scheme: dark !important;
}

/* Body & base */
body {
  background-color: hsl(222 47% 6%) !important;
  color: hsl(210 40% 96%) !important;
}

/* Glass header */
header {
  backdrop-filter: blur(16px) !important;
  background: rgba(10, 14, 26, 0.85) !important;
  border-bottom: 1px solid rgba(59, 130, 246, 0.12) !important;
}

/* Sidebar */
aside, [data-sidebar="sidebar"] {
  background: rgba(10, 14, 26, 0.95) !important;
  border-right: 1px solid rgba(59, 130, 246, 0.1) !important;
}

/* Cards */
[class*="card"] {
  background: hsl(222 47% 9%) !important;
  border-color: rgba(59, 130, 246, 0.12) !important;
}

/* Tables */
table, [class*="table"] {
  background: hsl(222 47% 9%) !important;
}

/* Input fields */
input, select, textarea {
  background: hsl(217 33% 14%) !important;
  color: hsl(210 40% 96%) !important;
  border-color: hsl(217 33% 17%) !important;
}

/* Hide search boxes */
header form { display: none !important; }
header kbd { display: none !important; }
header button:has(kbd) { display: none !important; }
div:has(> input[placeholder^="\641C\7D22"]) { display: none !important; }

/* Blue glow on primary buttons */
button[class*="primary"] {
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.25) !important;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: hsl(222 47% 6%); }
::-webkit-scrollbar-thumb { background: rgba(59,130,246,0.3); border-radius: 3px; }

/* ===== Fix card gradient overlay color inconsistency ===== */
[class*="from-background"] { display: none !important; }
.bg-card > .pointer-events-none.absolute { display: none !important; }

/* ===== Particle canvas & gradient orbs ===== */
#yccy-particles {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 0;
}
.yccy-orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}
.yccy-orb-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(59,130,246,0.18) 0%, transparent 70%);
  top: -120px; right: -80px;
  animation: yccy-float1 18s ease-in-out infinite alternate;
}
.yccy-orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(139,92,246,0.14) 0%, transparent 70%);
  bottom: -80px; left: -60px;
  animation: yccy-float2 22s ease-in-out infinite alternate;
}
@keyframes yccy-float1 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-40px, 30px) scale(1.1); }
}
@keyframes yccy-float2 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(30px, -40px) scale(1.15); }
}

/* Keep content above effects */
#root { position: relative; z-index: 1; }

/* ===== FIX: Radix UI portals must render above #root ===== */
[data-radix-portal],
[data-radix-popper-content-wrapper],
[data-radix-menu-content],
[data-radix-popover-content],
[data-radix-dialog-overlay],
[data-radix-dialog-content],
[data-radix-dropdown-menu-content],
[data-radix-select-content],
[data-radix-toast-viewport] {
  z-index: 9999 !important;
}

/* ===== FIX: Table horizontal scroll (targeted) ===== */
/* Only target the direct table wrapper, not all overflow elements */
main [class*="rounded"][class*="border"] {
  overflow-x: auto !important;
}

/* ===== Page header: transparent bg, no hard-edged rectangle ===== */
header:not([class*="fixed"]) {
  background: transparent !important;
  border-bottom: none !important;
}

/* ===== Remove gray/warm tint on 剩余额度 panel ===== */
[class*="bg-warning/10"] {
  background-color: transparent !important;
}

/* ===== Hide terminal icon badge in 首个 API 请求 card ===== */
.bg-muted:has(> svg.lucide-square-terminal) {
  display: none !important;
}

/* ===== FIX: Dropdown/popover transparent background ===== */
/* App theme overrides --popover with color-mix() which breaks hsl(var(--popover)).
   Force explicit background on all popover/dropdown elements. */
.bg-popover,
[data-radix-menu-content],
[data-radix-popover-content],
[data-radix-dropdown-menu-content],
[data-radix-select-content],
[role="menu"],
[role="listbox"] {
  background-color: hsl(222 47% 9%) !important;
  border-color: hsl(217 33% 17%) !important;
  color: hsl(210 40% 96%) !important;
}

/* Dropdown menu items hover state */
[role="menuitem"]:hover,
[role="menuitem"]:focus {
  background-color: hsl(217 33% 14%) !important;
}



/* ===== YCCY QR Card (aligned + dark QR) ===== */
.yccy-qr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid hsl(217 33% 20%);
  background: hsl(222 47% 10%);
  width: 100%;
  height: 100%;
  min-height: 200px;
  text-align: center;
  box-sizing: border-box;
}
.yccy-qr-top {
  font-size: 0.95rem;
  font-weight: 600;
  color: hsl(210 40% 92%);
  margin-bottom: 1rem;
  letter-spacing: 0.04em;
}
.yccy-qr-img-wrap {
  padding: 8px;
  border-radius: 10px;
  background: hsl(222 47% 13%);
  border: 1px solid hsl(217 33% 22%);
  line-height: 0;
  cursor: pointer;
  transition: box-shadow 0.2s;
}
.yccy-qr-img-wrap:hover {
  box-shadow: 0 0 18px rgba(96,165,250,0.25);
}
.yccy-qr-img {
  width: 150px;
  height: 150px;
  object-fit: contain;
  border-radius: 4px;
  filter: invert(1) sepia(0.12) saturate(0.7) brightness(1.05);
}
.yccy-qr-bottom {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: hsl(215 20% 60%);
}
/* Lightbox overlay */
.yccy-qr-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.yccy-qr-lightbox img {
  width: 300px;
  height: 300px;
  object-fit: contain;
  border-radius: 12px;
  background: hsl(222 47% 12%);
  padding: 14px;
  border: 1px solid hsl(217 33% 25%);
  filter: invert(1) sepia(0.12) saturate(0.7) brightness(1.05);
  box-shadow: 0 0 40px rgba(96,165,250,0.2);
}

/* ===== YCCY 用户端配置 guide (replaces 首个 API 请求) ===== */
.yccy-cfg {
  display: flex;
  flex-direction: column;
  height: 100%;
  box-sizing: border-box;
}
.yccy-cfg-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: hsl(210 40% 96%);
  margin-bottom: 1rem;
}
.yccy-cfg-steps {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  flex: 1;
}
.yccy-cfg-step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: 0.6rem;
  border: 1px solid hsl(217 33% 18%);
  background: hsl(222 47% 12%);
}
.yccy-cfg-num {
  flex: 0 0 auto;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: hsl(217 91% 60% / 0.15);
  color: hsl(217 91% 72%);
  font-size: 0.8rem;
  font-weight: 700;
}
.yccy-cfg-body {
  flex: 1 1 auto;
  min-width: 0;
}
.yccy-cfg-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: hsl(210 40% 92%);
  margin-bottom: 0.15rem;
}
.yccy-cfg-value {
  font-size: 0.74rem;
  color: hsl(215 20% 62%);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
}
.yccy-cfg-btn {
  flex: 0 0 auto;
  padding: 0.35rem 0.8rem;
  border-radius: 0.5rem;
  border: 1px solid hsl(217 33% 28%);
  background: hsl(222 47% 16%);
  color: hsl(210 40% 92%);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  display: inline-flex;
  align-items: center;
  line-height: 1.2;
}
.yccy-cfg-btn:hover {
  border-color: hsl(217 91% 60%);
  color: hsl(217 91% 78%);
  background: hsl(217 91% 60% / 0.1);
}
.yccy-cfg-btn-ok {
  border-color: hsl(160 84% 39%);
  color: hsl(160 84% 62%);
  background: hsl(160 84% 39% / 0.1);
}
