/**
 * 麻醉助手自定义样式
 * Custom Styles for Anesthesia Assistant
 */

/* ==================== 全局样式 ==================== */

:root {
  --primary-color: #4A90E2;
  --secondary-color: #7B68EE;
  --success-color: #52C41A;
  --warning-color: #FAAD14;
  --danger-color: #F5222D;
  --info-color: #1890FF;
  --light-bg: #F0F2F5;
  --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --border-radius: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--light-bg);
  color: #333;
  line-height: 1.6;
}

/* ==================== 导航栏样式 ==================== */

.navbar {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: bold;
  color: white !important;
}

.navbar-text {
  color: rgba(255, 255, 255, 0.9) !important;
}

/* ==================== 容器样式 ==================== */

.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* ==================== 卡片样式 ==================== */

.function-card {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  padding: 20px;
  margin-bottom: 20px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.function-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.card-header-custom {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 15px 20px;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  margin: -20px -20px 20px -20px;
  font-size: 1.2rem;
  font-weight: 600;
}

/* ==================== 功能网格 ==================== */

.function-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 15px;
  padding: 20px 0;
}

.function-item {
  background: white;
  border-radius: var(--border-radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  color: #333;
  border: 2px solid transparent;
}

.function-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 16px rgba(74, 144, 226, 0.3);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.function-icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
  color: var(--primary-color);
}

.function-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.function-description {
  font-size: 0.9rem;
  color: #666;
  margin: 0;
}

/* ==================== 输入组样式 ==================== */

.input-group-custom {
  margin-bottom: 20px;
}

.input-label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: #555;
  font-size: 0.95rem;
}

