/* ==========================================================================
   Header Component
   ========================================================================== */

.header {
  background: var(--color-white);
  padding: var(--space-lg);
  padding-top: calc(var(--space-lg) + var(--safe-area-top));
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-title {
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.header-back {
  width: 2.4rem;
  height: 2.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-primary);
  font-size: 2.0rem;
}

.header-user {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.user-avatar {
  width: 4.0rem;
  height: 4.0rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.6rem;
  font-weight: 600;
}

.user-info h3 {
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.user-info p {
  font-size: 1.2rem;
  color: var(--color-text-secondary);
}

/* ==========================================================================
   Card Component
   ========================================================================== */

.card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-lg);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.card-title {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.card-more {
  font-size: 1.2rem;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   Stat Card Component
   ========================================================================== */

.stat-card {
  background: linear-gradient(135deg, var(--gradient-start, #667eea) 0%, var(--gradient-end, #764ba2) 100%);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  color: white;
  text-align: center;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s ease;
}

.stat-card:active {
  transform: scale(0.98);
}

.stat-icon {
  font-size: 2.4rem;
  margin-bottom: var(--space-sm);
  opacity: 0.9;
}

.stat-number {
  font-size: 2.4rem;
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.stat-label {
  font-size: 1.2rem;
  opacity: 0.85;
}

/* Stat Card Color Variants */
.stat-card.primary {
  --gradient-start: #1989fa;
  --gradient-end: #0d6ecd;
}

.stat-card.success {
  --gradient-start: #07c160;
  --gradient-end: #05a450;
}

.stat-card.warning {
  --gradient-start: #ff976a;
  --gradient-end: #ff7043;
}

.stat-card.danger {
  --gradient-start: #ee0a24;
  --gradient-end: #c4001d;
}

/* ==========================================================================
   Button Component
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem 2.4rem;
  font-size: 1.4rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  user-select: none;
}

.btn:active {
  transform: scale(0.98);
  opacity: 0.8;
}

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

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

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

.btn-danger {
  background: var(--color-danger);
  color: white;
}

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

.btn-block {
  width: 100%;
  display: flex;
}

.btn-lg {
  padding: 1.6rem 3.2rem;
  font-size: 1.6rem;
}

.btn-sm {
  padding: 0.8rem 1.6rem;
  font-size: 1.2rem;
}

.btn-group {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

/* ==========================================================================
   Quick Action Buttons
   ========================================================================== */

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.action-btn {
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  text-align: center;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-btn:active {
  transform: translateY(2px);
  box-shadow: var(--shadow-sm);
}

.action-icon {
  width: 4.8rem;
  height: 4.8rem;
  margin: 0 auto var(--space-md);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
}

.action-icon.primary {
  background: linear-gradient(135deg, #1989fa 0%, #0d6ecd 100%);
  color: white;
}

.action-icon.success {
  background: linear-gradient(135deg, #07c160 0%, #05a450 100%);
  color: white;
}

.action-text {
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--color-text-primary);
}

/* ==========================================================================
   Status Badge Component
   ========================================================================== */

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 1.0rem;
  border-radius: 1.2rem;
  font-size: 1.2rem;
  font-weight: 500;
  white-space: nowrap;
}

.status-badge.pending {
  background: #fff7e6;
  color: #ff976a;
}

.status-badge.approved {
  background: #e6f9f0;
  color: #07c160;
}

.status-badge.rejected {
  background: #ffe6e6;
  color: #ee0a24;
}

.status-badge.draft {
  background: #f5f5f5;
  color: #909399;
}

.status-badge-lg {
  padding: 0.8rem 2.0rem;
  font-size: 1.4rem;
  border-radius: 2.0rem;
}

/* ==========================================================================
   Bottom Navigation
   ========================================================================== */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-white);
  border-top: 1px solid var(--color-border);
  display: flex;
  padding-bottom: var(--safe-area-bottom);
  z-index: 1000;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm) var(--space-xs);
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--color-text-secondary);
  position: relative;
}

.nav-item.active {
  color: var(--color-primary);
}

.nav-item:active {
  background: var(--color-background);
}

.nav-icon {
  font-size: 2.2rem;
  margin-bottom: var(--space-xs);
}

.nav-label {
  font-size: 1.0rem;
}

/* ==========================================================================
   Tab Bar Component
   ========================================================================== */

.tab-bar {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-xs);
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
  box-shadow: var(--shadow-sm);
}

.tab-item {
  flex: 1;
  padding: var(--space-sm);
  text-align: center;
  font-size: 1.4rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--color-text-secondary);
  font-weight: 500;
}

.tab-item.active {
  background: var(--color-primary);
  color: white;
}

/* ==========================================================================
   Form Components
   ========================================================================== */

.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-size: 1.4rem;
  color: var(--color-text-primary);
  margin-bottom: var(--space-sm);
  font-weight: 500;
}

.form-label.required::after {
  content: '*';
  color: var(--color-danger);
  margin-left: 4px;
}

.input {
  width: 100%;
  padding: 1.2rem var(--space-lg);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 1.4rem;
  color: var(--color-text-primary);
  transition: border-color 0.2s ease;
}

.input:focus {
  border-color: var(--color-primary);
}

.input::placeholder {
  color: var(--color-text-placeholder);
}

.select {
  width: 100%;
  padding: 1.2rem var(--space-lg);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 1.4rem;
  color: var(--color-text-primary);
  cursor: pointer;
  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='%23969799' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1.6rem center;
  padding-right: 4.0rem;
}

.textarea {
  width: 100%;
  min-height: 8.0rem;
  padding: 1.2rem var(--space-lg);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 1.4rem;
  color: var(--color-text-primary);
  resize: vertical;
}

.textarea:focus {
  border-color: var(--color-primary);
}

/* ==========================================================================
   Step Indicator Component
   ========================================================================== */

.step-indicator {
  display: flex;
  align-items: center;
  padding: var(--space-2xl) var(--space-lg);
  background: var(--color-white);
  margin-bottom: var(--space-lg);
}

.step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.step::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 1.6rem;
  width: 100%;
  height: 2px;
  background: var(--color-border);
  z-index: 0;
}

