/* VPP V1.0.1 Prototype - FranklinWH Connect Portal Style (匹配线上) */
:root {
  --bg-body: #f5f5f5;
  --bg-white: #ffffff;
  --bg-sidebar: #1a2332;
  --bg-sidebar-hover: #243040;
  --bg-topbar: #ffffff;
  --bg-input: #ffffff;
  --border: #e0e0e0;
  --border-light: #f0f0f0;
  --text-primary: #333333;
  --text-secondary: #666666;
  --text-muted: #999999;
  --accent: #e8952e;
  --accent-light: rgba(232,149,46,0.08);
  --accent-hover: #d4841f;
  --primary: #1890ff;
  --primary-light: rgba(24,144,255,0.08);
  --success: #52c41a;
  --success-light: rgba(82,196,26,0.08);
  --warning: #faad14;
  --warning-light: rgba(250,173,20,0.08);
  --danger: #ff4d4f;
  --danger-light: rgba(255,77,79,0.08);
  --radius: 4px;
  --radius-lg: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: var(--text-primary);
  background: var(--bg-body);
  line-height: 1.5;
  font-size: 14px;
}

/* Top Bar */
.topbar {
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.topbar .logo {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar .logo .brand { color: var(--accent); font-weight: 800; letter-spacing: 0.5px; }

.topbar .breadcrumb {
  margin-left: 24px;
  font-size: 13px;
  color: var(--text-muted);
}
.topbar .breadcrumb a { color: var(--text-secondary); text-decoration: none; }
.topbar .breadcrumb a:hover { color: var(--accent); }

/* Sidebar */
.sidebar {
  position: fixed;
  top: 48px; left: 0; bottom: 0;
  width: 64px;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  z-index: 100;
}

.sidebar .nav-item {
  width: 48px; height: 48px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  border-radius: var(--radius);
  color: #8899aa;
  font-size: 10px;
  text-decoration: none;
  margin-bottom: 4px;
  cursor: pointer;
  transition: all 0.2s;
}
.sidebar .nav-item:hover { background: var(--bg-sidebar-hover); color: #ffffff; }
.sidebar .nav-item.active { background: var(--bg-sidebar-hover); color: var(--accent); }
.sidebar .nav-item .icon { font-size: 18px; margin-bottom: 2px; }

/* Layout */
.layout-main {
  margin-left: 64px;
  margin-top: 48px;
  padding: 20px 24px;
  min-height: calc(100vh - 48px);
}

/* Page Header */
.page-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

/* Cards */
.card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}
.card-header h2 { font-size: 15px; font-weight: 600; }

/* Stats Row */
.stats-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  flex: 1;
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
}
.stat-card .stat-number { font-size: 28px; font-weight: 700; color: var(--text-primary); }
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); }
.stat-card .stat-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}

/* Table */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: var(--bg-body);
  padding: 10px 12px;
  text-align: left;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}
tbody tr:hover { background: var(--accent-light); }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.form-group label .required { color: var(--danger); }

.form-input {
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}
.form-input:focus { border-bottom-color: var(--accent); }
.form-input::placeholder { color: var(--text-muted); }

select.form-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}

textarea.form-input {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  resize: vertical;
  min-height: 60px;
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-white);
  color: var(--text-primary);
  transition: all 0.2s;
  text-decoration: none;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #ffffff; }

.btn-sm { padding: 4px 10px; font-size: 12px; }

/* Drawer / Modal */
.drawer-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3);
  z-index: 300;
  display: flex;
  justify-content: flex-end;
}

.drawer {
  width: 480px;
  background: var(--bg-white);
  height: 100%;
  overflow-y: auto;
  box-shadow: -4px 0 16px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
}

.drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-header h3 { font-size: 16px; font-weight: 600; }
.drawer-header .close-btn {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-muted);
}
.drawer-header .close-btn:hover { background: var(--bg-body); }

.drawer-body { padding: 20px; flex: 1; overflow-y: auto; }

.drawer-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Info banner in form */
.info-banner {
  background: var(--accent-light);
  border: 1px solid rgba(232,149,46,0.2);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.info-banner .icon { color: var(--accent); font-size: 14px; flex-shrink: 0; margin-top: 1px; }

/* Section title */
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 20px 0 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

/* Tags */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 12px;
  margin: 2px 4px 2px 0;
}
.tag .remove { cursor: pointer; opacity: 0.6; font-size: 12px; }
.tag .remove:hover { opacity: 1; }

