/* 全局样式 - 强制覆盖fp/style.css的所有布局 */
html, body {
  margin: 0 !important;
  padding: 0 !important;
  padding-top: 10px !important;
  height: auto !important;
  min-height: auto !important;
  overflow-y: auto !important;
  box-sizing: border-box !important;
  display: block !important;
  flex-direction: initial !important;
  align-items: initial !important;
}

/* 强制修复main标签样式 - 完全防止flex拉伸 */
main, #main-content {
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: auto !important;
  height: auto !important;
  flex-shrink: 0 !important;
  flex-grow: 0 !important;
}

/* Grid布局样式 - 完全修复底部空白 */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 22px;
  padding: 0 5vw 0;
  position: relative;
  z-index: 1;
  max-height: none;
  overflow: visible;
}

* {
  margin-top: 0 !important;
  box-sizing: border-box;
}

/* 登录界面样式 */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.login-container {
  background: var(--panel-bg);
  border-radius: 12px;
  padding: 40px;
  width: 90%;
  max-width: 400px;
  margin: 0 auto;
  border: 1px solid var(--divider);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-header h2 {
  margin: 0 0 10px 0;
  color: var(--text-main);
}

.login-header p {
  margin: 0;
  color: var(--text-subtle);
  font-size: 0.9rem;
}

.login-form {
  display: flex;
  flex-direction: column;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-main);
  font-weight: 600;
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--divider);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-main);
  font-size: 1rem;
}

.form-group select {
  padding: 8px 12px;
  border: 1px solid var(--divider);
  border-radius: 8px;
  background: var(--panel-bg);
  color: var(--text-main);
  font-size: 0.9rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.2);
}

.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(60, 66, 86, 0.7);
}

/* 固定头部样式 */
.fixed-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(40, 43, 56, 0.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--divider);
}

.fixed-header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 15px 20px;
}

/* Hero 区域样式 - 完全移除，不占用空间 */
.hero {
  display: none;
}

.hero__content {
  display: none;
}

/* 主内容区域样式 */
.main-content {
  position: relative;
  z-index: 1;
  margin: 0 auto;
  max-width: 1200px;
  padding: 20px;
  box-sizing: border-box;
  min-height: auto;
}





/* 用户信息样式统一使用 materials.css */
}

.btn-icon {
  margin-right: 4px;
}



/* PDF合并内容布局 - 修复底部空白 */
.merge-content-layout {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) 2fr;
  gap: 24px;
  align-items: stretch;
  min-height: auto;
  max-height: none;
  overflow: visible;
}

/* 布局设置样式 */
.layout-settings {
  background: rgba(40, 43, 56, 0.7);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 16px;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  max-height: calc(100vh - 140px);
}

/* 标签页样式 */
.preview-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tab-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-subtle);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  background: rgba(60, 66, 86, 0.5);
  color: var(--text-main);
}

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

.tab-content {
  display: none;
  height: 100%;
}

.tab-content.active {
  display: block;
}

.fault-details-panel {
  flex: 1;
  overflow-y: auto;
  min-height: 400px;
  max-height: 100%;
}

/* 故障详情滚动条样式 */
.fault-details-panel::-webkit-scrollbar {
  width: 8px;
}

.fault-details-panel::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

.fault-details-panel::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.5);
  border-radius: 4px;
}

.fault-details-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.7);
}

.file-operations .dropzone {
  margin-bottom: 0;
}

.file-operations .file-list-wrapper {
  margin-bottom: 20px;
}

.file-operations .merge-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.file-operations .btn {
  width: 100%;
  justify-content: center;
}

.file-operations .btn-icon {
  margin-right: 8px;
}

.layout-settings h3 {
  font-size: 1.1rem;
  margin: 0 0 16px 0;
  color: var(--text-main);
}

.preset-modes {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--divider);
}

.preset-modes .setting-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.preset-modes label {
  font-weight: 600;
  color: var(--text-main);
  flex-shrink: 0;
  margin-right: 8px;
}

.preset-modes select {
  padding: 8px 12px;
  border: 1px solid var(--divider);
  border-radius: 8px;
  background: var(--panel-bg);
  color: var(--text-main);
  font-size: 0.9rem;
  min-width: 150px;
}

.layout-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-item label {
  font-size: 0.9rem;
  color: var(--text-subtle);
  font-weight: 500;
}

.setting-item select,
.setting-item input[type="text"],
.setting-item input[type="number"] {
  padding: 8px 12px;
  border: 1px solid var(--divider);
  border-radius: 8px;
  background: var(--panel-bg);
  color: var(--text-main);
  font-size: 0.9rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.setting-item select:focus,
.setting-item input[type="text"]:focus,
.setting-item input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(60, 66, 86, 0.7);
}

