/* Shared prototype stylesheet.
   Baseline: workspace/prototypes/research.html.
   Keep this file aligned with context/design/DESIGN.md before creating new pages. */

:root {
  --fd-primary: #c41e2a;
  --fd-primary-dark: #a01820;
  --fd-primary-mid: #d03e4a;
  --fd-bg: #f5f5f5;
  --fd-bg-page: #f1f1f1;
  --fd-card: #fff;
  --fd-text: #333;
  --fd-text-secondary: #666;
  --fd-text-muted: #999;
  --fd-border: #e8e8e8;
  --fd-border-strong: #d9d9d9;
  --fd-table-head: #fafafa;
  --fd-table-spec-head: #eff3ff;
  --fd-accent-bg: #fff0f1;
  --fd-accent-bg-strong: #fff3f4;
  --fd-accent-border: #f3bbc0;
  --fd-radius: 4px;
  --fd-header-height: 56px;
  --fd-sidebar-width: 220px;
  --fd-tabs-height: 42px;
  --fd-workspace-padding: 16px;
  --fd-font: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  min-width: 1500px;
  font-family: var(--fd-font);
  font-size: 14px;
  color: var(--fd-text);
  background-color: var(--fd-bg);
  overflow-x: auto;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

.top-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--fd-header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: linear-gradient(135deg, var(--fd-primary) 0%, var(--fd-primary-dark) 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.logo-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  font-size: 18px;
}

.logo-text {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.main-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex: 1;
  min-width: 0;
}

.nav-item,
.main-nav a {
  position: relative;
  height: var(--fd-header-height);
  display: flex;
  align-items: center;
  padding: 0 16px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
}

.nav-item:hover,
.main-nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.nav-item.active,
.main-nav a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

.nav-item.active::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 0;
  height: 3px;
  background: #fff;
  border-radius: 2px 2px 0 0;
}

/* 顶部导航下拉菜单 */
.nav-item-dropdown {
  position: relative;
}

.nav-item-dropdown .dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 140px;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s;
  z-index: 1001;
}

.nav-item-dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu a {
  display: block;
  padding: 10px 16px;
  color: #333;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.3s;
}

.dropdown-menu a:hover {
  background: #f5f5f5;
  color: var(--fd-primary);
}

.user-section {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  flex-shrink: 0;
  white-space: nowrap;
}

.role-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.15);
  font-size: 13px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.15);
  cursor: pointer;
}

.user-avatar {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fd-primary);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  font-size: 12px;
}

.sidebar {
  position: fixed;
  left: 0;
  top: var(--fd-header-height);
  bottom: 0;
  z-index: 100;
  width: var(--fd-sidebar-width);
  background: #fff;
  border-right: 1px solid var(--fd-border);
  overflow-y: auto;
}

.menu-item {
  padding: 0;
  cursor: pointer;
  transition: all 0.3s;
}

.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  color: var(--fd-text);
  font-size: 14px;
  transition: all 0.3s;
}

.menu-header:hover {
  color: var(--fd-primary);
  background: #f5f5f5;
}

.menu-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.menu-icon {
  width: 18px;
  color: var(--fd-text-muted);
  text-align: center;
}

.menu-arrow {
  color: var(--fd-text-muted);
  font-size: 12px;
  transition: transform 0.3s;
}

.menu-item.expanded > .menu-header .menu-arrow {
  transform: rotate(90deg);
}

.submenu {
  max-height: 0;
  overflow: hidden;
  background: #fafafa;
  transition: max-height 0.3s ease;
}

.menu-item.expanded > .submenu {
  max-height: 600px;
}

.menu-item.no-header > .submenu {
  max-height: none;
  background: #fff;
}

.menu-item.no-header .submenu-item-content,
.menu-item.no-header .submenu-item a {
  padding-left: 20px;
}

.menu-item.no-header .submenu-item-content::before {
  margin-right: 10px;
}

.submenu-item {
  color: var(--fd-text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s;
}

.submenu-item-content,
.submenu-item a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 10px 44px;
  color: inherit;
  text-decoration: none;
}

.submenu-item:hover,
.submenu-item a:hover {
  color: var(--fd-primary);
  background: #f0f0f0;
}

.submenu-item.active {
  color: var(--fd-primary);
  background: var(--fd-accent-bg);
}

.submenu-item-content::before {
  content: "";
  width: 4px;
  height: 4px;
  flex: 0 0 auto;
  background: #ccc;
  border-radius: 50%;
}

.submenu-item.active .submenu-item-content::before {
  background: var(--fd-primary);
}

.submenu-item.has-children .submenu-item-content span {
  flex: 1;
}

.submenu-item.has-children .menu-arrow {
  margin-left: auto;
  color: var(--fd-text-muted);
  font-size: 10px;
  transition: transform 0.3s;
}

.submenu-item.has-children.expanded .menu-arrow {
  transform: rotate(90deg);
}

