/* ===== Withdrawal Processing Styles ===== */

/* Ensure admin header is always visible */
.admin-header {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1300;
}

/* Section header layout */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Statistics Cards */
.wallet-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 2px 12px var(--shadow);
  transition: background var(--transition), box-shadow var(--transition);
  text-align: center;
}

.stat-card:hover {
  box-shadow: 0 4px 20px var(--shadow);
}

.stat-card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-number {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}

/* Table Container */
.table-container {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 2px 12px var(--shadow);
  overflow: auto;
  max-height: 70vh; /* Allow scrolling if many rows */
  transition: background var(--transition), box-shadow var(--transition);
  margin: 0rem;
}

/* Orders Table */
.orders-table {
  width: 100%;
  border-collapse: collapse;
}

.orders-table thead {
  background: rgba(0, 0, 0, 0.05);
}

.orders-table th {
  padding: 1rem 0.75rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-color);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.orders-table td {
  padding: 1rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-color);
}

/* Prevent wrapping for timestamp cells or other compact columns */
.nowrap {
  white-space: nowrap;
}

.orders-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.status-warning {
  background: rgba(240, 176, 11, 0.1);
  color: #f0b90b;
}

.status-badge.status-info {
  background: rgba(123, 179, 255, 0.1);
  color: #7bb3ff;
}

.status-badge.status-success {
  background: rgba(14, 203, 129, 0.1);
  color: #0ecb81;
}

.status-badge.status-danger {
  background: rgba(246, 70, 93, 0.1);
  color: #f6465d;
}

.status-badge.status-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

/* Actions Column */
.actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #000000;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
}

/* Icon-only button */
.btn-icon-only {
  padding: 0.5rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}

.modal.active,
.modal.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px var(--shadow);
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  width: 600px;
  margin: 2rem;
}

.modal-large {
  width: 800px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-color);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: background var(--transition), color var(--transition);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
}

.modal-body {
  padding: 1.5rem;
}

/* Withdrawal Details */
.wd-details {
  display: grid;
  gap: 2rem;
}

.wd-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.wd-detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
}

.wd-detail-item label {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.wd-detail-item span {
  color: var(--text-color);
  font-size: 1rem;
}

/* Filters */
.filters-container {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  align-items: end;
  flex-wrap: wrap;
}

.filter-group {
  flex: 1;
  min-width: 200px;
  display: grid;
  gap: 0.5rem;
}

.filter-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-color);
}

.filter-input,
.filter-select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text-color);
  font-size: 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.filter-input:focus,
.filter-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 69, 109, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
  .wallet-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .modal-content {
    width: 95vw;
    margin: 1rem;
  }

  .wd-details-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .withdrawal-detail-modal .wd-modal-footer {
    flex-direction: column;
    align-items: stretch;
  }

  /* Mobile table styles - prevent header wrapping */
  .orders-table th {
    white-space: nowrap;
    font-size: 0.85rem;
    padding: 0.8rem 0.5rem;
  }
  
  .orders-table td {
    font-size: 0.85rem;
    padding: 0.8rem 0.5rem;
  }
  
  /* Specifically prevent wrapping for User ID and Withdrawal ID headers */
  .orders-table th:nth-child(1), /* User ID header */
  .orders-table th:nth-child(2), /* Withdrawal ID header */
  .orders-table th:nth-child(4), /* Wallet header */
  .orders-table th:nth-child(6) { /* Requested header */
    white-space: nowrap;
  }
  
  .orders-table td:nth-child(1), /* User ID data */
  .orders-table td:nth-child(2), /* Withdrawal ID data */
  .orders-table td:nth-child(4), /* Wallet data */
  .orders-table td:nth-child(6) { /* Requested data */
    white-space: nowrap;
  }
  
  /* Adjust table container for mobile */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ==========================================================================
   Withdrawal Modal - Base & Mobile-first
   ========================================================================== */

/* Modal overlay/backdrop */
.withdrawal-detail-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 1);
  z-index: 1200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* When shown */
.withdrawal-detail-modal.active {
  display: flex;
}

/* Main modal container */
.wd-modal-content {
  background: #0d1117 !important;
  border-radius: var(--radius);
  box-shadow: 0 10px 40px var(--shadow);
  width: 100%;
  max-width: 720px;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  margin-top: 1.5rem;
}

/* Header */
.wd-modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0d1117 !important;
  border-radius: var(--radius) var(--radius) 0 0;
}

.wd-modal-header h2 {
  margin: 0;
  font-size: 1.32rem;
  font-weight: 600;
  color: var(--text-color);
}

.wd-modal-close {
  background: none;
  border: none;
  font-size: 2.1rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--transition);
}

.wd-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--primary);
}

/* Body */
.wd-modal-body {
  padding: 24px;
  flex: 1;
  overflow-y: auto;
}

.wd-details {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Grid of details (2 columns on mobile, more on desktop) */
.wd-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
}

.wd-detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wd-detail-item label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.wd-detail-item span,
.wd-detail-item div {
  font-size: 0.96rem;
  font-weight: 500;
  color: var(--text-color);
  word-break: break-word;
}

.wd-status-section {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 1.5rem;
  margin-top: 1rem;
}

.refund-notice {
  display: none;
  gap: 0.75rem;
  align-items: flex-start;
  background: rgba(255, 193, 7, 0.1);
  border: 1px solid #ffc107;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  color: var(--text-color);
}

