/* 礼薄管理系统 - 样式表 */
:root {
  --primary-color: #1890ff;
  --success-color: #52c41a;
  --warning-color: #faad14;
  --error-color: #ff4d4f;
  --text-color: #333;
  --text-secondary: #666;
  --border-color: #e8e8e8;
  --bg-color: #f5f5f5;
  --card-bg: #fff;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

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

/* 登录页面 */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
  background: var(--card-bg);
  padding: 40px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  width: 400px;
  max-width: 90%;
}

.login-box h1 {
  text-align: center;
  color: var(--primary-color);
  margin-bottom: 30px;
  font-size: 28px;
}

.login-box .subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 30px;
}

/* 表单样式 */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* 按钮样式 */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
}

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

.btn-primary:hover {
  background: #40a9ff;
}

.btn-success {
  background: var(--success-color);
  color: #fff;
}

.btn-success:hover {
  background: #73d13d;
}

.btn-warning {
  background: var(--warning-color);
  color: #fff;
}

.btn-warning:hover {
  background: #ffc53d;
}

.btn-error {
  background: var(--error-color);
  color: #fff;
}

.btn-error:hover {
  background: #ff7875;
}

.btn-default {
  background: #fff;
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.btn-default:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* 卡片样式 */
.card {
  background: var(--card-bg);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: 18px;
  font-weight: 600;
}

/* 主布局 */
.main-layout {
  display: flex;
  min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
  width: 240px;
  background: #001529;
  color: #fff;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  transition: width 0.3s ease;
  z-index: 100;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  font-size: 20px;
  font-weight: bold;
  overflow: hidden;
}

.sidebar-logo i {
  font-size: 24px;
  margin-right: 12px;
  flex-shrink: 0;
}

.sidebar-title {
  white-space: nowrap;
  transition: opacity 0.3s ease;
}

.sidebar-collapse-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
  background: rgba(255,255,255,0.2);
}

/* 侧边栏折叠状态 */
.sidebar.collapsed {
  width: 72px;
}

.sidebar.collapsed .sidebar-title {
  opacity: 0;
  width: 0;
}

.sidebar.collapsed .sidebar-logo {
  justify-content: center;
}

.sidebar.collapsed .sidebar-logo i {
  margin-right: 0;
}

.sidebar-menu {
  list-style: none;
  padding-top: 8px;
}

