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

:root {
  --primary-color: #2196F3;
  --secondary-color: #FFC107;
  --success-color: #4CAF50;
  --danger-color: #F44336;
  --bg-color: #f5f5f5;
  --card-bg: #ffffff;
  --text-color: #333333;
  --border-color: #e0e0e0;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

html {
  min-height: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Noto Sans SC', sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  background-attachment: fixed;
  color: var(--text-color);
  line-height: 1.7;
  padding-bottom: 80px;
  font-size: 16px;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  /* 防止键盘弹起时页面缩放 */
  -webkit-text-size-adjust: 100%;
  /* 语言切换过渡效果 */
  transition: opacity 0.2s ease-in-out;
}

body.rtl {
  /* 维吾尔语页面统一使用 Amiri 字体 */
  font-family: 'Amiri', sans-serif;
  direction: rtl;
  font-size: 16px;
}

body.rtl * {
  text-align: right;
}

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

/* 顶部栏容器 */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* 广告横幅 */
.ad-banner {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  background-size: 200% 200%;
  animation: gradientShift 8s ease infinite;
  border-radius: 10px;
  padding: 6px 8px;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  position: relative;
  flex-shrink: 0;
  width: auto;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  backdrop-filter: blur(10px);
}

.ad-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  animation: rotate 20s linear infinite;
}

.ad-banner:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(102, 126, 234, 0.4);
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.ad-content {
  display: flex;
  align-items: center;
  gap: 5px;
  position: relative;
  z-index: 1;
  white-space: nowrap;
  flex-wrap: nowrap;
}

.ad-icon {
  font-size: 18px;
  line-height: 1;
  animation: bounce 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.ad-text {
  flex: 1;
  color: #ffffff;
  min-width: 0;
}

.ad-title {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 1px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  line-height: 1.2;
}

.ad-contact {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
}

.ad-phone-icon {
  font-size: 12px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.ad-phone-link {
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
  padding: 3px 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-size: 11px;
}

.ad-phone-link:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.ad-phone-link:active {
  transform: scale(0.95);
}

body.rtl .ad-banner {
  /* RTL样式保持不变 */
}

body.rtl .ad-content {
  flex-direction: row;
}

body.rtl .ad-title {
  text-align: right;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .top-bar {
    gap: 8px;
    margin-bottom: 15px;
  }

  .ad-banner {
    padding: 6px 5px;
    border-radius: 8px;
    flex-shrink: 0;
    width: auto;
  }

  .language-switcher {
    flex-shrink: 0;
  }

  .ad-icon {
    font-size: 12px;
  }

  .ad-title {
    font-size: 7px;
    margin-bottom: 1px;
    line-height: 1.1;
  }

  .ad-contact {
    font-size: 6px;
    gap: 2px;
  }

  .ad-phone-icon {
    font-size: 7px;
  }

  .ad-phone-link {
    padding: 1px 3px;
    font-size: 6px;
    border-radius: 4px;
  }

  .ad-content {
    gap: 3px;
  }
}

/* 语言切换器 */
.language-switcher {
  position: relative;
  display: flex;
  gap: 5px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 6px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border: 1px solid rgba(0,0,0,0.05);
  flex-shrink: 0;
}

body.rtl .top-bar {
  flex-direction: row-reverse;
}

.lang-btn {
  padding: 8px 16px;
  border: 2px solid var(--primary-color);
  background: transparent;
  color: var(--primary-color);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Noto Sans SC', 'Noto Sans Arabic', sans-serif;
  position: relative;
  overflow: hidden;
  pointer-events: auto !important;
  z-index: 1;
}

/* 维吾尔文按钮使用正确的字体 */
#lang-ug {
  font-family: 'Amiri', sans-serif;
  font-size: 14px;
}

body.rtl #lang-ug {
  font-size: 15px;
}

