/* 加拿大小型超市 POS 收银系统 - 公共样式 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: "Microsoft YaHei", "PingFang SC", -apple-system, sans-serif;
  background: #f0f2f5;
  color: #333;
  min-height: 100vh;
}

/* 顶部导航 */
.nav {
  background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
  color: #fff;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-title {
  font-size: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
}
.nav-links a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.2s;
}
.nav-links a:hover,
.nav-links a.active {
  background: rgba(255,255,255,0.2);
  color: #fff;
}
.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.nav-user .role {
  background: rgba(255,255,255,0.2);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
}

/* 侧边栏布局 */
.layout {
  display: flex;
  min-height: calc(100vh - 56px);
}
.sidebar {
  width: 220px;
  background: #fff;
  border-right: 1px solid #e8e8e8;
  padding: 16px 0;
  flex-shrink: 0;
}
.sidebar-menu {
  list-style: none;
}
.sidebar-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  color: #666;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.sidebar-menu a:hover {
  background: #f5f7fa;
  color: #1a73e8;
}
.sidebar-menu a.active {
  background: #e8f0fe;
  color: #1a73e8;
  border-left-color: #1a73e8;
  font-weight: 500;
}
.sidebar-menu .icon {
  font-size: 18px;
}
.sidebar-group {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #eee;
}
.sidebar-group-title {
  padding: 6px 20px;
  font-size: 11px;
  color: #999;
  text-transform: uppercase;
}

/* 主内容区 */
.main {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}
.main-full {
  max-width: 100%;
  margin: 0 auto;
}

/* 页面标题 */
.page-header {
  margin-bottom: 24px;
}
.page-title {
  font-size: 24px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 4px;
}
.page-subtitle {
  color: #666;
  font-size: 14px;
}

/* 卡片 */
.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  padding: 20px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title .icon {
  margin-right: 8px;
}

/* 统计卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  transition: transform 0.2s;
}
.stat-card:hover {
  transform: translateY(-2px);
}
.stat-card.primary {
  background: linear-gradient(135deg, #1a73e8, #0d47a1);
  color: #fff;
}
.stat-card.success {
  background: linear-gradient(135deg, #34a853, #1e7e34);
  color: #fff;
}
.stat-card.warning {
  background: linear-gradient(135deg, #fbbc04, #f9a825);
  color: #333;
}
.stat-card.danger {
  background: linear-gradient(135deg, #ea4335, #c62828);
  color: #fff;
}
.stat-label {
  font-size: 13px;
  opacity: 0.85;
  margin-bottom: 8px;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
}
.stat-change {
  font-size: 12px;
  margin-top: 8px;
  opacity: 0.9;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-weight: 500;
}
.btn-primary {
  background: #1a73e8;
  color: #fff;
}
.btn-primary:hover {
  background: #1557b0;
}
.btn-success {
  background: #34a853;
  color: #fff;
}
.btn-success:hover {
  background: #2d8f47;
}
.btn-warning {
  background: #fbbc04;
  color: #333;
}
.btn-danger {
  background: #ea4335;
  color: #fff;
}
.btn-danger:hover {
  background: #c62828;
}
.btn-secondary {
  background: #e8f0fe;
  color: #1a73e8;
}
.btn-secondary:hover {
  background: #d2e3fc;
}
.btn-outline {
  background: transparent;
  border: 1px solid #ddd;
  color: #666;
}
.btn-outline:hover {
  border-color: #1a73e8;
  color: #1a73e8;
}
.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* 表格 */
.table-wrapper {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #eee;
}
th {
  background: #f8f9fa;
  font-weight: 600;
  color: #666;
  font-size: 13px;
}
tr:hover {
  background: #f8f9fa;
}
.text-right {
  text-align: right;
}
.text-center {
  text-align: center;
}

/* 表单 */
.form-group {
  margin-bottom: 16px;
}
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: #333;
}
.form-input, .form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 3px rgba(26,115,232,0.1);
}