.sidebar-menu-item {
  padding: 14px 24px;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-menu-item:hover {
  background: rgba(255,255,255,0.1);
}

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

.sidebar-menu-item i {
  margin-right: 10px;
  font-size: 18px;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.sidebar-menu-item span {
  transition: opacity 0.3s ease;
}

/* 折叠状态下的菜单项 */
.sidebar.collapsed .sidebar-menu-item {
  justify-content: center;
  padding: 14px 16px;
}

.sidebar.collapsed .sidebar-menu-item i {
  margin-right: 0;
  font-size: 20px;
}

.sidebar.collapsed .sidebar-menu-item span {
  display: none;
}

/* 折叠状态主内容调整 */
.main-content.sidebar-collapsed {
  margin-left: 72px;
}

/* 主内容区 */
.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 24px;
}

/* 头部 */
.header {
  background: var(--card-bg);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.header-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.btn-help {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #fff3e0;
  color: #fa8c16;
  border: 1px solid #ffd591;
  border-radius: 8px;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.3s;
}

.btn-help:hover {
  background: #fa8c16;
  color: #fff;
  border-color: #fa8c16;
}

/* 统计卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  padding: 24px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 15px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 5px;
}

.stat-card .stat-label {
  color: var(--text-secondary);
  font-size: 14px;
}

/* 表格样式 */
.table-container {
  overflow-x: auto;
}

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

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

table th {
  background: #fafafa;
  font-weight: 600;
}

table tr:hover {
  background: #f5f5f5;
}

/* 模态框 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--card-bg);
  border-radius: 8px;
  width: 500px;
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform 0.3s;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  font-size: 24px;
  cursor: pointer;
  color: var(--text-secondary);
}

.modal-close:hover {
  color: var(--error-color);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* 标签 */
.tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.tag-admin {
  background: linear-gradient(135deg, #722ed1, #531d93);
  color: #fff;
}

.tag-user {
  background: #e8e8e8;
  color: #666;
}

.tag-success {
  background: #52c41a;
  color: #fff;
}

.tag-disabled {
  background: #8c8c8c;
  color: #fff;
}

.tag-admin i {
  margin-right: 4px;
}

/* 事件卡片 */
.event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.event-card {
  background: var(--card-bg);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
}

.event-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.event-card-header {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.event-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.event-card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.event-card-date {
  font-size: 13px;
  color: var(--text-secondary);
}

.event-card-body {
  padding: 16px;
}

.event-card-stats {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.event-card-stat {
  text-align: center;
}

.event-card-stat-value {
  font-size: 20px;
  font-weight: bold;
  color: var(--primary-color);
}

.event-card-stat-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.event-card-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
}

.event-card-location {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* 筛选栏 */
.filter-bar {
  background: var(--card-bg);
  padding: 16px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: center;
}

.filter-bar .search-input {
  flex: 1;
  min-width: 200px;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state i {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.5;
}

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

/* 搜索框 */
.search-input {
  position: relative;
}

.search-input input {
  padding-left: 40px;
}

.search-input i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
}

/* 下拉菜单 */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--card-bg);
  border-radius: 6px;
  box-shadow: var(--shadow);
  min-width: 160px;
  z-index: 100;
  display: none;
}

.dropdown-menu.active {
  display: block;
}

.dropdown-item {
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.3s;
}

.dropdown-item:hover {
  background: #f5f5f5;
}

/* 消息提示 */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 16px 24px;
  border-radius: 6px;
  color: #fff;
  font-weight: 500;
  z-index: 2000;
  transform: translateX(120%);
  transition: transform 0.3s;
}

.toast.show {
  transform: translateX(0);
}

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

.toast.error {
  background: var(--error-color);
}

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

/* 加载状态 */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* 移动端菜单按钮 - 默认隐藏 */
.menu-toggle {
  display: none;
}

/* 响应式 */
@media (max-width: 768px) {
  .sidebar {
    width: 260px;
    left: -260px;
    transition: left 0.3s ease;
    z-index: 999;
  }
  
  .sidebar.active {
    left: 0;
  }
  
  /* 移动端隐藏折叠按钮 */
  .sidebar-collapse-btn {
    display: none;
  }
  
  /* 重置折叠状态 */
  .sidebar.collapsed {
    width: 260px;
  }
  
  .sidebar.collapsed .sidebar-title {
    opacity: 1;
    width: auto;
  }
  
  .sidebar.collapsed .sidebar-logo {
    justify-content: center;
  }
  
  .sidebar.collapsed .sidebar-logo i {
    margin-right: 12px;
  }
  
  .sidebar.collapsed .sidebar-menu-item {
    justify-content: flex-start;
    padding: 14px 24px;
  }
  
  .sidebar.collapsed .sidebar-menu-item i {
    margin-right: 10px;
    font-size: 18px;
  }
  
  .sidebar.collapsed .sidebar-menu-item span {
    display: inline;
  }
  
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
  }
  
  .sidebar-overlay.active {
    display: block;
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .main-content.sidebar-collapsed {
    margin-left: 0;
  }
  
  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-color);
    margin-right: 12px;
  }
  
  .menu-toggle:hover {
    background: #f5f5f5;
  }
  
  .event-grid {
    grid-template-columns: 1fr;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .header {
    padding: 12px 16px;
  }
  
  .hero-section {
    padding: 24px;
  }
  
  .hero-title {
    font-size: 24px;
  }
  
  .hero-stats {
    gap: 20px;
  }
  
  .hero-stat-value {
    font-size: 28px;
  }
  
  .feature-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .feature-card {
    padding: 16px;
  }
  
  .feature-icon {
    width: 48px;
    height: 48px;
    font-size: 20px;
  }
  
  .stats-grid-new {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .hero-icon {
    display: none;
  }
  
  .feature-cards {
    grid-template-columns: 1fr;
  }
  
  .hero-stats {
    flex-wrap: wrap;
  }
}

/* 工具类 */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary-color); }
.text-success { color: var(--success-color); }
.text-warning { color: var(--warning-color); }
.text-error { color: var(--error-color); }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-10 { gap: 10px; }
.gap-20 { gap: 20px; }

/* 图表容器 */
.chart-container {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

/* 礼金记录列表 */
.gift-list {
  max-height: 400px;
  overflow-y: auto;
}

.gift-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

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

.gift-info {
  display: flex;
  flex-direction: column;
}

.gift-name {
  font-weight: 500;
  margin-bottom: 4px;
}

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

.gift-amount {
  font-size: 18px;
  font-weight: bold;
  color: var(--error-color);
}

/* 关系标签 */
.relationship-tag {
  display: inline-block;
  padding: 2px 8px;
  background: #e6f7ff;
  color: var(--primary-color);
  border-radius: 4px;
  font-size: 12px;
  margin-left: 8px;
}

/* 用户头像 */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* 表单底部链接 */
.form-footer {
  margin-top: 16px;
  text-align: center;
}

.text-link {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.3s;
}

.text-link:hover {
  color: #40a9ff;
  text-decoration: underline;
}