.lang-btn.active {
  background: var(--primary-color);
  color: white;
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.lang-btn:hover {
  opacity: 0.8;
  transform: translateY(-1px);
}

.lang-btn:active {
  transform: scale(0.98);
  transition: all 0.1s;
}

/* 导航栏 - 固定在底部，滚动时不移动 */
.main-nav {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100vw !important;
  max-width: 100% !important;
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex !important;
  justify-content: space-around;
  padding: 8px 0;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0)) !important;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
  z-index: 99999 !important;
  border-top: 1px solid rgba(0,0,0,0.05);
  margin: 0 !important;
  margin-bottom: 0 !important;
  margin-top: 0 !important;
  /* 确保导航栏始终在视口底部，不受键盘弹起和滚动影响 */
  transform: translate3d(0, 0, 0) !important;
  -webkit-transform: translate3d(0, 0, 0) !important;
  /* 防止在移动端滚动时移动 */
  -webkit-overflow-scrolling: touch;
  /* 使用硬件加速 */
  will-change: transform;
  /* 防止键盘弹起时移动 */
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  /* 确保导航栏不受页面滚动影响 */
  top: auto !important;
  height: auto !important;
  /* 防止任何位置变化 */
  inset: auto 0 0 0 !important;
}

.nav-btn {
  flex: 1;
  padding: 8px 6px;
  border: none;
  background: transparent;
  color: var(--text-color);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.3s;
  pointer-events: auto !important;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 4px;
  position: relative;
  z-index: 100000 !important;
  pointer-events: auto !important;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.nav-btn span {
  pointer-events: none;
  user-select: none;
}

body.rtl .nav-btn {
  font-size: 13px;
}

/* 维吾尔文页面导航按钮统一使用 Amiri 字体 */
body.rtl .nav-customers,
body.rtl .nav-products,
body.rtl .nav-transaction,
body.rtl .nav-dashboard {
  font-family: 'Amiri', sans-serif;
}

.nav-btn.active {
  background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.nav-btn:hover {
  background: rgba(33, 150, 243, 0.1);
  transform: translateY(-2px);
}

.nav-btn.active:hover {
  background: linear-gradient(135deg, #1976D2 0%, #1565C0 100%);
  transform: translateY(-2px);
}

/* 页面 */
.page {
  display: none;
}

.page.active {
  display: block;
}

h1 {
  font-size: 32px;
  margin-bottom: 24px;
  color: var(--text-color);
  font-weight: 700;
  letter-spacing: -0.5px;
}

body.rtl h1 {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.5;
}

h2 {
  font-size: 24px;
  margin: 24px 0 18px;
  color: var(--text-color);
  font-weight: 600;
}

body.rtl h2 {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.6;
}

h3 {
  font-size: 19px;
  margin-bottom: 12px;
  color: var(--text-color);
  font-weight: 600;
}

body.rtl h3 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.7;
}

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

.stat-card-primary {
  border-left: 4px solid #2196F3;
}

.stat-card-primary::before {
  background: linear-gradient(90deg, #2196F3, #1976D2);
}

.stat-card-success {
  border-left: 4px solid #4CAF50;
}

.stat-card-success::before {
  background: linear-gradient(90deg, #4CAF50, #388E3C);
}

.stat-card-info {
  border-left: 4px solid #00BCD4;
}

.stat-card-info::before {
  background: linear-gradient(90deg, #00BCD4, #0097A7);
}

.stat-card-warning {
  border-left: 4px solid #FF9800;
}

.stat-card-warning::before {
  background: linear-gradient(90deg, #FF9800, #F57C00);
}

.stat-card-secondary {
  border-left: 4px solid #9E9E9E;
}

.stat-card-secondary::before {
  background: linear-gradient(90deg, #9E9E9E, #616161);
}

.stat-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  padding: 28px 24px;
  border-radius: 18px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  text-align: center;
  border: 1px solid rgba(255,255,255,0.9);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #2196F3, #1976D2);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 10px 30px rgba(33, 150, 243, 0.2);
}

.stat-card:hover::before {
  transform: scaleX(1);
}

.stat-card h3 {
  font-size: 15px;
  margin-bottom: 16px;
  color: #555;
  font-weight: 600;
  letter-spacing: 0.3px;
}

body.rtl .stat-card h3 {
  font-size: 14px;
  line-height: 1.8;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary-color);
  margin: 0;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #2196F3, #1976D2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

body.rtl .stat-value {
  font-size: 26px;
}

/* 卡片 */
.card {
  background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
  padding: 28px;
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  margin-bottom: 28px;
  border: 1px solid rgba(255,255,255,0.9);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #2196F3, #4CAF50, #FFC107);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(33, 150, 243, 0.15);
}

.card:hover::before {
  opacity: 1;
}

.card h3 {
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid #f0f0f0;
  color: #333;
}

.section {
  margin-bottom: 30px;
}

/* 图表卡片 */
.chart-card {
  position: relative;
  min-height: 300px;
  padding: 24px;
}

.chart-card canvas {
  max-height: 400px;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
}

@media (max-width: 768px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
  
  .chart-card {
    min-height: 250px;
  }
}

/* 列表 */
.list {
  list-style: none;
}

.list li {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
}

body.rtl .list li {
  font-size: 15px;
  line-height: 1.8;
}

.list li:last-child {
  border-bottom: none;
}

/* 表单 */
.form {
  background: var(--card-bg);
  padding: 28px;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  margin-bottom: 30px;
  border: 1px solid rgba(255,255,255,0.8);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 16px;
  color: var(--text-color);
}

body.rtl .form-group label {
  font-size: 15px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s;
  font-family: inherit;
  box-sizing: border-box;
}

/* 日期输入框特定样式 */
input[type="date"] {
  font-size: 16px;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 1;
  cursor: pointer;
  width: 20px;
  height: 20px;
}

/* 支付方式下拉框样式优化 */
#payment-method-select {
  max-width: 300px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 40px;
  cursor: pointer;
}

body.rtl #payment-method-select {
  background-position: left 12px center;
  padding-right: 12px;
  padding-left: 40px;
}

body.rtl .form-group input,
body.rtl .form-group select {
  font-size: 15px;
  text-align: right;
  padding: 12px 15px;
}

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

/* 页面头部操作 */
.page-header-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  align-items: center;
}

body.rtl .page-header-actions {
  flex-direction: row-reverse;
}

.page-header-actions .search-box {
  flex: 1;
  margin: 0;
  min-width: 0; /* 允许搜索框缩小 */
}

.btn-add {
  white-space: nowrap;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  flex: 1; /* 按钮也占一半空间 */
  min-width: 0;
}

body.rtl .btn-add {
  font-size: 15px;
  padding: 12px 20px;
}

.btn-add-inline {
  margin-top: 10px;
  width: 100%;
  padding: 10px 20px;
  font-size: 14px;
}

body.rtl .btn-add-inline {
  font-size: 13px;
  padding: 10px 18px;
}

/* 选择容器 */
.select-wrapper {
  margin-bottom: 10px;
}

.scrollable-select {
  background: #f9f9f9;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  max-height: 300px;
  display: flex;
  flex-direction: column;
}

.select-search {
  padding: 12px;
  background: white;
  border-bottom: 2px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 10;
}

.select-search input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 15px;
}

body.rtl .select-search input {
  font-size: 14px;
  text-align: right;
  padding: 10px 15px;
}

/* 单选按钮组 */
.radio-group {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: 250px;
  padding: 8px;
}

body.rtl .radio-group {
  direction: rtl;
}

.radio-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px;
  margin-bottom: 6px;
  background: white;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}

body.rtl .radio-item {
  flex-direction: row-reverse;
}

.radio-item:hover {
  background: #f0f7ff;
  border-color: var(--primary-color);
  transform: translateX(2px);
}

body.rtl .radio-item:hover {
  transform: translateX(-2px);
}

.radio-item.selected {
  background: #e3f2fd;
  border-color: var(--primary-color);
  font-weight: 600;
}

.radio-item input[type="radio"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

.radio-item label {
  flex: 1;
  cursor: pointer;
  font-size: 16px;
  margin: 0;
  user-select: none;
}

body.rtl .radio-item label {
  font-size: 15px;
  line-height: 1.7;
}

/* 复选框组 */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 15px;
  padding: 8px;
  overflow-y: auto;
  max-height: 250px;
}

body.rtl .checkbox-group {
  direction: rtl;
}

.checkbox-group.scrollable {
  max-height: 250px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px;
  background: white;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
  margin-bottom: 6px;
}

body.rtl .checkbox-item {
  flex-direction: row-reverse;
}

.checkbox-item:hover {
  background: #f0f7ff;
  border-color: var(--primary-color);
  transform: translateX(2px);
}

body.rtl .checkbox-item:hover {
  transform: translateX(-2px);
}

.checkbox-item input[type="checkbox"]:checked + label {
  font-weight: 600;
}

.checkbox-item:has(input[type="checkbox"]:checked) {
  background: #e3f2fd;
  border-color: var(--primary-color);
}

.checkbox-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

.checkbox-item label {
  flex: 1;
  cursor: pointer;
  font-size: 16px;
  margin: 0;
  user-select: none;
}

body.rtl .checkbox-item label {
  font-size: 15px;
  line-height: 1.7;
}

.quantity-input-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px;
  background: #f9f9f9;
  border-radius: 8px;
}

