/* =============================================
   Transaction Page — White Theme
   ============================================= */

.transaction-wrapper { max-width: 820px; margin: 0 auto; }

/* Step Card */
.step-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-light);
  border-radius: var(--r-xl);
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
}

.step-card-locked {
  opacity: 0.55;
  pointer-events: none;
}

.step-card.step-complete {
  border-color: #bbf7d0;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.08), var(--shadow-xs);
}

.step-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-light);
  cursor: default;
  background: var(--bg-muted);
  transition: background 0.2s;
  border-top-left-radius: calc(var(--r-xl) - 1.5px);
  border-top-right-radius: calc(var(--r-xl) - 1.5px);
}

.step-card:not(.step-card-locked) .step-header { background: var(--bg-surface); }
.step-card.step-complete .step-header { background: #f0fdf4; }

.step-number {
  width: 32px; height: 32px;
  background: var(--bg-muted);
  border: 2px solid var(--border-normal);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: var(--transition);
}

.step-card:not(.step-card-locked) .step-number {
  background: var(--accent-light);
  border-color: rgba(99,102,241,0.4);
  color: var(--accent-dark);
}

.step-card.step-complete .step-number {
  background: var(--green-bg);
  border-color: #86efac;
  color: var(--green);
}

.step-info { flex: 1; }

.step-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.step-desc { font-size: 12.5px; color: var(--text-muted); }

.step-status {
  font-size: 18px;
  min-width: 24px;
  text-align: center;
}

.step-body { padding: 22px; }

/* ─── Autocomplete ─────────────────────────── */
.autocomplete-wrapper { position: relative; }

.autocomplete-input { padding-left: 40px !important; padding-right: 32px !important; }

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-light);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  max-height: 320px;
  overflow-y: auto;
  display: none;
}

.autocomplete-dropdown.open { display: block; animation: dropdownIn 0.18s ease; }

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ac-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  cursor: pointer;
  transition: background 0.12s;
  border-bottom: 1px solid var(--border-light);
}

.ac-item:last-child { border-bottom: none; }
.ac-item:hover, .ac-item.highlighted { background: var(--bg-hover); }

.ac-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: white;
  flex-shrink: 0;
}

.ac-info { flex: 1; }
.ac-name { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.ac-plate {
  font-size: 11.5px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  margin-top: 1px;
}

.ac-right { text-align: right; }
.ac-balance { font-size: 13px; font-weight: 700; }
.ac-balance.positive { color: var(--red); }
.ac-balance.zero { color: var(--green); }

.ac-no-results {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}

/* ─── Customer Limit Alert ─────────────────── */
.customer-limit-alert {
  margin-top: 14px;
  border-radius: var(--r-lg);
  padding: 16px;
  border: 1.5px solid var(--border-light);
  background: var(--bg-muted);
  animation: alertIn 0.3s ease;
}

@keyframes alertIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alert-critical {
  background: #fff5f5;
  border-color: #fecdd3;
  animation: pulseCritical 2.2s ease infinite;
}
.alert-medium { background: #fffbf0; border-color: #fde68a; }
.alert-ok     { background: #f0fdf4; border-color: #bbf7d0; }

@keyframes pulseCritical {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.2); }
  50%       { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}

.limit-alert-inner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.limit-alert-icon { font-size: 22px; flex-shrink: 0; }
.limit-alert-body { flex: 1; }

.limit-alert-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.limit-alert-text {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.limit-bars { margin-top: 12px; }

.limit-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 5px;
}

.limit-bar-track {
  height: 7px;
  background: var(--bg-hover);
  border-radius: 4px;
  overflow: hidden;
}

.limit-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.limit-bar-fill.medium { background: var(--amber); }
.limit-bar-fill.high { background: var(--red); }

.limit-figures {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 6px;
}
.limit-figures strong { color: var(--text-primary); font-weight: 700; }

/* ─── Selected Customer Card ──────────────── */
.selected-customer-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--accent-light);
  border: 1.5px solid rgba(99,102,241,0.25);
  border-radius: var(--r-lg);
  margin-top: 14px;
  animation: alertIn 0.25s ease;
}

.sc-avatar {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: white;
  flex-shrink: 0;
}

