/* 紫色渐变主题 - 工厂生产跟单系统 */
:root {
  --primary: #7c3aed;
  --primary-dark: #6d28d9;
  --primary-light: #a78bfa;
  --primary-bg: #f5f3ff;
  --gradient: linear-gradient(135deg, #7c3aed, #a78bfa);
  --gradient-dark: linear-gradient(135deg, #6d28d9, #8b5cf6);
  --text: #1f2937;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --bg: #f9fafb;
  --card: #ffffff;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --info: #3b82f6;
}

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

body {
  font-family: '微软雅黑', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 70px;
}

/* Login Page */
.login-page {
  min-height: 100vh;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-box {
  background: white;
  border-radius: 16px;
  padding: 32px 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(124,58,237,0.3);
}
.login-box h1 {
  text-align: center;
  font-size: 20px;
  margin-bottom: 4px;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.login-box .subtitle {
  text-align: center;
  color: var(--text-light);
  font-size: 12px;
  margin-bottom: 24px;
}
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text);
}
.form-group input, .form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  gap: 6px;
}
.btn-primary {
  background: var(--gradient);
  color: white;
  width: 100%;
  padding: 12px;
  font-size: 15px;
}
.btn-primary:hover { opacity: 0.9; }
.btn-secondary {
  background: var(--primary-bg);
  color: var(--primary);
  border: 1px solid var(--primary-light);
}
.btn-secondary:hover { background: #ede9fe; }
.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 8px; font-size: 11px; border-radius: 4px; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Header */
.app-header {
  background: var(--gradient);
  color: white;
  padding: 14px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-header h2 { font-size: 16px; font-weight: 600; }
.app-header .user-info { font-size: 12px; opacity: 0.9; }
.header-actions { display: flex; gap: 8px; align-items: center; }
.header-actions .btn { background: rgba(255,255,255,0.2); color: white; padding: 6px 12px; font-size: 12px; }

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  overflow-x: auto;
  background: white;
  border-bottom: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
  position: sticky;
  top: 48px;
  z-index: 99;
}
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tab {
  flex-shrink: 0;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-light);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}
.nav-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.nav-tab .badge {
  display: inline-block;
  background: var(--danger);
  color: white;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 4px;
}

/* Content Sections */
.section { display: none; padding: 12px; }
.section.active { display: block; }
.section-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

/* Cards */
.card {
  background: var(--card);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid var(--border);
}
.card-title { font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.card-meta { font-size: 12px; color: var(--text-light); }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 600px;
}
table th {
  background: var(--primary-bg);
  color: var(--primary-dark);
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 2px solid var(--primary-light);
}
table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table tr:hover td { background: #faf5ff; }
table .actions { display: flex; gap: 4px; flex-wrap: wrap; }

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}
.status-pending { background: #fef3c7; color: #92400e; }
.status-shipped { background: #dbeafe; color: #1e40af; }
.status-received { background: #d1fae5; color: #065f46; }

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-content {
  background: white;
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-content h3 {
  font-size: 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.modal-actions {
  display: flex;
  gap: 8px;
  margin: 16px auto 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  width: 70%;
}
.modal-actions .btn { flex: 1; }

/* Alert / Reminder */
.alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert-danger { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

/* Form grid */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.form-row .form-group { margin-bottom: 0; }

/* Material row in cutting form */
.mat-row {
  border: 1px solid var(--border);
}
.mat-row-inner {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* Color row - improve size input styling */
.color-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  background: var(--bg);
}
.color-row .cr-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.color-row .cr-header input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}

.size-inputs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.size-inputs .size-item {
  text-align: center;
}
.size-inputs .size-item label {
  display: block;
  font-size: 11px;
  color: var(--text-light);
  margin-bottom: 2px;
}
.size-inputs .size-item input {
  width: 100%;
  text-align: center;
  padding: 8px 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
  font-size: 14px;
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }

/* Checkbox list */
.checkbox-list { display: flex; flex-direction: column; gap: 6px; }
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 6px;
  cursor: pointer;
}
.checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}
.checkbox-item .item-detail { flex: 1; }
.checkbox-item .item-detail .name { font-weight: 500; }
.checkbox-item .item-detail .meta { font-size: 11px; color: var(--text-light); }

/* Material list in cutting sheet detail */
.material-list { display: flex; flex-direction: column; gap: 6px; }
.material-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 6px;
  font-size: 12px;
}
.material-item .mat-name { font-weight: 500; }
.material-item .mat-qty { color: var(--text-light); }
.material-item .mat-price { color: var(--primary); font-weight: 500; }

/* Delivery date input in supplier view */
.date-input-group {
  display: flex;
  gap: 8px;
  align-items: center;
}
.date-input-group input[type="date"] {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}

/* Responsive */
@media (min-width: 768px) {
  body { max-width: 768px; margin: 0 auto; }
  .modal-content { border-radius: 16px; }
  .modal-overlay.show { align-items: center; }
}