body.rtl .quantity-input-group {
  flex-direction: row-reverse;
}

.quantity-input-group label {
  flex: 1;
  margin: 0;
  font-size: 15px;
}

body.rtl .quantity-input-group label {
  font-size: 14px;
}

.quantity-input-group input {
  width: 100px;
  margin: 0;
}

body.rtl .quantity-input-group input {
  text-align: center;
}

/* 按钮 */
.btn-primary {
  background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
  color: white;
  border: none;
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  width: 100%;
  margin-top: 10px;
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

body.rtl .btn-primary {
  font-size: 15px;
  padding: 14px 24px;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1976D2 0%, #1565C0 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(33, 150, 243, 0.4);
}

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

/* 商品详情页和客户详情页按钮样式 - 更小更紧凑 */
#restock-product-btn,
#edit-product-btn,
#edit-customer-btn {
  padding: 8px 16px !important;
  font-size: 14px !important;
  min-width: auto !important;
  width: auto !important;
  white-space: nowrap;
  margin-top: 0 !important;
}

body.rtl #restock-product-btn,
body.rtl #edit-product-btn,
body.rtl #edit-customer-btn {
  font-size: 13px !important;
  padding: 8px 14px !important;
}

.btn-secondary {
  background: #f5f5f5;
  color: var(--text-color);
  border: 2px solid var(--border-color);
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 10px;
}