.step:last-child::after {
  display: none;
}

.step.completed::after,
.step.active::after {
  background: var(--color-primary);
}

.step-number {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 50%;
  background: var(--color-background);
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--color-text-placeholder);
  margin-bottom: var(--space-sm);
  position: relative;
  z-index: 1;
}

.step.active .step-number {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.step.completed .step-number {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.step-label {
  font-size: 1.2rem;
  color: var(--color-text-secondary);
  text-align: center;
}

.step.active .step-label {
  color: var(--color-primary);
  font-weight: 600;
}

/* ==========================================================================
   Order Item Component
   ========================================================================== */

.order-item {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.order-item:active {
  transform: scale(0.99);
  box-shadow: var(--shadow-md);
}

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.order-number {
  font-size: 1.4rem;
  color: var(--color-text-primary);
  font-weight: 500;
}

.order-body {
  margin-bottom: var(--space-md);
}

.order-shop {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--space-xs);
}

.order-amount {
  font-size: 2.0rem;
  font-weight: 700;
  color: var(--color-danger);
}

.order-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
}

.order-time {
  font-size: 1.2rem;
  color: var(--color-text-secondary);
}

/* ==========================================================================
   Product Item Component
   ========================================================================== */

.product-item {
  background: var(--color-white);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  border: 1px solid var(--color-border);
  transition: all 0.2s ease;
}

.product-checkbox {
  width: 2.0rem;
  height: 2.0rem;
  border: 2px solid var(--color-border);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}

.product-checkbox.checked {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.product-checkbox.checked::after {
  content: '✓';
  position: absolute;
  color: white;
  font-size: 1.4rem;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.product-info {
  flex: 1;
}

.product-name {
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--color-text-primary);
  margin-bottom: var(--space-xs);
}

.product-price {
  font-size: 1.6rem;
  color: var(--color-danger);
  font-weight: 600;
}

.product-quantity {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.qty-btn {
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 50%;
  background: var(--color-background);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  user-select: none;
}

.qty-btn:active {
  background: var(--color-border);
}

.qty-input {
  width: 4.0rem;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 500;
}

/* ==========================================================================
   Info Section Component
   ========================================================================== */

.info-section {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.info-title {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border);
}

.info-row {
  display: flex;
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--color-border);
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  width: 8.0rem;
  font-size: 1.4rem;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.info-value {
  flex: 1;
  font-size: 1.4rem;
  color: var(--color-text-primary);
  font-weight: 500;
}

/* ==========================================================================
   Timeline Component
   ========================================================================== */

.timeline {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.timeline-item {
  display: flex;
  gap: var(--space-md);
  position: relative;
  padding-bottom: var(--space-lg);
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 0.8rem;
  top: 2.4rem;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-dot {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--color-border);
  flex-shrink: 0;
  margin-top: 4px;
  position: relative;
  z-index: 1;
}

.timeline-item.active .timeline-dot {
  background: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(25, 137, 250, 0.2);
}

.timeline-content {
  flex: 1;
}

.timeline-title {
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--color-text-primary);
  margin-bottom: var(--space-xs);
}

.timeline-time {
  font-size: 1.2rem;
  color: var(--color-text-secondary);
}

/* ==========================================================================
   Empty State Component
   ========================================================================== */

.empty-state {
  text-align: center;
  padding: 6.0rem var(--space-lg);
}

.empty-icon {
  font-size: 6.4rem;
  color: var(--color-text-placeholder);
  margin-bottom: var(--space-lg);
  opacity: 0.4;
}

.empty-text {
  font-size: 1.4rem;
  color: var(--color-text-secondary);
}

/* ==========================================================================
   Loading & Pull to Refresh
   ========================================================================== */

.pull-refresh {
  text-align: center;
  padding: var(--space-md);
  color: var(--color-text-secondary);
  font-size: 1.2rem;
}

.load-more {
  text-align: center;
  padding: var(--space-lg);
  color: var(--color-text-secondary);
  font-size: 1.2rem;
}

/* ==========================================================================
   Cart Summary (Fixed Bottom)
   ========================================================================== */

.cart-summary {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-white);
  border-top: 1px solid var(--color-border);
  padding: var(--space-lg);
  padding-bottom: calc(var(--space-lg) + var(--safe-area-bottom));
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
  z-index: 999;
}

.cart-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.cart-label {
  font-size: 1.4rem;
  color: var(--color-text-secondary);
}

.cart-total {
  font-size: 2.0rem;
  font-weight: 700;
  color: var(--color-danger);
}

.cart-count {
  font-size: 1.2rem;
  color: var(--color-text-secondary);
  margin-left: var(--space-sm);
}