.third-level-menu {
  max-height: 0;
  overflow: hidden;
  background: #f5f5f5;
  transition: max-height 0.3s ease;
}

.submenu-item.has-children.expanded .third-level-menu {
  max-height: 200px;
}

.third-level-item,
.third-level-menu a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px 8px 60px;
  color: var(--fd-text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
}

.third-level-item::before {
  content: "";
  width: 3px;
  height: 3px;
  background: #ccc;
  border-radius: 50%;
}

.third-level-item:hover {
  color: var(--fd-primary);
  background: #ebebeb;
}

.third-level-item.active {
  color: var(--fd-primary);
  background: var(--fd-accent-bg);
}

.third-level-item.active::before {
  background: var(--fd-primary);
}

.main-content {
  margin-left: var(--fd-sidebar-width);
  margin-top: var(--fd-header-height);
  padding: var(--fd-workspace-padding);
  min-height: calc(100vh - var(--fd-header-height));
}

/* Tabs Bar - 面包屑导航 */
.tabs-bar {
  position: fixed;
  top: var(--fd-header-height);
  left: var(--fd-sidebar-width);
  right: 0;
  z-index: 700;
  height: var(--fd-tabs-height);
  display: flex;
  align-items: center;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tabs-bar .hamburger {
  width: 50px;
  height: 41px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--fd-border-strong);
  color: #1f2329;
  cursor: pointer;
}

.tabs-bar .tab {
  height: 41px;
  min-width: 131px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  border-right: 1px solid var(--fd-border-strong);
  color: var(--fd-text);
  font-size: 14px;
  font-weight: 500;
  background: #fff;
}

/* 返回按钮组件 */
.back-bar {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 20px;
  margin-bottom: 14px;
  background: #fff;
  border-radius: var(--fd-radius);
  font-size: 18px;
  color: var(--fd-text);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s;
}

.back-bar:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.back-icon {
  width: 20px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #333;
  border-right: 1px solid #dcdfe6;
  padding-right: 16px;
  box-sizing: content-box;
}

.search-card {
  background: #fff;
  border-radius: var(--fd-radius);
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  margin-bottom: 14px;
}