.form-actions {
  display: flex;
  gap: 15px;
  justify-content: flex-end;
}

/* 布局预览样式 */
.layout-preview {
  background: rgba(40, 43, 56, 0.7);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

.layout-preview .preview-container {
  border: 1px solid var(--divider);
  border-radius: 12px;
  background: rgba(28, 30, 40, 0.8);
  padding: 16px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  max-height: 100%;
}

/* 确保搜索结果和详情面板有固定高度限制 */
#search-results,
.fault-details-panel {
  max-height: 100%;
  overflow-y: auto;
}

.preview-pages {
  max-height: 100%;
  overflow-y: auto;
}

/* 搜索结果滚动条样式 */
.preview-container::-webkit-scrollbar {
  width: 8px;
}

.preview-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

.preview-container::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.5);
  border-radius: 4px;
}

.preview-container::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.7);
}

.preview-pages {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
}

/* 搜索结果样式 */
#search-results {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.result-item {
  background: rgba(0, 0, 0, 0.03);
  border-radius: 8px;
  padding: 15px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border: 1px solid transparent;
}

.result-item:hover {
  background: rgba(var(--primary-rgb), 0.1);
  border: 1px solid var(--primary);
}

.result-item h4 {
  margin: 0 0 10px 0;
  color: var(--primary);
  font-size: 1.1rem;
}

.result-item p {
  margin: 0;
  color: var(--text-subtle);
}

/* 故障详情样式 */
.fault-details-panel {
  background: var(--panel-bg);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--divider);
  overflow-y: auto;
}

.fault-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-group {
  background: rgba(0, 0, 0, 0.03);
  border-radius: 8px;
  padding: 15px;
}

.detail-group h4 {
  margin: 0 0 10px 0;
  color: var(--primary);
  border-bottom: 1px solid var(--divider);
  padding-bottom: 5px;
}

.detail-row {
  display: flex;
  margin-bottom: 8px;
}

.detail-label {
  font-weight: 600;
  color: var(--text-main);
  width: 100px;
  flex-shrink: 0;
}

.detail-value {
  color: var(--text-subtle);
  word-break: break-word;
  white-space: normal;
}

/* 预览空状态样式 */
.preview-empty {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--divider);
  color: var(--text-subtle);
  opacity: 0.5;
  padding: 40px 20px;
  text-align: center;
  border-radius: 8px;
}

.preview-empty p {
  margin: 0;
}

/* 加载状态样式 */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  color: var(--text-subtle);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(var(--primary-rgb), 0.2);
  border-top: 2px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 10px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 日志显示样式 */
.log-display {
  max-height: 400px !important;
  overflow-y: auto !important;
}

.log-content {
  max-height: 360px !important;
  overflow-y: auto !important;
}

.log-item {
  padding: 4px 0 !important;
}

/* 日志滚动条样式 */
.log-display::-webkit-scrollbar,
.log-content::-webkit-scrollbar {
  width: 4px;
}

.log-display::-webkit-scrollbar-track,
.log-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.log-display::-webkit-scrollbar-thumb,
.log-content::-webkit-scrollbar-thumb {
  background: rgba(255,255, 255, 0.3);
  border-radius: 2px;
}

.log-display::-webkit-scrollbar-thumb:hover,
.log-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* 小屏幕适配 */
@media (max-width: 1200px) {
  .merge-content-layout {
    grid-template-columns: 1fr;
    gap: 20px;
    height: auto;
    min-height: 300px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
  }

  .layout-settings {
    height: auto;
    min-height: 0;
    max-height: 60vh;
    overflow-y: auto;
  }

  .layout-preview {
    height: auto;
    min-height: 400px;
    max-height: 60vh;
  }

  .preview-container {
    max-height: 50vh;
    overflow-y: auto;
  }

  .fault-details-panel {
    max-height: 60vh;
    overflow-y: auto;
    min-height: 300px;
  }
}

/* 移动端适配 */
@media (max-width: 768px) {
  .log-display {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
    font-size: 0.85rem;
  }

  .merge-content-layout {
    height: auto;
    min-height: 300px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
  }

  .layout-settings {
    max-height: 50vh;
  }

  .layout-preview {
    max-height: 50vh;
  }

  .preview-container {
    max-height: 40vh;
  }

  .fault-details-panel {
    max-height: 50vh;
    min-height: 300px;
  }
}

/* ============ 统计页面样式 ============ */

/* 隐藏元素 */
#search-results,
#fault-details,
#app-content {
  display: none;
}

/* 显示元素 */
#search-results.show,
#fault-details.show,
#app-content.show {
  display: block;
}

/* 统计卡片网格布局 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

/* 统计卡片样式 */
.stat-card {
  background: rgba(40, 43, 56, 0.7);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 24px;
  transition: all 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  border-color: var(--primary);
}

