/**
 * CPED Main Styles
 * 主布局样式 - 像素风格
 */

/* 页面结构 */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 头部 */
.app-header {
  background: var(--bg-header);
  color: white;
  border-bottom: 4px solid var(--border-color);
  padding: 15px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 0 rgba(0,0,0,0.2);
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app-title {
  font-family: var(--font-pixel);
  font-size: 16px;
  margin: 0;
}

.app-title i {
  color: var(--primary-color);
  margin-right: 8px;
}

/* 主布局 */
.main-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* 侧边栏 */
.sidebar {
  background: var(--bg-card);
  border-right: 4px solid var(--border-color);
  padding: 20px;
  overflow-y: auto;
  max-height: calc(100vh - 70px);
  position: sticky;
  top: 70px;
}

/* 搜索区域 */
.search-section {
  margin-bottom: 24px;
}

.search-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-actions {
  display: flex;
  gap: 8px;
}

.search-actions .btn {
  flex: 1;
}

/* 官员列表 */
.officials-list {
  max-height: calc(100vh - 300px);
  overflow-y: auto;
  border: 3px solid var(--border-color);
  box-shadow: 3px 3px 0 rgba(0,0,0,0.15);
}

.official-item {
  display: flex;
  align-items: center;
  padding: 12px;
  border-bottom: 2px solid var(--border-color);
  cursor: pointer;
  transition: all 0.15s;
  background: var(--bg-card);
}

.official-item:last-child {
  border-bottom: none;
}

.official-item:hover {
  background: var(--primary-color);
  color: white;
  box-shadow: inset 0 0 0 2px var(--border-color);
}

.official-item:hover .official-meta {
  color: rgba(255, 255, 255, 0.8);
}

.official-item.active {
  background: var(--bg-header);
  color: white;
  box-shadow: inset 0 0 0 2px var(--border-color);
}

.official-item.active .official-meta {
  color: rgba(255, 255, 255, 0.7);
}

.official-info-main {
  flex: 1;
}

.official-name {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 2px;
}

.official-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.official-item .arrow {
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.15s;
}

.official-item:hover .arrow,
.official-item.active .arrow {
  opacity: 1;
  color: inherit;
}

/* 主内容区 */
.main-content {
  padding: 24px;
  background: var(--bg-color);
  min-height: calc(100vh - 70px);
}

/* 内容网格 */
.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.content-section {
  background: var(--bg-card);
  border: 3px solid var(--border-color);
  box-shadow: 6px 6px 0 rgba(0,0,0,0.2);
}

.content-section.wide {
  grid-column: span 1;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--bg-header);
  color: white;
  flex-wrap: wrap;
  gap: 12px;
  border-bottom: 3px solid var(--border-color);
}

.section-header h3 {
  font-size: 14px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-header h3 i {
  color: var(--primary-color);
}

/* 欢迎页面 */
.empty-state.welcome {
  min-height: 400px;
}

.empty-state.welcome i {
  font-size: 48px;
}

.empty-state.welcome h2 {
  font-size: 20px;
  margin-top: 16px;
}

/* 主加载/错误状态 */
.main-loading,
.main-error {
  min-height: 500px;
}

/* 个人信息卡片 */
.profile-card {
  padding: 24px;
}

.profile-header {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.avatar {
  width: 80px;
  height: 80px;
  background: var(--primary-color);
  border: 4px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-pixel);
  font-size: 32px;
  color: white;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.3);
  flex-shrink: 0;
  image-rendering: pixelated;
}

.profile-basic {
  flex: 1;
}

.profile-name {
  font-size: 20px;
  margin-bottom: 12px;
}

.profile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.info-item {
  display: flex;
  flex-direction: column;
  padding: 12px;
  background: var(--bg-color);
  border: 3px solid var(--border-color);
  box-shadow: 3px 3px 0 rgba(0,0,0,0.15);
}

.info-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
}

.info-value {
  font-weight: bold;
  font-size: 14px;
}

.info-value.highlight {
  color: var(--primary-color);
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 11px;
  background: var(--secondary-color);
  color: white;
  border: 2px solid var(--border-color);
  font-family: var(--font-pixel-alt);
  font-weight: bold;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.2);
}

