/* Payments Admin - CSS */
/* Extends booking-links.css base styles */
@import url('../booking-links/booking-links.css');

/* ===== PAGE FILTER TABS ===== */
.page-filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  padding: 8px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.page-filter-tabs .filter-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.page-filter-tabs .filter-tab:hover {
  background: #f1f5f9 !important;
  color: #1e293b;
}

.page-filter-tabs .filter-tab:focus,
.page-filter-tabs .filter-tab:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

.page-filter-tabs .filter-tab.active {
  background: #2b6cb0 !important;
  color: #ffffff !important;
}

.page-filter-tabs .filter-tab.active:hover {
  background: #2563eb !important;
}

.page-filter-tabs .tab-count {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
}

.page-filter-tabs .filter-tab.active .tab-count {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* ===== FILTERS BAR ===== */
.filters-bar {
  display: flex;
  gap: var(--spacing-md);
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-md);
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.filter-group {
  min-width: 130px;
}

.filter-group-grow {
  flex: 1;
  min-width: 200px;
}

.filter-group .form-label {
  margin-bottom: 4px;
}

.filter-group .form-input {
  margin-bottom: 0;
}

/* ===== TABLE ===== */
.table-wrap {
  overflow-x: auto;
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.funnel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.funnel-table th {
  text-align: left;
  font-weight: 600;
  color: #64748b;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.funnel-table th.col-num {
  text-align: right;
}

.funnel-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

.funnel-table tbody tr {
  cursor: pointer;
  transition: background 0.1s ease;
}

.funnel-table tbody tr:hover {
  background: #f0f7ff;
}

/* Sortable column headers */
.funnel-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease;
}

.funnel-table th.sortable:hover {
  color: #1e293b;
}

.funnel-table th.sortable .sort-icon {
  font-size: 10px;
  margin-left: 2px;
  opacity: 0.4;
}

.funnel-table th.sortable.sort-active .sort-icon {
  opacity: 1;
  color: #2b6cb0;
}

/* Column sizing */
.col-num { text-align: right; white-space: nowrap; }
.col-date { white-space: nowrap; min-width: 80px; }
.col-booking-id { white-space: nowrap; font-family: monospace; font-size: 12px; }
.col-guest { min-width: 140px; }
.col-stay { white-space: nowrap; min-width: 120px; }
.col-payment-status { white-space: nowrap; min-width: 90px; }
.col-plan { white-space: nowrap; min-width: 80px; }

.loading-cell {
  text-align: center;
  color: #94a3b8;
  padding: 24px !important;
}

/* Booked time below date */
.booked-time { font-size: 11px; color: #94a3b8; font-weight: 400; }

/* Guest cell stacked layout */
.guest-name { font-weight: 600; color: #1e293b; }
.guest-email { font-size: 12px; color: #64748b; }
.guest-source { margin-top: 4px; }

.source-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  letter-spacing: 0.02em;
}

.source-direct { background: #e0f2fe; color: #075985; }
.source-ili { background: #f3e8ff; color: #6b21a8; }
.source-reservhotel { background: #fee2e2; color: #991b1b; }
.source-other { background: #e2e8f0; color: #334155; }

/* Stay cell */
.stay-dates { font-size: 13px; }
.stay-nights {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 9999px;
  background: #e2e8f0;
  color: #475569;
  margin-left: 4px;
}
.stay-rooms {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 1px;
}

/* ===== PAYMENT STATUS BADGES ===== */
.payment-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 9999px;
}

.payment-badge .material-icons {
  font-size: 14px;
}

.payment-full { background: #dcfce7; color: #166534; }
.payment-deposit { background: #dbeafe; color: #1e40af; }
.payment-due { background: #fef3c7; color: #92400e; }
.payment-overdue { background: #fee2e2; color: #991b1b; }
.payment-pboa { background: #e0f2fe; color: #0369a1; }

.pboa-switch { position: relative; display: inline-block; width: 48px; height: 26px; cursor: pointer; }
.pboa-switch input { opacity: 0; width: 0; height: 0; }
.pboa-slider { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: #cbd5e0; border-radius: 26px; transition: 0.2s; }
.pboa-slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; background: white; border-radius: 50%; transition: 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.pboa-switch input:checked + .pboa-slider { background: #3182ce; }
.pboa-switch input:checked + .pboa-slider::after { left: 25px; }

.payment-status-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.payment-due-date {
  font-size: 11px;
  color: #64748b;
}

/* Plan badge */
.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  background: #f3e8ff;
  color: #7c3aed;
}

.plan-badge.plan-none {
  background: transparent;
  color: #94a3b8;
}

/* ===== STATUS BADGES ===== */
.status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 9999px;
  text-transform: capitalize;
}

.status-confirmed { background: #dcfce7; color: #166534; }
.status-checked_in { background: #dbeafe; color: #1e40af; }
.status-checked_out { background: #f1f5f9; color: #475569; }
.status-canceled, .status-cancelled { background: #fee2e2; color: #991b1b; }
.status-no_show { background: #fef3c7; color: #92400e; }

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 0;
}

.pagination-info {
  font-size: 13px;
  color: #64748b;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  z-index: 1000;
  overflow-y: auto;
}

.modal-content {
  background: #ffffff;
  border-radius: 12px;
  width: 100%;
  max-width: 800px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.2s ease;
}

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

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.modal-header-info h2 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
}

.modal-header-info .booking-id {
  font-size: 13px;
  color: #64748b;
  font-family: monospace;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  font-size: 24px;
  padding: 4px;
  line-height: 1;
  border-radius: 4px;
}

.modal-close:hover {
  background: #f1f5f9;
  color: #334155;
}

/* Modal tabs */
.modal-tabs {
  display: flex;
  gap: 0;
  padding: 16px 24px 0;
  border-bottom: 1px solid #e2e8f0;
}

.modal-tab {
  padding: 10px 16px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s ease;
}

.modal-tab:hover {
  color: #1e293b;
}

.modal-tab.active {
  color: #2b6cb0;
  border-bottom-color: #2b6cb0;
}

.modal-body {
  padding: 24px;
  max-height: 60vh;
  overflow-y: auto;
}

/* Detail rows in modal */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
}

.detail-value {
  font-size: 14px;
  color: #1e293b;
  font-weight: 500;
}

/* Payment summary grid in detail */
.payment-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.payment-stat {
  text-align: center;
  padding: 12px;
  border-radius: 8px;
  background: #f8fafc;
}

.payment-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
}

.payment-stat-label {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.payment-stat.paid .payment-stat-value { color: #16a34a; }
.payment-stat.due .payment-stat-value { color: #0f172a; }

/* WI-403: explanatory carve-out under the four payment tiles. */
.payments-nonrefundable-note {
  margin: 8px 0 0;
  font-size: 12px;
  font-style: italic;
  color: #64748b;
  line-height: 1.4;
}

.due-date-callout {
  margin-top: 10px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 13px;
}

/* Payment history rows in detail (matching pay.yourbreezes.com style) */
.payment-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}

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

.payment-row-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.payment-date { font-size: 12px; color: #64748b; white-space: nowrap; }
.payment-card { font-size: 12px; color: #64748b; }
.payment-amount { font-weight: 600; font-size: 14px; white-space: nowrap; }
.payment-amount.refund { color: #dc2626; }
.payment-refund-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #fee2e2;
  color: #991b1b;
}

.txn-source-chip {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 9999px;
  margin-left: 4px;
}

.txn-source-stripe { background: #dbeafe; color: #1e3a8a; }
.txn-source-reservhotel { background: #fee2e2; color: #991b1b; }
.txn-source-manual { background: #fef3c7; color: #92400e; }
.txn-source-unknown { background: #e2e8f0; color: #475569; }

.legacy-banner {
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff7ed;
}

.legacy-banner-title {
  font-size: 13px;
  font-weight: 700;
  color: #9a3412;
  margin-bottom: 4px;
}

.legacy-banner-body {
  font-size: 12px;
  color: #9a3412;
}

.legacy-banner-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.legacy-btn {
  font-size: 12px;
  padding: 6px 10px;
}

/* Room cards in detail */
.room-card {
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 8px;
  border: 1px solid #e2e8f0;
}

.room-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.room-type-name {
  font-weight: 600;
  color: #1e293b;
}

.room-rate {
  font-weight: 600;
  color: #2b6cb0;
}

.room-details {
  font-size: 12px;
  color: #64748b;
}

/* Guest list in detail */
.guest-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
}

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

.guest-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
}

.guest-info-name { font-weight: 600; color: #1e293b; font-size: 14px; }
.guest-info-email { font-size: 12px; color: #64748b; }
.guest-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: #dbeafe;
  color: #1e40af;
  margin-left: auto;
}

/* Per-row refund button */
.btn-row-refund {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
  flex-shrink: 0;
}
.btn-row-refund:hover {
  background: #fff5f5;
  border-color: #fca5a5;
  color: #dc2626;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #94a3b8;
  font-size: 14px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .page-filter-tabs { flex-wrap: wrap; }
  .filters-bar { flex-direction: column; }
  .filter-group { min-width: 100%; }
  .detail-grid { grid-template-columns: 1fr; }
  .payment-summary-grid { grid-template-columns: repeat(2, 1fr); }
  .table-wrap { margin: 0 -16px; border-radius: 0; }
}
