/* =====================================================
   pages.css — Shared Design System for all dev-pages
   Aesthetic: Dark Industrial · Bebas Neue + IBM Plex Mono
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=IBM+Plex+Mono:wght@300;400;500;600;700&family=ZCOOL+XiaoWei&display=swap');

/* ===== Design Tokens ===== */
:root {
  --bg:            #0a0c0f;
  --bg-surface:    #0e1117;
  --bg-card:       #111620;
  --bg-card-hover: #161c2a;
  --bg-input:      #0d1118;

  --text:          #e8eaf0;
  --text-secondary:#8892a4;
  --text-muted:    #4a5568;

  --accent:        #f5a623;
  --accent-dim:    rgba(245, 166, 35, 0.12);
  --accent-glow:   rgba(245, 166, 35, 0.3);
  --accent-border: rgba(245, 166, 35, 0.35);

  --teal:          #00d9b4;
  --teal-dim:      rgba(0, 217, 180, 0.1);
  --blue:          #4d9fff;
  --blue-dim:      rgba(77, 159, 255, 0.1);
  --green:         #4ade80;
  --green-dim:     rgba(74, 222, 128, 0.1);
  --red:           #ff5555;
  --red-dim:       rgba(255, 85, 85, 0.1);
  --violet:        #a78bfa;
  --violet-dim:    rgba(167, 139, 250, 0.1);
  --pink:          #f472b6;
  --pink-dim:      rgba(244, 114, 182, 0.1);

  --border:        rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);

  --radius:        6px;
  --radius-sm:     4px;
  --radius-lg:     10px;

  --font-display:  'Bebas Neue', 'Impact', sans-serif;
  --font-mono:     'IBM Plex Mono', 'Courier New', monospace;
  --font-body:     'ZCOOL XiaoWei', 'Noto Serif SC', serif;

  --shadow-card:   0 4px 24px rgba(0,0,0,0.5);
  --shadow-btn:    0 2px 12px rgba(0,0,0,0.4);
  --transition:    0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ===== Base ===== */
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
  /* Subtle grid background */
  background-image:
    linear-gradient(rgba(245, 166, 35, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245, 166, 35, 0.025) 1px, transparent 1px);
  background-size: 40px 40px;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: #ffc555; }

/* ===== Page wrapper ===== */
.page-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

/* ===== Page Header ===== */
.page-header {
  padding: 36px 0 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
  position: relative;
}

.page-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 60px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

.page-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 16px;
  transition: color var(--transition);
}
.page-back:hover { color: var(--accent); }
.page-back::before { content: '←'; font-size: 13px; }

.page-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  padding: 4px 12px;
  border-radius: 2px;
  margin-bottom: 14px;
}

.page-eyebrow::before {
  content: '';
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 10px;
}

.page-title em {
  font-style: normal;
  color: var(--accent);
}

.page-subtitle {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 300;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
}

.page-subtitle code {
  font-family: var(--font-mono);
  color: var(--teal);
  background: var(--teal-dim);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
}

/* ===== Section / Panel ===== */
.p-section {
  margin-bottom: 28px;
  animation: fadeUp 0.4s ease both;
}

.p-section:nth-child(1) { animation-delay: 0.05s; }
.p-section:nth-child(2) { animation-delay: 0.12s; }
.p-section:nth-child(3) { animation-delay: 0.19s; }
.p-section:nth-child(4) { animation-delay: 0.26s; }
.p-section:nth-child(5) { animation-delay: 0.33s; }
.p-section:nth-child(6) { animation-delay: 0.40s; }
.p-section:nth-child(7) { animation-delay: 0.47s; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.p-section-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.p-section-title::before {
  content: '';
  width: 3px;
  height: 16px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

.p-section-title .sect-num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  opacity: 0.7;
  margin-left: auto;
}

.p-divider {
  height: 1px;
  background: linear-gradient(90deg, var(--accent-border), transparent 60%);
  margin: 6px 0 14px;
  opacity: 0.4;
}

/* ===== Card ===== */
.p-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}

/* ===== Button Grid ===== */
.p-btn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.p-btn-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

/* ===== Buttons ===== */
.p-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
}

.p-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(245,166,35,0.06) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
}

.p-btn:hover {
  border-color: var(--accent-border);
  color: var(--accent);
  box-shadow: 0 0 0 1px rgba(245,166,35,0.15), var(--shadow-btn);
  transform: translateY(-1px);
}
.p-btn:hover::before { opacity: 1; }
.p-btn:active { transform: translateY(0); }

/* Accent variant */
.p-btn-accent {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-dim);
}
.p-btn-accent:hover {
  background: rgba(245, 166, 35, 0.2);
  box-shadow: 0 0 16px var(--accent-glow);
}

/* Green / success */
.p-btn-green {
  border-color: rgba(74, 222, 128, 0.3);
  color: var(--green);
  background: var(--green-dim);
}
.p-btn-green:hover {
  background: rgba(74, 222, 128, 0.2);
  color: var(--green);
  border-color: rgba(74, 222, 128, 0.5);
}

/* Red / danger */
.p-btn-red {
  border-color: rgba(255, 85, 85, 0.3);
  color: var(--red);
  background: var(--red-dim);
}
.p-btn-red:hover {
  background: rgba(255, 85, 85, 0.2);
  color: var(--red);
  border-color: rgba(255, 85, 85, 0.5);
}

