/* 医疗模板管理系统样式 */
:root {
  /* 主色调 */
  --doc-primary: #2E4AB8;
  --doc-secondary: #5C7CFA;
  
  /* 背景色 */
  --doc-bg: #F8FAFF;
  --section-bg: #EDF2FF;
  --card-bg: #FFFFFF;
  
  /* 文字色 */
  --text-main: #1A237E;
  --text-secondary: #37474F;
  --text-label: #546E7A;
  
  /* 交互状态色 */
  --border-light: #CFD8DC;
  --border-emphasis: #90CAF9;
  --hover-bg: #E3EAFF;
  --active-bg: #D6E0FF;
  
  /* 功能状态色 */
  --success: #4CAF50;
  --warning: #FF9800;
  --danger: #E53935;
  
  /* 尺寸规范 */
  --title-bar-height: 40px;
  --status-bar-height: 20px;
  --sidebar-width: 200px;
  --middle-list-width: 320px;
}

/* 重置样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
  background-color: var(--doc-bg);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 标题栏样式 */
.title-bar {
  height: var(--title-bar-height);
  background-color: #FFFFFF;
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 100;
}

.title-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.app-logo {
  width: 30px;
  height: 30px;
  background-color: var(--doc-primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
}

.app-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--doc-primary);
}

.app-menu {
  display: flex;
  gap: 25px;
}

.menu-item {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 15px;
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.2s;
}

.menu-item:hover {
  background-color: var(--hover-bg);
  color: var(--doc-primary);
}

.menu-item.active {
  background-color: var(--doc-primary);
  color: white;
}

.title-right {
  display: flex;
  gap: 15px;
}

.window-control {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background-color: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.window-control:hover {
  background-color: var(--hover-bg);
}

.window-control.minimize:hover {
  color: var(--warning);
}

.window-control.maximize:hover {
  color: var(--success);
}

.window-control.close:hover {
  background-color: var(--danger);
  color: white;
}

/* 主内容区样式 */
.main-content {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* 左侧边栏样式 */
.sidebar {
  width: var(--sidebar-width);
  background-color: #FFFFFF;
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.category-section {
  padding: 20px;
  border-bottom: 1px solid var(--border-light);
}

.section-title {
  font-size: 18px;
  color: var(--doc-primary);
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dropdown-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dropdown {
  background-color: var(--section-bg);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s;
}

.dropdown.active {
  background-color: var(--doc-primary);
  color: white;
}

.dropdown-header {
  padding: 12px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-weight: 500;
}

.dropdown.active .dropdown-header {
  color: white;
}

.dropdown-arrow {
  transition: transform 0.3s;
}

.dropdown.active .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.category-item {
  height: 28px;
  padding: 0 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  color: var(--text-secondary);
}

.category-item:hover {
  background-color: var(--hover-bg);
}

.category-item.active {
  background-color: var(--active-bg);
  color: var(--doc-primary);
  font-weight: 500;
}

.dropdown.active .category-item {
  color: rgba(255, 255, 255, 0.9);
}

.dropdown.active .category-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.dropdown.active .category-item.active {
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
}

.item-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-label);
  background-color: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: 10px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-item {
  display: flex;
  align-items: center;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
}

.checkbox-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--doc-primary);
}

/* 中间列表区样式 */
.template-list-section {
  width: var(--middle-list-width);
  background-color: #FFFFFF;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.list-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.search-container {
  position: relative;
  margin-bottom: 15px;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-label);
}

.search-input {
  width: 100%;
  height: 36px;
  padding: 0 40px 0 40px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-main);
  background-color: var(--section-bg);
  transition: all 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--doc-secondary);
  background-color: white;
}

.clear-search {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-label);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  border-radius: 50%;
  transition: all 0.2s;
}

.clear-search:hover {
  background-color: var(--hover-bg);
  color: var(--danger);
}

.filter-buttons {
  display: flex;
  gap: 8px;
}

