/**
 * Globex Sky — payment.css
 * Styles for payment pages: payment method selection, card form,
 * success/failure pages, and payment history.
 */

/* ─── Reset & Base ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', sans-serif;
  background: #f0f2f8;
  color: #1a1a2e;
  min-height: 100vh;
}

/* ─── Layout ──────────────────────────────────────────────────────────── */
.payment-wrapper {
  max-width: 960px;
  margin: 40px auto;
  padding: 0 20px;
}

.payment-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 768px) {
  .payment-grid { grid-template-columns: 1fr; }
  .payment-wrapper { margin: 20px auto; }
}

/* ─── Cards ───────────────────────────────────────────────────────────── */
.payment-card {
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
}

.payment-card-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: #0a0e27;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f1f5f9;
}

/* ─── Payment Method Selection ────────────────────────────────────────── */
.method-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

@media (max-width: 480px) {
  .method-grid { grid-template-columns: 1fr; }
}

.method-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  background: #fff;
  text-align: left;
  width: 100%;
}

.method-card:hover {
  border-color: #0052CC;
  background: #f0f4ff;
}

.method-card.active {
  border-color: #0052CC;
  background: #f0f4ff;
  box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.12);
}

.method-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.method-icon.card    { background: #dbeafe; color: #0052CC; }
.method-icon.paypal  { background: #e0f2fe; color: #0369a1; }
.method-icon.bank    { background: #d1fae5; color: #059669; }
.method-icon.escrow  { background: #ede9fe; color: #7c3aed; }

.method-label { font-weight: 600; font-size: 0.9rem; color: #0a0e27; }
.method-sub   { font-size: 0.75rem; color: #64748b; margin-top: 2px; }

/* ─── Form Fields ─────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  color: #1a1a2e;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
}

.form-input:focus {
  outline: none;
  border-color: #0052CC;
  box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ─── Stripe Elements Mount ───────────────────────────────────────────── */
#stripe-card-element {
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.2s;
  min-height: 44px;
}

#stripe-card-element.StripeElement--focus {
  border-color: #0052CC;
  box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.1);
}

#stripe-card-element.StripeElement--invalid { border-color: #ef4444; }

#stripe-errors {
  color: #ef4444;
  font-size: 0.82rem;
  margin-top: 6px;
  min-height: 18px;
}

/* ─── PayPal Button Container ─────────────────────────────────────────── */
#paypal-button-container {
  margin-top: 16px;
  min-height: 45px;
}

/* ─── Bank Transfer Info ──────────────────────────────────────────────── */
.bank-info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-top: 8px;
}