/* 标签 */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.badge-success {
  background: #e6f4ea;
  color: #34a853;
}
.badge-warning {
  background: #fef7e0;
  color: #f9a825;
}
.badge-danger {
  background: #fce8e6;
  color: #ea4335;
}
.badge-info {
  background: #e8f0fe;
  color: #1a73e8;
}
.badge-secondary {
  background: #f1f3f4;
  color: #5f6368;
}

/* 网格布局 */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* 预警样式 */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-warning {
  background: #fef7e0;
  border-left: 4px solid #fbbc04;
  color: #8a6d00;
}
.alert-danger {
  background: #fce8e6;
  border-left: 4px solid #ea4335;
  color: #c62828;
}
.alert-info {
  background: #e8f0fe;
  border-left: 4px solid #1a73e8;
  color: #0d47a1;
}

/* 列表 */
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}
.list-item:last-child {
  border-bottom: none;
}

/* 快捷入口 */
.shortcuts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
.shortcut {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 12px;
  padding: 24px 16px;
  text-align: center;
  text-decoration: none;
  color: #333;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  transition: all 0.2s;
  border: 2px solid transparent;
}
.shortcut:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(26,115,232,0.15);
  border-color: #1a73e8;
  color: #1a73e8;
}
.shortcut-icon {
  font-size: 36px;
  margin-bottom: 12px;
}
.shortcut-title {
  font-size: 14px;
  font-weight: 600;
}
.shortcut-desc {
  font-size: 12px;
  color: #888;
  margin-top: 4px;
}

/* 工具栏 */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.toolbar-search {
  flex: 1;
  min-width: 200px;
  max-width: 300px;
}

/* 分页 */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 20px;
}
.pagination a {
  padding: 8px 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  text-decoration: none;
  color: #666;
  font-size: 14px;
}
.pagination a:hover, .pagination a.active {
  background: #1a73e8;
  border-color: #1a73e8;
  color: #fff;
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
}

/* 侧边栏遮罩 */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
}
.sidebar-overlay.active {
  display: block;
}

/* 侧边栏关闭按钮 */
.sidebar-close {
  display: none;
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
}

/* ======================= */
/* 响应式 - 平板横屏 (1024px) */
/* ======================= */
@media (max-width: 1024px) {
  .sidebar {
    width: 200px;
  }
  .main {
    padding: 20px;
  }
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .shortcuts {
    grid-template-columns: repeat(3, 1fr);
  }
  th, td {
    padding: 10px 12px;
  }
}