.table-card {
  background: #fff;
  border-radius: var(--fd-radius);
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.search-form {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* 搜索操作按钮容器 - 强制右对齐 */
.search-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.form-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-label {
  color: var(--fd-text);
  font-size: 14px;
  white-space: nowrap;
}

.form-input,
.form-select,
.form-textarea {
  border: 1px solid var(--fd-border-strong);
  border-radius: var(--fd-radius);
  color: var(--fd-text);
  background: #fff;
  font-size: 14px;
  transition: all 0.3s;
}

.form-input,
.form-select {
  height: 32px;
  padding: 0 12px;
}

.form-input {
  width: 280px;
}

.form-textarea {
  min-height: 64px;
  padding: 10px 12px;
  resize: vertical;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--fd-primary);
  box-shadow: 0 0 0 2px rgba(196, 30, 42, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: #bfbfbf;
}

.btn {
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 20px;
  border: none;
  border-radius: var(--fd-radius);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-default {
  color: var(--fd-text-secondary);
  background: #fff;
  border: 1px solid var(--fd-border-strong);
}

.btn-default:hover {
  color: var(--fd-primary);
  border-color: var(--fd-primary);
}

.btn-primary {
  color: #fff;
  background: var(--fd-primary);
  border: 1px solid var(--fd-primary);
}

.btn-primary:hover {
  background: var(--fd-primary-dark);
  border-color: var(--fd-primary-dark);
}

.btn-add,
.btn-secondary-red {
  color: var(--fd-primary);
  background: var(--fd-accent-bg);
  border: 1px solid var(--fd-accent-border);
}

.btn-add:hover,
.btn-secondary-red:hover {
  color: #fff;
  background: var(--fd-primary);
}

.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  padding: 12px 16px;
  color: var(--fd-text);
  background: var(--fd-table-head);
  border-bottom: 1px solid var(--fd-border);
  text-align: left;
  font-weight: 500;
}

.data-table td {
  padding: 12px 16px;
  color: var(--fd-text-secondary);
  border-bottom: 1px solid #f0f0f0;
}

.data-table tr:hover td {
  background: #fafafa;
}

.data-table .cell-content {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--fd-radius);
  font-size: 12px;
}

.status-success {
  color: #52c41a;
  background: #f6ffed;
  border: 1px solid #b7eb8f;
}

.link-text {
  color: var(--fd-primary);
  cursor: pointer;
}

.link-text:hover {
  text-decoration: underline;
}

.pagination-wrapper {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #f0f0f0;
}

.pagination-info {
  margin-right: 16px;
  color: var(--fd-text-muted);
  font-size: 14px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-btn {
  min-width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  color: var(--fd-text-secondary);
  background: #fff;
  border: 1px solid var(--fd-border-strong);
  border-radius: var(--fd-radius);
  cursor: pointer;
  transition: all 0.3s;
}

.page-btn:hover {
  color: var(--fd-primary);
  border-color: var(--fd-primary);
}

.page-btn.active {
  color: #fff;
  background: var(--fd-primary);
  border-color: var(--fd-primary);
}

.page-btn.disabled {
  color: #d9d9d9;
  cursor: not-allowed;
}

.page-size-selector,
.page-jump {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 16px;
  color: var(--fd-text-secondary);
  font-size: 14px;
}

.page-size-dropdown {
  padding: 4px 8px;
  border: 1px solid var(--fd-border-strong);
  border-radius: var(--fd-radius);
  background: #fff;
  cursor: pointer;
}

.page-jump-input {
  width: 50px;
  height: 32px;
  border: 1px solid var(--fd-border-strong);
  border-radius: var(--fd-radius);
  text-align: center;
}

/* 页面主体区域标题 - 用于表单页面 */
.main-content .section-title {
  margin: 0 0 20px;
  padding: 0 0 12px 5px;
  color: var(--fd-text);
  border-bottom: 1px solid #f1f1f1;
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 150px minmax(0, 1fr);
  gap: 14px 16px;
  align-items: center;
}

.form-grid .form-label {
  justify-self: end;
  font-weight: 600;
}

.required {
  color: #ff4d4f;
  margin-right: 6px;
}

.empty-cell {
  color: var(--fd-text-muted);
  text-align: center;
}

/* ── Modal ────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.45);
  justify-content: center;
  align-items: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-dialog {
  width: 520px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--fd-text);
}

.modal-close {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: #999;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.2s;
}

.modal-close:hover {
  background: #f5f5f5;
  color: #333;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid #f0f0f0;
}

/* ── Modal size variants ──────────────── */
.modal-dialog-sm {
  width: 480px;
}

.modal-dialog-lg,
.detail-dialog {
  width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.modal-dialog-lg .modal-body,
.detail-dialog .modal-body {
  overflow-y: auto;
  flex: 1;
}

/* ── Detail dialog content ────────────── */
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
  color: var(--fd-text-secondary);
}

.detail-meta--vertical {
  flex-direction: column;
  gap: 8px;
}

.detail-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-meta-item--full {
  flex: 0 0 100%;
  min-width: 100%;
}

.detail-meta-label {
  color: var(--fd-text-muted);
}

.detail-content {
  font-size: 14px;
  line-height: 1.8;
  color: var(--fd-text);
  white-space: pre-wrap;
}

/* ── Modal description ─────────────────── */
.modal-desc {
  color: var(--fd-text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}

.modal-desc strong {
  color: var(--fd-text);
  font-weight: 600;
}

/* ── Status tag variants ───────────────── */
.status-published {
  background: #e6f7ff;
  color: #1890ff;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  display: inline-block;
}

.status-draft {
  background: #fff7e6;
  color: #fa8c16;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  display: inline-block;
}

.status-offline {
  background: #f5f5f5;
  color: #999;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  display: inline-block;
}

.status-processing {
  color: #1890ff;
  background: #e6f7ff;
  border: 1px solid #91d5ff;
  padding: 2px 8px;
  border-radius: var(--fd-radius);
  font-size: 12px;
  display: inline-block;
}

.status-warning {
  color: #fa8c16;
  background: #fff7e6;
  border: 1px solid #ffd591;
  padding: 2px 8px;
  border-radius: var(--fd-radius);
  font-size: 12px;
  display: inline-block;
}

.status-error {
  color: #ff4d4f;
  background: #fff2f0;
  border: 1px solid #ffccc7;
  padding: 2px 8px;
  border-radius: var(--fd-radius);
  font-size: 12px;
  display: inline-block;
}

/* ── Operation links ────────────────────── */
.op-links {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.op-links a {
  color: var(--fd-primary);
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}

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

.op-links .sep {
  color: #e0e0e0;
  font-size: 12px;
}

/* ── Form row (modal forms) ─────────────── */
.form-row {
  margin-bottom: 16px;
}

.form-row:last-child {
  margin-bottom: 0;
}

.form-row label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--fd-text);
}

.form-row .required::after {
  content: " *";
  color: #ff4d4f;
}

.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  font-size: 14px;
  color: var(--fd-text);
  outline: none;
  transition: border-color 0.2s;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  border-color: var(--fd-primary);
}

.form-row textarea {
  height: 120px;
  padding: 10px 12px;
  resize: vertical;
}

.form-row .radio-group {
  display: flex;
  align-items: center;
  gap: 20px;
}

.form-row .radio-group label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: normal;
  margin-bottom: 0;
  font-size: 14px;
  cursor: pointer;
}

.form-row .radio-group input[type="radio"] {
  width: auto;
  height: auto;
}

.form-row .expiry-input {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-row .expiry-input input {
  width: 120px;
}

/* ── Main content with tabs ─────────────── */
.main-content.has-tabs {
  margin-top: calc(var(--fd-header-height) + var(--fd-tabs-height));
}