.bank-info-table tr:not(:last-child) td { padding-bottom: 10px; }
.bank-info-table td:first-child { color: #64748b; font-weight: 500; width: 160px; }
.bank-info-table td:last-child  { color: #0a0e27; font-weight: 600; font-family: monospace; }

.bank-copy-btn {
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.75rem;
  cursor: pointer;
  color: #0052CC;
  margin-left: 8px;
  transition: all 0.2s;
}

.bank-copy-btn:hover { background: #f0f4ff; }

/* ─── Escrow Info ─────────────────────────────────────────────────────── */
.escrow-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.escrow-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.escrow-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #0052CC;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.escrow-step-text { font-size: 0.875rem; color: #374151; padding-top: 4px; }

/* ─── Order Summary ───────────────────────────────────────────────────── */
.order-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 0.875rem;
  color: #374151;
  border-bottom: 1px solid #f1f5f9;
}

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

.order-summary-row.total {
  font-size: 1rem;
  font-weight: 700;
  color: #0a0e27;
  padding-top: 14px;
  margin-top: 4px;
  border-top: 2px solid #e2e8f0;
  border-bottom: none;
}

.order-summary-label { color: #64748b; }

/* ─── Buttons ─────────────────────────────────────────────────────────── */
.btn-pay {
  width: 100%;
  padding: 14px;
  background: #0052CC;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-pay:hover   { background: #003d99; }
.btn-pay:active  { transform: scale(0.99); }
.btn-pay:disabled { background: #94a3b8; cursor: not-allowed; }

.btn-secondary {
  padding: 10px 20px;
  background: #f1f5f9;
  color: #374151;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}

.btn-secondary:hover { background: #e2e8f0; }

/* ─── Spinner ─────────────────────────────────────────────────────────── */
.payment-spinner {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px;
}

.payment-spinner.visible { display: flex; }

.spinner-ring {
  width: 48px;
  height: 48px;
  border: 4px solid #e2e8f0;
  border-top-color: #0052CC;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.spinner-text { font-size: 0.95rem; color: #64748b; }

/* ─── Success/Failure Pages ───────────────────────────────────────────── */
.result-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  padding: 20px;
}

.result-card {
  background: #fff;
  border-radius: 20px;
  padding: 48px 40px;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  max-width: 480px;
  width: 100%;
}

.result-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  margin: 0 auto 24px;
}

.result-icon.success { background: #d1fae5; color: #059669; }
.result-icon.fail    { background: #fee2e2; color: #ef4444; }

.result-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #0a0e27;
  margin-bottom: 10px;
}

.result-subtitle {
  font-size: 0.95rem;
  color: #64748b;
  line-height: 1.6;
  margin-bottom: 24px;
}

.result-ref {
  background: #f8faff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 20px;
  font-family: monospace;
  font-size: 0.9rem;
  color: #0052CC;
  margin-bottom: 24px;
  word-break: break-all;
}

.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-result-primary {
  padding: 12px 28px;
  background: #0052CC;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
  font-family: 'Inter', sans-serif;
}

.btn-result-primary:hover { background: #003d99; }

.btn-result-secondary {
  padding: 12px 28px;
  background: #f1f5f9;
  color: #374151;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}

.btn-result-secondary:hover { background: #e2e8f0; }

/* ─── Payment History ─────────────────────────────────────────────────── */
.history-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-select {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: 'Inter', sans-serif;
  color: #374151;
  background: #fff;
  cursor: pointer;
}

.filter-select:focus { outline: none; border-color: #0052CC; }

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.history-table th {
  background: #f8faff;
  color: #374151;
  font-weight: 600;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

.history-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #374151;
  vertical-align: middle;
}

.history-table tr:hover td { background: #f8faff; }

/* ─── Status Badges ───────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success  { background: #d1fae5; color: #059669; }
.badge-pending  { background: #fef9c3; color: #d97706; }
.badge-failed   { background: #fee2e2; color: #ef4444; }
.badge-refunded { background: #ede9fe; color: #7c3aed; }
.badge-held     { background: #e0f2fe; color: #0369a1; }

/* ─── Security Badges ─────────────────────────────────────────────────── */
.security-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 16px;
  margin-top: 16px;
  border-top: 1px solid #f1f5f9;
}

.security-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: #64748b;
}

.security-badge i { color: #059669; }

/* ─── Page Header ─────────────────────────────────────────────────────── */
.page-header {
  margin-bottom: 28px;
}

.page-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: #0a0e27;
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 0.9rem;
  color: #64748b;
}

/* ─── Secure Lock Icon ────────────────────────────────────────────────── */
.secure-notice {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #059669;
  background: #d1fae5;
  padding: 6px 12px;
  border-radius: 8px;
  margin-bottom: 16px;
}

/* ─── Payment Method Section ──────────────────────────────────────────── */
.payment-section {
  display: none;
}

.payment-section.active {
  display: block;
}

/* ─── Divider with text ───────────────────────────────────────────────── */
.divider-text {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: #94a3b8;
  font-size: 0.8rem;
}

.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

/* ─── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .payment-card { padding: 20px 16px; }
  .result-card  { padding: 36px 20px; }
  .form-row     { grid-template-columns: 1fr; }
}