body.rtl .btn-secondary {
  font-size: 14px;
  padding: 12px 20px;
}

.btn-secondary:hover {
  background: #e8e8e8;
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: translateY(-1px);
}

.back-btn {
  background: #e0e0e0;
  color: var(--text-color);
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 20px;
  transition: all 0.3s;
}

body.rtl .back-btn {
  font-size: 13px;
  padding: 10px 18px;
}

.back-btn:hover {
  background: #d0d0d0;
}

/* 搜索框 */
.search-box {
  margin-bottom: 20px;
}

.search-box input {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 16px;
  min-width: 0; /* 允许输入框缩小 */
}

body.rtl .search-box input {
  font-size: 15px;
  text-align: right;
  padding: 12px 15px;
}

/* 客户/商品列表 */
.customers-list,
.products-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 15px;
}

.customer-card,
.product-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  padding: 28px 24px;
  border-radius: 18px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}

.customer-card::before,
.product-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, #2196F3, #4CAF50);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

body.rtl .customer-card,
body.rtl .product-card {
  text-align: right;
  padding: 28px 22px;
}

.customer-card:hover,
.product-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 12px 32px rgba(33, 150, 243, 0.2);
  border-color: var(--primary-color);
}

.customer-card:hover::before,
.product-card:hover::before {
  transform: scaleX(1);
}