/* ======================= */
/* 响应式 - 平板竖屏/iPad (768px) */
/* ======================= */
@media (max-width: 768px) {
  /* 导航栏调整 */
  .nav {
    padding: 0 16px;
    height: 52px;
  }
  .nav-title {
    font-size: 16px;
  }
  .nav-links {
    display: none;
  }
  .nav-user {
    gap: 8px;
    font-size: 12px;
  }
  .nav-user span:not(.role) {
    display: none;
  }
  .mobile-menu-btn {
    display: block;
  }
  
  /* 侧边栏变成抽屉 */
  .sidebar {
    position: fixed;
    top: 0;
    left: -260px;
    width: 260px;
    height: 100vh;
    z-index: 200;
    transition: left 0.3s ease;
    padding-top: 56px;
  }
  .sidebar.active {
    left: 0;
  }
  .sidebar-close {
    display: block;
  }
  .sidebar-menu a span {
    display: inline;
  }
  .sidebar-group-title {
    display: block;
  }
  
  /* 主内容区占满宽度 */
  .layout {
    flex-direction: column;
  }
  .main {
    padding: 16px;
    min-height: calc(100vh - 52px);
  }
  
  /* 页面标题 */
  .page-header {
    margin-bottom: 16px;
  }
  .page-title {
    font-size: 20px;
  }
  .page-subtitle {
    font-size: 13px;
  }
  
  /* 网格布局 */
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .shortcuts {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  /* 卡片 */
  .card {
    padding: 16px;
    margin-bottom: 16px;
  }
  .card-title {
    font-size: 15px;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  /* 统计卡片 */
  .stat-card {
    padding: 16px;
  }
  .stat-value {
    font-size: 24px;
  }
  .stat-label {
    font-size: 12px;
  }
  
  /* 表格 */
  th, td {
    padding: 10px 8px;
    font-size: 13px;
  }
  .table-wrapper {
    margin: 0 -16px;
    padding: 0 16px;
  }
  
  /* 表单 */
  .form-input, .form-select {
    padding: 10px 12px;
  }
  
  /* 工具栏 */
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar-search {
    max-width: 100%;
  }
  
  /* 按钮 */
  .btn {
    padding: 10px 16px;
  }
  .btn-lg {
    padding: 12px 20px;
    font-size: 14px;
  }
  
  /* 快捷入口 */
  .shortcut {
    padding: 16px 12px;
  }
  .shortcut-icon {
    font-size: 28px;
    margin-bottom: 8px;
  }
  .shortcut-title {
    font-size: 13px;
  }
  
  /* 分页 */
  .pagination {
    flex-wrap: wrap;
  }
  .pagination a {
    padding: 6px 10px;
    font-size: 13px;
  }
}

/* ======================= */
/* 响应式 - 手机 (480px) */
/* ======================= */
@media (max-width: 480px) {
  /* 导航栏 */
  .nav {
    padding: 0 12px;
    height: 48px;
  }
  .nav-title {
    font-size: 14px;
  }
  
  /* 主内容区 */
  .main {
    padding: 12px;
  }
  
  /* 页面标题 */
  .page-title {
    font-size: 18px;
  }
  
  /* 统计卡片 - 手机上单列 */
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .stat-card {
    padding: 14px;
  }
  .stat-value {
    font-size: 22px;
  }
  
  /* 快捷入口 - 2列 */
  .shortcuts {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .shortcut {
    padding: 14px 10px;
  }
  .shortcut-icon {
    font-size: 24px;
  }
  .shortcut-title {
    font-size: 12px;
  }
  
  /* 卡片 */
  .card {
    padding: 14px;
    border-radius: 10px;
  }
  .card-title {
    font-size: 14px;
    margin-bottom: 12px;
  }
  
  /* 表格 */
  th, td {
    padding: 8px 6px;
    font-size: 12px;
  }
  .table-wrapper {
    margin: 0 -14px;
    padding: 0 14px;
  }
  
  /* 按钮 */
  .btn {
    padding: 8px 14px;
    font-size: 13px;
  }
  .btn-sm {
    padding: 5px 10px;
    font-size: 11px;
  }
  
  /* 标签 */
  .badge {
    padding: 3px 8px;
    font-size: 11px;
  }
  
  /* 预警 */
  .alert {
    padding: 10px 12px;
    font-size: 13px;
  }
  
  /* 表单 */
  .form-input, .form-select {
    padding: 8px 10px;
    font-size: 14px;
  }
  .form-label {
    font-size: 13px;
  }
  
  /* 分页 */
  .pagination a {
    padding: 5px 8px;
    font-size: 12px;
  }
}

/* 同步状态指示器 */
.sync-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  margin-right: 12px;
}

.sync-status.online {
  background: rgba(40, 167, 69, 0.15);
  color: #28a745;
}

.sync-status.offline {
  background: rgba(220, 53, 69, 0.15);
  color: #dc3545;
}

.sync-status.syncing {
  background: rgba(0, 123, 255, 0.15);
  color: #007bff;
}

.sync-status.pending {
  background: rgba(255, 193, 7, 0.15);
  color: #e0a800;
}

.sync-status:hover {
  transform: scale(1.05);
}

.sync-icon {
  font-size: 14px;
}

.sync-status.syncing .sync-icon {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
  .sync-status {
    padding: 3px 8px;
    font-size: 11px;
  }
  .sync-status .sync-text {
    display: none;
  }
}