.sc-info { flex: 1; }
.sc-name { font-size: 14.5px; font-weight: 700; color: var(--text-primary); }
.sc-plate {
  font-size: 12.5px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent-dark);
  font-weight: 600;
  margin-top: 1px;
}
.sc-phone { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

.sc-change-btn {
  background: white;
  border: 1px solid var(--border-normal);
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.sc-change-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ─── Type Buttons ─────────────────────────── */
.transaction-type-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 22px 16px;
  border: 2px solid var(--border-light);
  border-radius: var(--r-xl);
  background: var(--bg-muted);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Inter', sans-serif;
}

.type-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.type-btn:disabled { cursor: not-allowed; opacity: 0.4; }

.type-btn-debt.selected  {
  border-color: #fca5a5;
  background: var(--red-bg);
  box-shadow: 0 0 0 4px rgba(220,38,38,0.08), var(--shadow-sm);
  transform: translateY(-2px);
}
.type-btn-payment.selected {
  border-color: #86efac;
  background: var(--green-bg);
  box-shadow: 0 0 0 4px rgba(22,163,74,0.08), var(--shadow-sm);
  transform: translateY(-2px);
}

.type-btn-icon { font-size: 36px; }
.type-btn-label { font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
.type-btn-debt.selected .type-btn-label  { color: var(--red); }
.type-btn-payment.selected .type-btn-label { color: var(--green); }
.type-btn:not(.selected) .type-btn-label { color: var(--text-secondary); }

.type-btn-sub { font-size: 11.5px; color: var(--text-muted); font-weight: 500; }

/* ─── Detail Fields ────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group-full { grid-column: 1 / -1; }

.step3-placeholder {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
  background: var(--bg-muted);
  border-radius: var(--r-md);
  border: 1.5px dashed var(--border-normal);
}

/* Calc Preview */
.calc-preview {
  margin-top: 16px;
  background: var(--accent-light);
  border: 1.5px solid rgba(99,102,241,0.2);
  border-radius: var(--r-lg);
  padding: 14px 18px;
  animation: alertIn 0.2s ease;
}

.calc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(99,102,241,0.1);
}
.calc-row:last-child { border-bottom: none; }

.calc-row-total {
  font-weight: 700;
  font-size: 15px;
  padding-top: 10px;
  margin-top: 4px;
  color: var(--text-primary) !important;
}

.calc-row strong { color: var(--text-primary); font-weight: 700; }
.calc-row-total strong { color: var(--accent-dark); font-size: 17px; }

/* ─── Confirm Summary ──────────────────────── */
.confirm-summary {
  background: var(--bg-muted);
  border: 1.5px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: 18px;
  margin-bottom: 18px;
  animation: alertIn 0.2s ease;
}

.summary-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

.summary-grid { display: flex; flex-direction: column; gap: 8px; }

.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-light);
}
.summary-item:last-child { border-bottom: none; }

.summary-item-label { font-size: 12.5px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.summary-item-value { font-size: 13.5px; font-weight: 700; color: var(--text-primary); }

.summary-enc-note {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  padding: 9px 12px;
  background: var(--accent-light);
  border-radius: var(--r-md);
  font-size: 12px;
  color: var(--accent-dark);
  font-weight: 500;
}

/* ─── Confirm Actions ──────────────────────── */
.confirm-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.btn-reset {
  background: var(--bg-muted);
  border: 1.5px solid var(--border-light);
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: var(--transition);
}
.btn-reset:hover { background: var(--red-bg); border-color: #fecdd3; color: var(--red); }

.btn-confirm {
  flex: 1;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  border: none;
  color: white;
  font-family: 'Inter', sans-serif;
  font-size: 14.5px;
  font-weight: 800;
  padding: 13px 26px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  letter-spacing: -0.01em;
}

.btn-confirm:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99,102,241,0.35);
}

.btn-confirm:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-confirm-icon { font-size: 15px; }
.btn-confirm-loading { font-size: 13.5px; font-style: normal; }

/* Mobile adjustments */
@media (max-width: 920px) {
  .transaction-wrapper { max-width: 100%; }
}

