/* 基础样式 - 罕见病患者管理系统 */
:root {
    /* 主色调 - 医疗蓝系 */
    --primary: #4957a8;
    --primary-light: #6e7ccf;
    --primary-dark: #2c3b87;
    
    /* 辅助色 */
    --accent: #59b9a7;
    --success: #29a19c;
    --warning: #ffc107;
    --danger: #f44336;
    --info: #2196f3;
    
    /* 中性色 */
    --white: #ffffff;
    --light: #f8f9fa;
    --light-gray: #dee2e6;
    --gray: #6c757d;
    --dark-gray: #495057;
    --dark: #293241;
    --black: #212529;
    --error: #e63946;
    
    /* 字体 */
    --font-main: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    --font-heading: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    
    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    
    /* 阴影 */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
    
    /* 过渡效果 */
    --transition: all 0.3s ease;
  }
  
  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
  }
  
  html, body {
    height: 100%;
    font-family: var(--font-main);
    font-size: 16px;
    color: var(--dark);
    background-color: var(--light);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
  }
  
  a {
    text-decoration: none;
    color: var(--primary);
  }
  
  ul, ol {
    list-style: none;
  }
  
  img {
    max-width: 100%;
  }
  
  button, input, select, textarea {
    font-family: inherit;
    font-size: 100%;
  }
  
  .page {
    max-width: 100%;
    min-height: 100vh;
    padding-bottom: 60px; /* 为底部标签栏留出空间 */
    overflow-x: hidden;
  }
  
  .container {
    padding: 16px;
  }
  
  /* 按钮样式 */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
  }
  
  .btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
  }
  
  .btn-secondary {
    background-color: var(--light-gray);
    color: var(--dark);
  }
  
  .btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--primary-light));
    color: var(--white);
  }
  
  .btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
  }
  
  .btn-block {
    display: flex;
    width: 100%;
  }
  
  .btn-sm {
    padding: 6px 12px;
    font-size: 14px;
  }
  
  .btn-lg {
    padding: 12px 24px;
    font-size: 18px;
  }
  
  /* 卡片样式 */
  .card {
    background-color: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
    overflow: hidden;
  }
  
  .card-header {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--light-gray);
  }
  
  .card-body {
    padding: 16px;
  }
  
  .card-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--light-gray);
  }
  
  /* 表单元素 */
  .form-group {
    margin-bottom: 16px;
  }
  
  .form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark-gray);
  }
  
  .form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--light-gray);
    border-radius: var(--radius-md);
    background-color: var(--white);
    transition: var(--transition);
  }
  
  .form-input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(75, 108, 183, 0.2);
    outline: none;
  }
  
  /* 辅助类 */
  .text-center { text-align: center; }
  .text-right { text-align: right; }
  .text-left { text-align: left; }
  
  .mt-1 { margin-top: 8px; }
  .mt-2 { margin-top: 16px; }
  .mt-3 { margin-top: 24px; }
  .mb-1 { margin-bottom: 8px; }
  .mb-2 { margin-bottom: 16px; }
  .mb-3 { margin-bottom: 24px; }
  
  .flex { display: flex; }
  .flex-column { flex-direction: column; }
  .justify-between { justify-content: space-between; }
  .align-center { align-items: center; }
  .flex-1 { flex: 1; }
  
  /* 动画效果 */
  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }
  
  .fade-in {
    animation: fadeIn 0.3s ease-in-out;
  }
  
  /* 启动页样式 */
  .splash-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #4b6cb7, #36d1dc);
    color: white;
    text-align: center;
  }
  
  .splash-logo {
    margin-bottom: 40px;
  }
  
  .splash-logo img {
    width: 100px;
    height: 100px;
    margin-bottom: 16px;
  }
  
  .splash-logo h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
  }
  
  .splash-logo p {
    font-size: 16px;
    opacity: 0.9;
  }
  
  .tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    height: 60px;
    z-index: 100;
  }
  
  .tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    position: relative;
    transition: color 0.3s;
  }
  
  .tab-item i {
    font-size: 22px;
    margin-bottom: 4px;
    transition: color 0.3s;
  }
  
  .tab-item span {
    font-size: 12px;
    margin-top: 2px;
  }

  /* 图片加载相关样式 */
  img {
    transition: opacity 0.3s ease;
    position: relative;
  }

  img.loading {
    opacity: 0.6;
  }

  /* 图片容器样式，使用伪元素显示加载指示器 */
  .img-container {
    position: relative;
    overflow: hidden;
    display: block;
  }

  .img-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--light-gray);
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s;
  }

  .img-container.loading::before {
    opacity: 1;
  }

  .img-container::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--primary);
    border-bottom-color: var(--primary);
    z-index: 2;
    animation: img-spinner 1s linear infinite;
    opacity: 0;
  }

  .img-container.loading::after {
    opacity: 1;
  }

  @keyframes img-spinner {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
  }

  /* 头像样式优化 */
  .avatar-img {
    object-fit: cover;
    background-color: var(--light-gray);
  }

  /* 图片错误占位样式 */
  .img-placeholder {
    background-color: var(--light-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray);
    font-size: 14px;
    text-align: center;
    padding: 16px;
    border-radius: 4px;
  }

  .img-placeholder i {
    font-size: 24px;
    margin-bottom: 8px;
  }

  .avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary);
    color: var(--white);
    font-weight: 500;
  }

  /* App模态框样式 */
  .app-modal-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  .app-modal-container.show {
    visibility: visible;
    opacity: 1;
  }

  .app-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
  }

  .app-modal {
    position: relative;
    width: 90%;
    max-width: 360px;
    background-color: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
  }

  .app-modal-container.show .app-modal {
    transform: translateY(0);
  }

  /* 底部弹出的模态框 */
  .app-modal-container.position-bottom {
    align-items: flex-end;
  }

  .app-modal-container.position-bottom .app-modal {
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }

  .app-modal-container.position-bottom.show .app-modal {
    transform: translateY(0);
  }

  .app-modal.fullscreen {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .app-modal-header {
    padding: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
  }

  .app-modal-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
  }

  .app-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  .app-modal-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .app-modal-footer {
    padding: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: flex-end;
  }

  .app-modal-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    margin-left: 8px;
  }

  .app-modal-cancel {
    background-color: #f2f2f2;
    color: #666;
  }

  .app-modal-confirm {
    background-color: var(--primary);
    color: white;
  }