/* Badge / Status */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
}
.badge-enabled { background: var(--success-light); color: var(--success); }
.badge-disabled { background: var(--danger-light); color: var(--danger); }
.badge-pending { background: var(--warning-light); color: #d48806; }
.badge-p1 { background: var(--danger-light); color: var(--danger); }
.badge-p2 { background: var(--warning-light); color: #d48806; }

/* Multi-select */
.multi-select {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 180px;
  overflow-y: auto;
  background: var(--bg-white);
}
.multi-select .option {
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
}
.multi-select .option:last-child { border-bottom: none; }
.multi-select .option:hover { background: var(--bg-body); }
.multi-select .option.selected { background: var(--primary-light); }
.multi-select .option input[type="checkbox"] { accent-color: var(--accent); }
.multi-select .option-special { background: var(--accent-light); border-bottom: 1px solid var(--border); font-weight: 500; }

/* Credential section */
.credential-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 8px;
  background: var(--bg-body);
}
.credential-box.disabled { opacity: 0.45; pointer-events: none; }
.credential-box .label-text { font-size: 12px; color: var(--text-secondary); margin-bottom: 10px; }

/* No credential notice */
.no-cred-notice {
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: 13px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  margin-top: 8px;
}

/* TBD warning */
.tbd-warning {
  background: #fff7e6;
  border: 1px solid #ffd591;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12px;
  color: #ad6800;
  margin-top: 10px;
}

/* Helper text for params */
.param-helper {
  font-size: 12px;
  color: #6B7280;
  line-height: 1.6;
  margin-top: 4px;
}

/* Image grid */
.image-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.image-item {
  position: relative;
  aspect-ratio: 16/10;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--border);
  cursor: pointer;
  background: var(--bg-body);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.image-item:hover { border-color: var(--accent); }
.image-item.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-light); }
.image-item.selected::after {
  content: '✓';
  position: absolute; top: 4px; right: 4px;
  width: 18px; height: 18px;
  background: var(--accent); color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
}
.image-item .placeholder { color: var(--text-muted); font-size: 11px; text-align: center; }
.image-item .placeholder .icon { font-size: 22px; display: block; margin-bottom: 2px; }

/* Upload area */
.upload-area {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.upload-area:hover { border-color: var(--accent); background: var(--accent-light); }

/* Use default button */
.use-default-btn {
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid rgba(232,149,46,0.3);
  border-radius: 3px;
  padding: 2px 8px;
  cursor: pointer;
  margin-left: 8px;
}
.use-default-btn:hover { background: rgba(232,149,46,0.15); }

/* Fill all button */
.fill-all-btn {
  background: var(--accent-light);
  border: 1px solid rgba(232,149,46,0.3);
  color: var(--accent);
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
}
.fill-all-btn:hover { background: rgba(232,149,46,0.15); }

/* Step indicator */
.step-bar {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 20px;
}
.step-item {
  display: flex; align-items: center;
}
.step-num {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  background: var(--bg-body);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.step-num.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.step-num.done { background: var(--success-light); color: var(--success); border-color: var(--success); }
.step-line { width: 20px; height: 1px; background: var(--border); }

/* V1.0.1 badge */
.v101-tag {
  background: var(--success-light);
  color: var(--success);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  margin-left: 6px;
}

/* Banner preview */
.banner-preview-card {
  background: var(--bg-body);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.banner-preview-card .title { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.banner-preview-card .desc { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; }
.banner-preview-card .cta-btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 4px 12px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 500;
}

/* Link style */
a.link { color: var(--accent); text-decoration: none; }
a.link:hover { text-decoration: underline; }


/* Language Switcher */
.lang-switch {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}
.lang-switch .lang-btn {
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
  background: #fff;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s;
}
.lang-switch .lang-btn:hover { border-color: var(--accent); color: var(--accent); }
.lang-switch .lang-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* i18n: hide elements based on data-lang */
[data-lang="en"] .zh-only { display: none !important; }
[data-lang="zh"] .en-only { display: none !important; }