.refund-notice i {
  color: #ffc107;
  margin-top: 0.1rem;
}

.wd-note-hidden {
  display: none;
}

.wd-wallet-section {
  margin-top: 1rem;
}

/* Status badge in modal */
.wd-detail-item span.status-badge {
  font-size: 0.9rem;
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* Additional info section */
.wd-info h4,
.wd-history h4 {
  margin: 0 0 12px 0;
  font-size: 1.05rem;
  color: var(--text-color);
}

.wd-info-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wd-info-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.wd-info-item label {
  font-size: 0.86rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* History timeline */
.wd-history-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-left: 20px;
  position: relative;
}

/* Optional: nice timeline line (if you add multiple entries) */
.wd-history-timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
}

/* Footer with buttons */
.wd-modal-footer {
  padding: 8px 24px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
  background: #0d1117 !important;
  border-radius: 0 0 var(--radius) var(--radius);
}

.wd-modal-footer button {
  min-width: 140px;
  padding: 10px 16px;
  font-size: 0.92rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
}

.wd-modal-footer button.is-loading {
  opacity: 0.9;
  cursor: wait;
}

.wd-modal-footer button .button-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.8s linear infinite;
  margin-right: 0.5rem;
  vertical-align: middle;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.btn-primary   { background: var(--primary); color: #000000; }
.btn-primary:hover   { background: var(--primary-hover); }
.btn-success   { background: #0ecb81; color: white; }
.btn-success:hover   { background: #059669; }
.btn-danger    { background: #f6465d; color: white; }
.btn-danger:hover    { background: #dc2626; }
.btn-warning   { background: #f0b90b; color: white; }
.btn-warning:hover   { background: #d97706; }

/* ==========================================================================
   Mobile-first → Full screen modal on small screens
   ========================================================================== */

@media (max-width: 768px) {

  .wd-modal-content {
    max-width: 100%;
    max-height: 90vh;
    height: auto;
    border-radius: 0;
    box-shadow: none;
  }

  /* When footer is hidden, adjust modal height to fit content */
  .wd-modal-content.no-footer {
    height: auto;
    max-height: 90vh;
  }

  .wd-modal-body {
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .wd-modal-header {
    padding: 16px 20px;
  }

  .wd-modal-footer {
    padding: 3rem 20px 16px;
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .wd-modal-footer button {
    width: auto;
  }

  /* Keep 2-column grid on mobile — most phones can handle it well */
  .wd-details-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px 12px;
  }

  /* If screen is very narrow (< 360px), go to 1 column */
  @media (max-width: 260px) {
    .wd-details-grid {
      grid-template-columns: 1fr;
      gap: 14px;
    }
  }

  .wd-info-section,
  .wd-history-timeline {
    gap: 14px;
  }
}

/* ===== Confirmation Modal ===== */
.confirmation-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.confirmation-modal.active {
  opacity: 1;
  visibility: visible;
}

.confirmation-modal-content {
  background: #0d1117 !important;
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  max-width: 400px;
  width: 90%;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.confirmation-modal.active .confirmation-modal-content {
  transform: scale(1);
}

.confirmation-modal-header {
  padding: 1.5rem 2rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.confirmation-modal-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.2rem;
  font-weight: 600;
}

.confirmation-modal-body {
  padding: 2rem;
  text-align: center;
}

.confirmation-modal-body p {
  margin: 0;
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.5;
}

.confirmation-modal-footer {
  padding: 1rem 2rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.confirmation-modal-footer .btn-secondary {
  background: #dc2626;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.confirmation-modal-footer .btn-secondary:hover {
  background: var(--secondary-hover);
}

.confirmation-modal-footer .btn-primary {
  background: green;
  color: white;
}

.confirmation-modal-footer .btn-primary:hover {
  background: var(--primary-hover);
}

/* ===== Reason Modal ===== */
.reason-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.reason-modal.active {
  opacity: 1;
  visibility: visible;
}

.reason-modal-content {
  background: #0d1117 !important;
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.reason-modal.active .reason-modal-content {
  transform: scale(1);
}

.reason-modal-header {
  padding: 1.5rem 2rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.reason-modal-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.2rem;
  font-weight: 600;
}

.reason-modal-body {
  padding: 2rem;
}

.reason-modal-body .form-group {
  margin-bottom: 1rem;
}

.reason-modal-body label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  font-weight: 500;
}

.reason-modal-body textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  min-height: 100px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.reason-modal-body textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.char-count {
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.reason-modal-footer {
  padding: 1rem 2rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.reason-modal-footer .btn-secondary {
  background: var(--secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.reason-modal-footer .btn-secondary:hover {
  background: var(--secondary-hover);
}

.reason-modal-footer .btn-primary {
  background: var(--danger);
  color: white;
}

.reason-modal-footer .btn-primary:hover {
  background: var(--danger-hover, #c82333);
}

/* Mobile responsiveness for reason modal */
@media (max-width: 768px) {
  .reason-modal-content {
    width: 95%;
    margin: 1rem;
  }

  .reason-modal-header,
  .reason-modal-body,
  .reason-modal-footer {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .reason-modal-body textarea {
    font-size: 16px; /* Prevent zoom on iOS */
  }
}