.input-field {
  width: 100%;
  padding: 10px 15px;
  border: 2px solid #e0e0e0;
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.input-field:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.input-unit {
  display: inline-block;
  margin-left: 8px;
  color: #888;
  font-size: 0.9rem;
}

/* ==================== 按钮样式 ==================== */

.btn-calculate {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border: none;
  color: white;
  padding: 12px 30px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.btn-calculate:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
  background: linear-gradient(135deg, #5FA3EC, #8B78F0);
}

.btn-calculate:active {
  transform: translateY(0);
}

.btn-reset {
  background: white;
  border: 2px solid #ddd;
  color: #666;
  padding: 12px 30px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.3s;
  margin-left: 10px;
}

.btn-reset:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: rgba(74, 144, 226, 0.05);
}

.btn-group-custom {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* ==================== 结果显示样式 ==================== */

.result-container {
  background: linear-gradient(135deg, #f6f9fc, #e9f2ff);
  border-left: 4px solid var(--primary-color);
  border-radius: var(--border-radius);
  padding: 20px;
  margin-top: 20px;
}

.result-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 15px;
  display: flex;
  align-items: center;
}

.result-title::before {
  content: "📊";
  margin-right: 8px;
  font-size: 1.3rem;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

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

.result-label {
  font-weight: 500;
  color: #555;
}

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

.result-highlight {
  background: rgba(74, 144, 226, 0.1);
  padding: 15px;
  border-radius: var(--border-radius);
  margin: 10px 0;
}

.result-warning {
  background: rgba(250, 173, 20, 0.1);
  border-left: 4px solid var(--warning-color);
  padding: 15px;
  border-radius: var(--border-radius);
  margin: 10px 0;
  color: #d48806;
}

.result-danger {
  background: rgba(245, 34, 45, 0.1);
  border-left: 4px solid var(--danger-color);
  padding: 15px;
  border-radius: var(--border-radius);
  margin: 10px 0;
  color: #cf1322;
}

/* ==================== 表格样式 ==================== */

.table-custom {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  background: white;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.table-custom thead {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
}

.table-custom th {
  padding: 15px;
  text-align: left;
  font-weight: 600;
}

.table-custom td {
  padding: 12px 15px;
  border-bottom: 1px solid #f0f0f0;
}

.table-custom tbody tr:hover {
  background: rgba(74, 144, 226, 0.05);
}

.table-custom tbody tr:last-child td {
  border-bottom: none;
}

/* ==================== 分类标签 ==================== */

.category-badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.badge-calculation {
  background: rgba(74, 144, 226, 0.1);
  color: var(--primary-color);
}

.badge-assessment {
  background: rgba(82, 196, 26, 0.1);
  color: var(--success-color);
}

.badge-reference {
  background: rgba(250, 173, 20, 0.1);
  color: var(--warning-color);
}

.badge-monitoring {
  background: rgba(123, 104, 238, 0.1);
  color: var(--secondary-color);
}

/* ==================== 响应式设计 ==================== */

/* 平板设备 */
@media (max-width: 768px) {
  .function-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
  }

  .main-container {
    padding: 15px;
  }

  .function-card {
    padding: 15px;
  }

  .btn-group-custom {
    flex-direction: column;
  }

  .btn-reset {
    margin-left: 0;
    margin-top: 10px;
  }

  .result-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
}

/* 手机设备 */
@media (max-width: 480px) {
  .function-grid {
    grid-template-columns: 1fr;
  }

  .navbar-brand {
    font-size: 1.2rem;
  }

  .function-icon {
    font-size: 2rem;
  }

  .function-title {
    font-size: 1rem;
  }

  .card-header-custom {
    font-size: 1.1rem;
    padding: 12px 15px;
  }

  .table-custom {
    font-size: 0.9rem;
  }

  .table-custom th,
  .table-custom td {
    padding: 8px 10px;
  }
}

/* ==================== 打印样式 ==================== */

@media print {
  body {
    background: white;
  }

  .navbar,
  .btn-back,
  .btn-calculate,
  .btn-reset,
  .no-print {
    display: none !important;
  }

  .function-card {
    box-shadow: none;
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }

  .result-container {
    background: white;
    border: 1px solid var(--primary-color);
  }
}

/* ==================== 加载动画 ==================== */

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==================== 工具提示 ==================== */

.tooltip-custom {
  position: relative;
  display: inline-block;
  cursor: help;
  color: var(--primary-color);
  margin-left: 5px;
}

.tooltip-custom::after {
  content: "?";
  display: inline-block;
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  font-size: 12px;
  font-weight: bold;
}

/* ==================== 图片引用样式 ==================== */

.reference-image {
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  margin: 20px 0;
}

.image-caption {
  text-align: center;
  color: #666;
  font-size: 0.9rem;
  margin-top: 10px;
  font-style: italic;
}

/* ==================== 滚动条美化 ==================== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

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

::-webkit-scrollbar-thumb:hover {
  background: var(--secondary-color);
}

/* ==================== 患者信息框样式 ==================== */

.patient-info-container {
  background: linear-gradient(135deg, #ffffff, #f8f9fa);
  border: 2px solid var(--primary-color);
  border-radius: var(--border-radius);
  padding: 15px 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(74, 144, 226, 0.15);
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.patient-info-icon {
  font-size: 1.8rem;
  color: var(--primary-color);
  flex-shrink: 0;
}

.patient-info-inputs {
  display: flex;
  gap: 15px;
  flex: 1;
  min-width: 300px;
  flex-wrap: wrap;
}

.patient-info-field {
  flex: 1;
  min-width: 150px;
}

.patient-info-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 5px;
}

.patient-info-field input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: all 0.3s;
}

.patient-info-field input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.1);
}

.patient-info-field input::placeholder {
  color: #bbb;
}

.patient-info-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.btn-patient-reset,
.btn-patient-print,
.btn-patient-summary,
.btn-patient-save {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.btn-patient-save {
  background: #1890ff;
  color: white;
  margin-left: 10px;
}

.btn-patient-save:hover {
  background: #40a9ff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(24, 144, 255, 0.3);
}

.btn-patient-reset {
  background: #ff4d4f;
  color: white;
}

.btn-patient-reset:hover {
  background: #ff7875;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(255, 77, 79, 0.3);
}

.btn-patient-print {
  background: #52c41a;
  color: white;
}

.btn-patient-print:hover {
  background: #73d13d;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(82, 196, 26, 0.3);
}

.btn-patient-summary {
  background: var(--primary-color);
  color: white;
}

.btn-patient-summary:hover {
  background: #5FA3EC;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.patient-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.patient-status-active {
  background: rgba(82, 196, 26, 0.1);
  color: var(--success-color);
}

.patient-status-empty {
  background: rgba(250, 173, 20, 0.1);
  color: var(--warning-color);
}

.patient-status-indicator::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.patient-status-active::before {
  background: var(--success-color);
  animation: pulse 2s ease-in-out infinite;
}

.patient-status-empty::before {
  background: var(--warning-color);
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ==================== 患者信息框响应式 ==================== */

@media (max-width: 768px) {
  .patient-info-container {
    flex-direction: column;
    align-items: stretch;
  }

  .patient-info-inputs {
    width: 100%;
    min-width: 100%;
  }

  .patient-info-actions {
    width: 100%;
    justify-content: stretch;
  }

  .btn-patient-reset,
  .btn-patient-print,
  .btn-patient-summary {
    flex: 1;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .patient-info-inputs {
    flex-direction: column;
  }

  .patient-info-field {
    width: 100%;
    min-width: 100%;
  }

  .patient-info-actions {
    flex-direction: column;
  }

  .btn-patient-reset,
  .btn-patient-print,
  .btn-patient-summary {
    width: 100%;
  }
}
