/* =========================================================
   Transaction History Layout & Card-based System
   ========================================================= */
.tx-main-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color-muted);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  width: 100%;
  box-sizing: border-box;
}

/* Backward compatibility for subpages using .tx-table-card */
.tx-table-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color-muted);
  border-radius: var(--radius-md);
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

/* Total count pill in header */
.badge-mgmt-pill {
  background: rgba(158, 240, 26, 0.08);
  border: 1px solid rgba(158, 240, 26, 0.2);
  color: var(--accent);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}

/* Filter Tabs */
.tx-tab-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.tx-tab-container .tab-btn {
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border-radius: var(--radius-xs);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tx-tab-container .tab-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.12);
}

.tx-tab-container .tab-btn.active {
  color: var(--accent);
  background-color: rgba(158, 240, 26, 0.08);
  border-color: rgba(158, 240, 26, 0.25);
  font-weight: 600;
}

/* Desktop Table Column Legend */
.tx-table-header {
  display: grid;
  grid-template-columns: 2.2fr 1.5fr 1.8fr 1.2fr 1fr;
  align-items: center;
  padding: 12px 16px;
  background-color: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.tx-col-action {
  text-align: right;
}

/* Transaction List & Rows */
.tx-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.tx-card-row {
  display: grid;
  grid-template-columns: 2.2fr 1.5fr 1.8fr 1.2fr 1fr;
  align-items: center;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
  box-sizing: border-box;
}

@media (min-width: 769px) {
  .tx-row-part,
  .tx-mobile-actions {
    display: contents;
  }
}

.tx-card-row:hover {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(158, 240, 26, 0.18);
  transform: translateY(-1px);
}

/* Standard Deposit/Withdrawal history tx-row layout */
.tx-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background-color var(--transition-fast);
  width: 100%;
  box-sizing: border-box;
  gap: 10px;
  cursor: pointer;
}

.tx-row:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

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

.tx-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.tx-icon-circle {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.tx-text-group {
  min-width: 0;
  overflow: hidden;
}

.tx-text-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
}

.tx-date {
  color: #6c757d;
  font-size: 12px;
}

.tx-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  text-align: right;
}

.tx-badge {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}

/* 1. Transaction Type (Icon + Name) */
.tx-col-type-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.tx-type-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.tx-type-deposit {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.tx-type-withdraw {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.tx-type-investment {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.tx-type-conversion {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.tx-type-transfer {
  background: rgba(168, 85, 247, 0.12);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.25);
}

.tx-type-meta {
  min-width: 0;
  overflow: hidden;
}

.tx-type-label {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-type-sub {
  font-size: 11px;
  color: var(--text-secondary);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* 2. Amount */
.tx-col-amount-cell {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: -0.2px;
}

.tx-amount-pos {
  color: #22c55e;
}

.tx-amount-neg {
  color: #ef4444;
}

.tx-amount-neutral {
  color: #ffffff;
}

.tx-amount-warn {
  color: #f59e0b;
}

/* 3. Date & Time */
.tx-col-date-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tx-date-primary {
  font-size: 13px;
  font-weight: 500;
  color: #e5e7eb;
}

.tx-date-time {
  font-size: 11px;
  color: var(--text-secondary);
}

/* 4. Status */
.tx-col-status-cell {
  display: flex;
  align-items: center;
}

.tx-status-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-transform: capitalize;
  white-space: nowrap;
}

.tx-status-completed-pill {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.tx-status-active-pill {
  background: rgba(158, 240, 26, 0.1);
  color: var(--accent);
  border: 1px solid rgba(158, 240, 26, 0.25);
}

.tx-status-pending-pill {
  background: rgba(234, 179, 8, 0.1);
  color: #eab308;
  border: 1px solid rgba(234, 179, 8, 0.2);
}

.tx-status-cancelled-pill {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* 5. Action ("View" button) */
.tx-col-action-cell {
  text-align: right;
  display: flex;
  justify-content: flex-end;
}

.btn-tx-view {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-tx-view:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(158, 240, 26, 0.06);
}

/* Responsive Mobile Rules */
@media (max-width: 768px) {
  .d-none-mobile {
    display: none !important;
  }
  
  .tx-tab-container {
    gap: 4px;
  }

  .tx-tab-container .tab-btn {
    padding: 7px 4px;
    font-size: 9px;
  }

  .tx-card-row,
  .tx-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
  }

  .tx-mobile-top-line,
  .tx-row-part-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 12px;
  }

  .tx-mobile-bottom-line,
  .tx-row-part-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    padding-top: 8px;
    gap: 8px;
  }

  .tx-mobile-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }

  .tx-col-amount-cell {
    text-align: right;
    flex-shrink: 0;
  }

  .tx-col-action-cell {
    margin-left: 0;
  }

  .btn-tx-view {
    padding: 4px 8px;
    font-size: 11px;
  }
}

/* =========================================================
   Transaction Details Receipt Modal (Reference Design Fidelity)
   ========================================================= */
.tx-receipt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #040705;
  z-index: 100000;
  overflow-y: auto;
  padding: 18px 20px 48px;
  box-sizing: border-box;
  animation: fadeIn 0.2s ease-out;
}

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

.tx-receipt-container {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.tx-receipt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 12px;
}

.tx-receipt-back-btn {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast);
}

.tx-receipt-back-btn:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.tx-receipt-title {
  font-size: 17px;
  font-weight: 600;
  color: #ffffff;
  margin: 0;
  text-align: center;
  flex: 1;
}

.tx-receipt-hero {
  text-align: center;
  margin-bottom: 34px;
  padding: 8px 0;
}

.tx-receipt-hero-label {
  font-size: 13px;
  color: #8c958f;
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.tx-receipt-amount {
  font-size: 32px;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 10px 0;
  letter-spacing: -0.5px;
}

.tx-receipt-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}

.tx-status-completed {
  color: #22c55e;
}

.tx-status-pending {
  color: #eab308;
}

.tx-status-cancelled {
  color: #ef4444;
}

.tx-receipt-rows {
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: 100%;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 26px;
}

.tx-receipt-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  font-size: 14px;
}

.tx-receipt-key {
  color: #8c958f;
  font-weight: 400;
  flex-shrink: 0;
  min-width: 130px;
}

.tx-receipt-val {
  color: #ffffff;
  font-weight: 500;
  text-align: right;
  word-break: break-all;
  max-width: 65%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.copy-icon-btn {
  background: none;
  border: none;
  color: #8c958f;
  cursor: pointer;
  padding: 2px 4px;
  font-size: 13px;
  transition: color 0.15s;
  display: inline-flex;
  align-items: center;
}

.copy-icon-btn:hover {
  color: var(--accent);
}

/* Toast alert when copied */
.tx-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(20, 30, 22, 0.95);
  border: 1px solid var(--accent);
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  z-index: 100001;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  animation: toastFade 0.2s ease-out;
}

@keyframes toastFade {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}