.filter-btn {
  flex: 1;
  height: 32px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background-color: var(--section-bg);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.filter-btn:hover {
  background-color: var(--hover-bg);
  border-color: var(--border-emphasis);
}

.filter-btn.active {
  background-color: var(--doc-primary);
  color: white;
  border-color: var(--doc-primary);
}

.template-list {
  flex: 1;
  overflow-y: auto;
  padding: 15px 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 0;
  color: var(--text-secondary);
}

.loading-indicator i {
  font-size: 24px;
  color: var(--doc-primary);
}

.template-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 18px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.template-card:hover {
  border-color: var(--border-emphasis);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  transform: translateY(-2px);
}

.template-card.active {
  border-color: var(--doc-primary);
  background-color: var(--active-bg);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.card-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--doc-primary);
  margin: 0;
}

.favorite-btn {
  background: none;
  border: none;
  color: var(--text-label);
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  transition: all 0.2s;
}

.favorite-btn:hover {
  color: var(--warning);
  transform: scale(1.1);
}

.favorite-btn.favorited {
  color: var(--warning);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 15px;
}

.tag {
  background-color: var(--section-bg);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.tag.primary {
  background-color: var(--doc-primary);
  color: white;
}

.tag.success {
  background-color: var(--success);
  color: white;
}

.tag.warning {
  background-color: var(--warning);
  color: white;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.card-stats {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 右侧详情区样式 */
.template-detail-section {
  flex: 1;
  background-color: #FFFFFF;
  border-left: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.template-detail-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.detail-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--doc-primary);
  margin-bottom: 12px;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
}

.detail-actions {
  display: flex;
  gap: 12px;
}

.action-btn {
  padding: 8px 16px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background-color: var(--section-bg);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.action-btn:hover:not(:disabled) {
  background-color: var(--hover-bg);
  border-color: var(--border-emphasis);
}

.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.action-btn.primary {
  background-color: var(--doc-primary);
  color: white;
  border-color: var(--doc-primary);
}

.action-btn.success {
  background-color: var(--success);
  color: white;
  border-color: var(--success);
}

.template-detail-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
  text-align: center;
}

.empty-state i {
  font-size: 48px;
  color: var(--border-light);
  margin-bottom: 20px;
}

.empty-state h3 {
  font-size: 18px;
  margin-bottom: 10px;
  color: var(--text-main);
}

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

.content-section {
  background-color: var(--section-bg);
  border-radius: 8px;
  padding: 20px;
  border-left: 4px solid var(--doc-secondary);
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--doc-primary);
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-content {
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-line;
}

.content-item {
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.content-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.item-title {
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.item-content {
  color: var(--text-secondary);
  line-height: 1.5;
}

/* 底部状态栏样式 */
.status-bar {
  height: var(--status-bar-height);
  background-color: #FFFFFF;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.status-left,
.status-center,
.status-right {
  flex: 1;
}

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

.status-center {
  text-align: center;
}

.status-right {
  text-align: right;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-indicator i {
  font-size: 10px;
}

.status-indicator.connected i {
  color: var(--success);
}

/* 响应式设计 */
@media (max-width: 1400px) {
  .sidebar {
    width: 180px;
  }
  
  .template-list-section {
    width: 300px;
  }
}

@media (max-width: 1024px) {
  .sidebar {
    position: absolute;
    left: -200px;
    top: var(--title-bar-height);
    bottom: var(--status-bar-height);
    z-index: 10;
    transition: left 0.3s;
  }
  
  .sidebar.active {
    left: 0;
  }
  
  .template-list-section {
    width: 300px;
  }
}

@media (max-width: 768px) {
  .template-list-section {
    position: absolute;
    left: 0;
    right: 0;
    top: var(--title-bar-height);
    bottom: var(--status-bar-height);
    width: 100%;
    z-index: 5;
  }
  
  .template-detail-section {
    position: absolute;
    left: 0;
    right: 0;
    top: var(--title-bar-height);
    bottom: var(--status-bar-height);
    z-index: 5;
  }
  
  .menu-item {
    display: none;
  }
}

/* 动画效果 */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--section-bg);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-label);
}