/* Blue / link */
.p-btn-blue {
  border-color: rgba(77, 159, 255, 0.3);
  color: var(--blue);
  background: var(--blue-dim);
}
.p-btn-blue:hover {
  background: rgba(77, 159, 255, 0.2);
  color: var(--blue);
  border-color: rgba(77, 159, 255, 0.5);
}

/* Teal */
.p-btn-teal {
  border-color: rgba(0, 217, 180, 0.3);
  color: var(--teal);
  background: var(--teal-dim);
}
.p-btn-teal:hover {
  background: rgba(0, 217, 180, 0.2);
  border-color: rgba(0, 217, 180, 0.5);
  color: var(--teal);
}

/* ===== Form Elements ===== */
.p-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.p-input,
.p-textarea,
.p-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  padding: 9px 12px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  resize: vertical;
  -webkit-appearance: none;
  appearance: none;
}

.p-input:focus,
.p-textarea:focus,
.p-select:focus {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.p-input::placeholder,
.p-textarea::placeholder { color: var(--text-muted); }

.p-select option {
  background: var(--bg-surface);
  color: var(--text);
}

.p-form-group {
  margin-bottom: 14px;
}

/* ===== UA Info Banner ===== */
.p-ua-banner {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 300;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--teal);
  padding: 10px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  word-break: break-all;
  line-height: 1.6;
  margin-bottom: 20px;
}

.p-ua-banner .ua-label {
  font-weight: 700;
  color: var(--teal);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 10px;
  display: block;
  margin-bottom: 4px;
}

/* ===== Console / Log Output ===== */
.p-console {
  background: #060810;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  min-height: 80px;
  max-height: 240px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 300;
  color: var(--green);
  line-height: 1.7;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.p-console:empty::after {
  content: '> ready.';
  color: var(--text-muted);
  opacity: 0.5;
}

.p-console::-webkit-scrollbar { width: 4px; }
.p-console::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

/* ===== Badge / Tag ===== */
.p-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid;
}

.p-badge-accent  { background: var(--accent-dim);   color: var(--accent);   border-color: var(--accent-border); }
.p-badge-teal    { background: var(--teal-dim);      color: var(--teal);     border-color: rgba(0,217,180,0.3); }
.p-badge-blue    { background: var(--blue-dim);      color: var(--blue);     border-color: rgba(77,159,255,0.3); }
.p-badge-green   { background: var(--green-dim);     color: var(--green);    border-color: rgba(74,222,128,0.3); }
.p-badge-red     { background: var(--red-dim);       color: var(--red);      border-color: rgba(255,85,85,0.3); }
.p-badge-violet  { background: var(--violet-dim);    color: var(--violet);   border-color: rgba(167,139,250,0.3); }

/* ===== Separator ===== */
.p-hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

.p-hr-accent {
  background: linear-gradient(90deg, var(--accent-border), transparent 50%);
  opacity: 0.5;
}

/* ===== CSS Demo Box (for chromium_test) ===== */
.p-demo-area {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}

/* ===== Toast / Popup (shared) ===== */
.p-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--accent-border);
  border-left: 3px solid var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 10px 20px;
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 9999;
  white-space: nowrap;
}
.p-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .page-wrap { padding: 0 16px 48px; }
  .page-header { padding: 28px 0 22px; }
  .p-btn-grid { grid-template-columns: 1fr 1fr; }
  .p-btn-grid-2 { grid-template-columns: 1fr; }
  .page-title { font-size: 28px; }
}

/* ===== QR Code Button (Floating) ===== */
.qr-btn {
  position: fixed;
  top: 50%;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--teal));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(245, 166, 35, 0.4);
  transition: all var(--transition);
  z-index: 9998;
  transform: translateY(-50%);
}

/* QR icon using CSS */
.qr-btn::before {
  content: '';
  width: 22px;
  height: 22px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Crect x='3' y='3' width='7' height='7'/%3E%3Crect x='14' y='3' width='7' height='7'/%3E%3Crect x='3' y='14' width='7' height='7'/%3E%3Crect x='14' y='14' width='3' height='3'/%3E%3Crect x='18' y='14' width='3' height='3'/%3E%3Crect x='14' y='18' width='3' height='3'/%3E%3Crect x='18' y='18' width='3' height='3'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

.qr-btn:hover {
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 6px 28px rgba(245, 166, 35, 0.6);
}

.qr-btn:active {
  transform: translateY(-50%) scale(0.95);
}

/* ===== QR Code Popup (悬浮层) ===== */
.qr-overlay {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 10000;
  pointer-events: none;
}

.qr-popup {
  position: fixed;
  top: 50%;
  right: 72px;
  transform: translateY(-50%);
  background: var(--bg-card);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  width: 280px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(245, 166, 35, 0.1);
  animation: qrSlideIn 0.25s cubic-bezier(0.34, 1.3, 0.64, 1) forwards;
  pointer-events: auto;
}

@keyframes qrSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50%) translateX(10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(-50%) translateX(0) scale(1);
  }
}

.qr-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-close:hover {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-dim);
}

.qr-title {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.1em;
  text-align: center;
  margin-bottom: 16px;
  color: var(--text);
}

.qr-canvas-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
  padding: 8px;
  background: #ffffff;
  border-radius: var(--radius-sm);
}

.qr-canvas-wrap canvas {
  display: block;
}

.qr-url {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 8px;
  border-radius: var(--radius-sm);
  word-break: break-all;
  line-height: 1.5;
  margin-bottom: 12px;
  max-height: 50px;
  overflow-y: auto;
}

.qr-copy-btn {
  width: 100%;
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
  background: var(--bg-surface);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.qr-copy-btn:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}