/* 有欠款的客户卡片显示红色 */
.customer-card-debt {
  border-color: #F44336 !important;
  background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%) !important;
}

.customer-card-debt::before {
  background: linear-gradient(90deg, #F44336, #D32F2F) !important;
  transform: scaleX(1) !important;
}

.customer-card-debt h3 {
  color: #D32F2F !important;
}

.customer-card h3,
.product-card h3 {
  font-size: 20px;
  margin-bottom: 14px;
  color: var(--primary-color);
  font-weight: 700;
  letter-spacing: 0.3px;
}

body.rtl .customer-card h3,
body.rtl .product-card h3 {
  font-size: 19px;
  line-height: 1.8;
}

.customer-card p,
.product-card p {
  font-size: 15px;
  color: #555;
  margin: 8px 0;
  font-weight: 500;
}

body.rtl .customer-card p,
body.rtl .product-card p {
  font-size: 14px;
  line-height: 1.7;
}

/* 交易列表 */
.transaction-list {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.8);
}

.transaction-item {
  padding: 20px 24px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  margin-bottom: 12px;
  border-radius: 14px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.06);
  transition: all 0.2s ease;
}

.transaction-item:hover {
  background: #f8f9fa;
  transform: translateX(4px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}

body.rtl .transaction-item {
  flex-direction: row-reverse;
  text-align: right;
  padding: 20px 22px;
}

body.rtl .transaction-item:hover {
  transform: translateX(-4px);
}

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

.transaction-info {
  flex: 1;
}

.transaction-info h4 {
  font-size: 18px;
  margin-bottom: 8px;
  color: #333;
  font-weight: 600;
}

body.rtl .transaction-info h4 {
  font-size: 17px;
  line-height: 1.8;
}

.transaction-info p {
  font-size: 14px;
  color: #666;
  margin: 4px 0;
  line-height: 1.6;
}

body.rtl .transaction-info p {
  font-size: 13px;
  line-height: 1.7;
}

.transaction-amount {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary-color);
  background: linear-gradient(135deg, #2196F3, #1976D2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

body.rtl .transaction-amount {
  font-size: 19px;
}

/* 模态框 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

body.rtl .modal {
  direction: rtl;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--card-bg);
  padding: 30px;
  border-radius: 12px;
  max-width: 400px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

body.rtl .modal-content {
  text-align: right;
  padding: 30px 25px;
}

.modal-content h2 {
  margin-bottom: 20px;
  font-size: 22px;
}

body.rtl .modal-content h2 {
  font-size: 20px;
}

.modal-content input {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 16px;
  margin-bottom: 15px;
}

body.rtl .modal-content input {
  font-size: 15px;
  text-align: right;
  padding: 12px 15px;
}

.modal-content p {
  margin-bottom: 15px;
  font-size: 16px;
}

body.rtl .modal-content p {
  font-size: 15px;
  line-height: 1.8;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

body.rtl .modal-actions {
  flex-direction: row-reverse;
}

.modal-actions button {
  flex: 1;
}

/* 筛选区域 */
.filter-section {
  margin-bottom: 20px;
  padding: 15px;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

body.rtl .filter-group {
  flex-direction: row-reverse;
}

.filter-group label {
  font-weight: 500;
  margin: 0;
  white-space: nowrap;
}

.filter-date {
  padding: 8px 12px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
}

body.rtl .filter-date {
  font-size: 13px;
  text-align: right;
}

.filter-group .btn-secondary {
  margin: 0;
  padding: 8px 16px;
  white-space: nowrap;
}

.empty-message {
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-size: 16px;
}

body.rtl .empty-message {
  font-size: 15px;
}

/* 筛选区域 */
.filter-section {
  margin-bottom: 20px;
  padding: 15px;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

body.rtl .filter-group {
  flex-direction: row-reverse;
}

.filter-group label {
  font-weight: 500;
  margin: 0;
  white-space: nowrap;
}

.filter-date {
  padding: 8px 12px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
}

body.rtl .filter-date {
  font-size: 13px;
  text-align: right;
}

.filter-group .btn-secondary {
  margin: 0;
  padding: 8px 16px;
  white-space: nowrap;
}

.empty-message {
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-size: 16px;
}

body.rtl .empty-message {
  font-size: 15px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .app-container {
    padding: 15px;
  }

  h1 {
    font-size: 24px;
  }

  body.rtl h1 {
    font-size: 22px;
  }

  /* 手机端统计卡片：3列并排显示 */
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }

  /* 手机端客户/商品列表：3列并排显示 */
  .customers-list,
  .products-list {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }

  /* 手机端统计卡片字体调整（3列布局需要更紧凑） */
  .stat-card {
    padding: 12px 6px;
  }

  .stat-card h3 {
    font-size: 9px;
    margin-bottom: 6px;
    line-height: 1.2;
    word-break: break-word;
    white-space: normal;
  }

  .stat-value {
    font-size: 15px;
    line-height: 1.2;
  }

  body.rtl .stat-card h3 {
    font-size: 8px;
    line-height: 1.3;
  }

  /* 手机端维吾尔文金额数字 */
  body.rtl .stat-value {
    font-size: 22px;
  }

  body.rtl .transaction-amount {
    font-size: 17px;
  }

  /* 手机端客户/商品卡片字体调整（3列布局需要更紧凑） */
  .customer-card,
  .product-card {
    padding: 12px 6px;
  }

  .customer-card h3,
  .product-card h3 {
    font-size: 13px;
    margin-bottom: 6px;
    line-height: 1.3;
    word-break: break-word;
    white-space: normal;
  }

  .customer-card p,
  .product-card p {
    font-size: 11px;
    margin: 3px 0;
    line-height: 1.4;
  }

  body.rtl .customer-card h3,
  body.rtl .product-card h3 {
    font-size: 12px;
    line-height: 1.4;
  }

  body.rtl .customer-card p,
  body.rtl .product-card p {
    font-size: 10px;
    line-height: 1.5;
  }

  .language-switcher {
    padding: 6px;
    gap: 3px;
    margin-bottom: 15px;
  }

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

  /* 手机端日期输入框优化 */
  input[type="date"] {
    width: 100%;
    max-width: 100%;
    font-size: 16px !important; /* 防止iOS缩放 */
    padding: 12px;
    -webkit-appearance: none;
    appearance: none;
    min-height: 44px; /* iOS推荐的最小触摸目标 */
    box-sizing: border-box;
  }

  /* 确保日期选择器在移动端正常显示 */
  input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 1;
    width: 24px;
    height: 24px;
    cursor: pointer;
    margin-left: 8px;
    padding: 0;
  }

  body.rtl input[type="date"]::-webkit-calendar-picker-indicator {
    margin-left: 0;
    margin-right: 8px;
  }

  /* 日期输入框在移动端的显示优化 */
  #date-input {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    display: block;
  }

  /* 确保日期输入框文本可读 */
  input[type="date"]::-webkit-datetime-edit {
    padding: 0;
    display: flex;
    align-items: center;
  }

  input[type="date"]::-webkit-datetime-edit-fields-wrapper {
    flex: 1;
  }

  input[type="date"]::-webkit-datetime-edit-text {
    padding: 0 4px;
  }
}

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

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

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