.stat-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: rgba(var(--primary-rgb), 0.1);
}

.stat-card-title {
  font-size: 1rem;
  color: var(--text-subtle);
  font-weight: 500;
}

.stat-card-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.stat-card-subtitle {
  font-size: 0.85rem;
  color: var(--text-subtle);
}

.stat-card-subtitle span {
  color: var(--text-main);
  font-weight: 600;
}

.comparison-text {
  display: block;
  font-size: 0.75rem;
  margin-top: 4px;
  font-weight: 500;
}

.comparison-up {
  color: #22c55e;
}

.comparison-down {
  color: #ef4444;
}

.comparison-neutral {
  color: var(--text-subtle);
}

/* 时间筛选器样式 */
.time-filter {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.time-filter button {
  padding: 10px 20px;
  border: 1px solid var(--divider);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-subtle);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.time-filter button:hover {
  background: rgba(60, 66, 86, 0.5);
  color: var(--text-main);
}

.time-filter button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* 统计表格样式 */
.stats-table-container {
  background: rgba(40, 43, 56, 0.7);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 24px;
  overflow-x: auto;
}

.stats-table-title {
  font-size: 1.2rem;
  color: var(--text-main);
  margin: 0 0 20px 0;
  font-weight: 600;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
}

.stats-table th,
.stats-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--divider);
}

.stats-table th {
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-subtle);
  font-weight: 600;
  font-size: 0.9rem;
}

.stats-table td {
  color: var(--text-main);
}

.stats-table tbody tr:hover {
  background: rgba(var(--primary-rgb), 0.1);
}

.stats-table .trend-up {
  color: var(--primary);
}

.stats-table .trend-down {
  color: #ef4444;
}

.stats-table .trend-neutral {
  color: var(--text-subtle);
}

/* 图表容器 */
.charts-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.chart-box {
  background: rgba(40, 43, 56, 0.7);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 24px;
}

.chart-box h3 {
  margin: 0 0 20px 0;
  color: var(--text-main);
  font-size: 1.1rem;
  font-weight: 600;
}

/* 柱状图样式 */
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bar-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bar-label {
  width: 100px;
  color: var(--text-subtle);
  font-size: 0.9rem;
  flex-shrink: 0;
}

.bar-track {
  flex: 1;
  height: 32px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 30px;
  transition: width 0.6s ease;
}

.bar-value {
  color: var(--text-main);
  font-weight: 600;
  min-width: 40px;
  text-align: right;
}

/* 统计摘要 */
.stats-summary {
  background: rgba(40, 43, 56, 0.7);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-label {
  font-size: 0.85rem;
  color: var(--text-subtle);
}

.summary-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.summary-divider {
  width: 1px;
  height: 40px;
  background: var(--divider);
}

/* 统计页面响应式适配 */
@media (max-width: 768px) {
  .stats-grid {
    display: none;
  }

  .charts-container {
    grid-template-columns: 1fr;
  }

  .chart-box {
    padding: 16px;
  }

  .chart-box h3 {
    font-size: 1rem;
    margin-bottom: 16px;
  }

  .time-filter {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .time-filter button {
    white-space: nowrap;
    padding: 8px 12px;
    font-size: 0.85rem;
  }
}

/* 导航按钮 */
.nav-buttons {
  position: fixed;
  bottom: 30px;
  right: 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 100;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.4);
  transition: all 0.3s ease;
  font-weight: 600;
  font-size: 0.9rem;
}

.nav-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.6);
}

.nav-icon {
  font-size: 1.2rem;
}

.nav-text {
  white-space: nowrap;
}

@media (max-width: 768px) {
  .nav-buttons {
    bottom: 20px;
    right: 20px;
  }

  .nav-btn {
    padding: 10px 16px;
    font-size: 0.85rem;
  }

  .nav-icon {
    font-size: 1rem;
  }
}

/* Toast 提示样式 - 与 materials 项目保持一致 */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 16px 20px;
  min-width: 320px;
  max-width: 420px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: toastIn 0.3s ease;
  position: relative;
  overflow: hidden;
}

@keyframes toastIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toastOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.toast.hide {
  animation: toastOut 0.3s ease forwards;
}

.toast-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.toast.success .toast-icon {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.toast.error .toast-icon {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.toast.warning .toast-icon {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.toast.info .toast-icon {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.toast-message {
  color: var(--text-subtle);
  font-size: 0.85rem;
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
  padding: 4px;
  font-size: 1.2rem;
  line-height: 1;
  border-radius: 4px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: currentColor;
  animation: toastProgress 3s linear;
}

@keyframes toastProgress {
  from {
    width: 100%;
  }
  to {
    width: 0;
  }
}