.status-badge.status-active {
  background: var(--success-color);
}

.status-badge.status-retired {
  background: var(--warning-color);
}

/* 级别晋升图 */
#level-matrix-container {
  padding: 16px;
  height: 420px;
  background: #f0f0f0;
  border: 4px solid #000;
  box-shadow: inset 0 0 0 4px #333;
}

.matrix-wrapper {
  height: 100%;
}

.matrix-cell {
  stroke-width: 1;
  transition: stroke-width 0.1s;
}

.matrix-cell.active {
  stroke-width: 2;
}

.matrix-label {
  font-family: var(--font-pixel-alt);
}

.matrix-title {
  font-family: var(--font-pixel);
}

.matrix-tooltip {
  background: var(--bg-header);
  color: white;
  padding: 8px 12px;
  font-size: 12px;
  border: 2px solid white;
  font-family: var(--font-pixel-alt);
  pointer-events: none;
}

.legend-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  font-family: var(--font-pixel-alt);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.1);
  padding: 4px 8px;
  border: 2px solid rgba(255,255,255,0.3);
}

.legend-color {
  width: 14px;
  height: 14px;
  border: 2px solid #000;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.3);
}

.matrix-hint {
  padding: 12px 20px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-color);
  border-top: 3px solid var(--border-color);
  font-family: var(--font-pixel-alt);
}

.matrix-hint i {
  color: var(--primary-color);
}

/* 地图 */
.map-wrapper {
  height: 400px;
  background: #e8e8e8;
  border: 3px solid var(--border-color);
}

/* 时间线 */
.timeline-container {
  padding: 20px;
}

.timeline-list {
  position: relative;
  padding-left: 20px;
}

.timeline-list::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-color);
}

.timeline-item {
  position: relative;
  padding: 16px 20px;
  margin-bottom: 16px;
  background: var(--bg-color);
  border: 3px solid var(--border-color);
  box-shadow: 4px 4px 0 rgba(0,0,0,0.2);
  animation: slideIn 0.3s ease-out forwards;
  animation-delay: var(--delay, 0s);
  opacity: 0;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.timeline-marker {
  position: absolute;
  left: -20px;
  top: 20px;
  width: 12px;
  height: 12px;
  background: var(--primary-color);
  border: 3px solid var(--border-color);
  border-radius: 0;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.3);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

.timeline-date {
  font-family: var(--font-pixel);
  font-size: 11px;
  color: var(--primary-color);
}

.timeline-date i {
  margin-right: 4px;
}

.level-tag {
  padding: 4px 10px;
  font-size: 11px;
  background: var(--primary-color);
  color: white;
  border: 2px solid var(--border-color);
  font-family: var(--font-pixel-alt);
  font-weight: bold;
  box-shadow: 2px 2px 0 var(--border-color);
}

.timeline-position {
  font-size: 15px;
  margin-bottom: 8px;
}

.timeline-location,
.timeline-education {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.timeline-location i,
.timeline-education i {
  margin-right: 4px;
  color: var(--primary-color);
}

.expand-btn {
  width: 100%;
  margin-top: 16px;
}

/* 错误页面 */
.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-color);
}

.error-content {
  text-align: center;
  padding: 40px;
}

.error-content i {
  font-size: 64px;
  color: var(--danger-color);
  margin-bottom: 24px;
}

.error-content h1 {
  font-size: 24px;
  margin-bottom: 16px;
}

.error-content p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* 响应式 */
@media (max-width: 1024px) {
  .main-layout {
    grid-template-columns: 280px 1fr;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .content-section.wide {
    grid-column: span 1;
  }
}

@media (max-width: 768px) {
  .main-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    max-height: 300px;
    border-right: none;
    border-bottom: 3px solid var(--border-color);
  }

  .officials-list {
    max-height: 200px;
  }

  .header-content {
    flex-direction: column;
    gap: 12px;
    padding: 12px;
  }

  .app-title {
    font-size: 14px;
  }

  .profile-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .legend-inline {
    justify-content: center;
  }
}