@media (max-width: 640px) {
  .detail-grid { grid-template-columns: 1fr; }
  .transaction-type-selector { grid-template-columns: 1fr; gap: 10px; }

  /* Horizontal type buttons on mobile */
  .type-btn {
    flex-direction: row;
    padding: 14px 18px;
    gap: 12px;
    align-items: center;
    text-align: left;
  }
  .type-btn-icon { font-size: 26px; flex-shrink: 0; }
  .type-btn-label { font-size: 13.5px; }
  .type-btn-sub { font-size: 11px; }

  /* Step body compact */
  .step-body { padding: 16px; }
  .step-header { padding: 14px 16px; gap: 10px; }
  .step-number { width: 28px; height: 28px; font-size: 12px; }
  .step-title { font-size: 14px; }

  /* Confirm actions full-width */
  .confirm-actions { flex-direction: column; }
  .btn-confirm, .btn-reset { width: 100%; }
  .btn-confirm { font-size: 14px; padding: 13px 20px; }

  /* Calc preview compact */
  .calc-preview { padding: 12px 14px; }
  .calc-row { font-size: 12.5px; }
  .calc-row-total { font-size: 14px; }

  /* Selected customer card */
  .selected-customer-card { flex-wrap: wrap; gap: 10px; }
  .sc-change-btn { width: 100%; text-align: center; padding: 9px 0; }

  /* Autocomplete dropdown */
  .autocomplete-dropdown { max-height: 240px; }
  .ac-item { padding: 10px 12px; }
  
  /* Collapsible section */
  .collapsible-toggle-btn {
    padding: 10px 14px !important;
    font-size: 13px !important;
  }
  
  /* Input groups */
  .input-group {
    flex-direction: row;
  }
  
  .form-input,
  .form-select,
  .form-textarea {
    font-size: 16px !important; /* Prevent iOS zoom */
  }
  
  /* Step card */
  .step-card {
    margin-bottom: 12px;
  }
  
  /* Transaction wrapper */
  .transaction-wrapper {
    padding: 0;
  }
  
  /* Limit alert */
  .customer-limit-alert {
    padding: 12px;
  }
  
  .limit-alert-inner {
    flex-direction: column;
    gap: 10px;
  }
  
  .limit-alert-icon {
    font-size: 20px;
  }
  
  .limit-alert-title {
    font-size: 13px;
  }
  
  .limit-alert-text {
    font-size: 12px;
  }
  
  /* Limit bars */
  .limit-bars {
    margin-top: 10px;
  }
  
  .limit-bar-label {
    font-size: 10px;
  }
  
  .limit-figures {
    font-size: 10.5px;
    flex-direction: column;
    gap: 4px;
  }
  
  /* Debt info container */
  .debt-info-container {
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }
  
  .debt-info-container > div:first-child {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  
  .btn-pay-all {
    width: 100%;
    justify-content: center;
    padding: 10px 16px;
  }
  
  /* Payment type selector */
  #payment-form-fields .detail-grid {
    gap: 12px;
  }
  
  /* Debt form fields */
  #debt-form-fields .detail-grid {
    gap: 12px;
  }
  
  /* Calc preview */
  .calc-preview {
    margin-top: 12px;
  }
  
  /* Summary */
  .confirm-summary {
    padding: 14px;
    margin-bottom: 14px;
  }
  
  .summary-title {
    font-size: 13px;
    margin-bottom: 12px;
    padding-bottom: 8px;
  }
  
  .summary-item {
    padding: 5px 0;
  }
  
  .summary-item-label {
    font-size: 11.5px;
  }
  
  .summary-item-value {
    font-size: 12.5px;
  }
  
  .summary-enc-note {
    padding: 8px 10px;
    font-size: 11px;
  }
}

@media (max-width: 400px) {
  .step-body { padding: 14px; }
  .type-btn { padding: 12px 14px; }
  .step-header { padding: 12px 14px; }
  
  .step-title {
    font-size: 13px;
  }
  
  .step-desc {
    font-size: 11.5px;
  }
  
  .type-btn-icon {
    font-size: 24px;
  }
  
  .type-btn-label {
    font-size: 13px;
  }
  
  .type-btn-sub {
    font-size: 10.5px;
  }
  
  .ac-item {
    padding: 8px 10px;
    gap: 10px;
  }
  
  .ac-avatar {
    width: 32px;
    height: 32px;
    font-size: 11px;
  }
  
  .ac-name {
    font-size: 13px;
  }
  
  .ac-plate {
    font-size: 11px;
  }
  
  .ac-balance {
    font-size: 12px;
  }
  
  .sc-avatar {
    width: 38px;
    height: 38px;
    font-size: 13px;
  }
  
  .sc-name {
    font-size: 13.5px;
  }
  
  .sc-plate {
    font-size: 12px;
  }
  
  .sc-phone {
    font-size: 11px;
  }
}


/* Debt Info Card under Payment */
.debt-info-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-radius: var(--r-lg);
  margin-top: 4px;
  animation: alertIn 0.25s ease;
}

.btn-pay-all {
  background: var(--red);
  color: white;
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 3px 8px rgba(239, 68, 68, 0.2);
}

.btn-pay-all:hover {
  background: #dc2626;
  transform: translateY(-1.5px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

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

