/**
 * PayHere Bank Credit Card Installments Styling
 * Perfuma Sri Lanka (perfuma.lk)
 */

/* ==========================================================================
   1. Checkout Gateway UI
   ========================================================================== */
.payhere-inst-container {
  margin-top: 10px;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-family: inherit;
  color: #1e293b;
}

.payhere-inst-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 13.5px;
  line-height: 1.4;
  color: #334155;
}

.payhere-inst-zero-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Bank Selection Tabs */
.payhere-inst-bank-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.payhere-inst-bank-tab {
  flex: 1 1 calc(33.333% - 8px);
  min-width: 110px;
  padding: 10px 8px;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.payhere-inst-bank-tab:hover {
  border-color: #cbd5e1;
  background: #f1f5f9;
}

.payhere-inst-bank-tab.active {
  border-color: #0f172a;
  background: #f8fafc;
  box-shadow: 0 0 0 1px #0f172a;
}

.payhere-inst-bank-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #0f172a;
  display: block;
}

.payhere-inst-bank-sub {
  font-size: 10.5px;
  color: #64748b;
  display: block;
  margin-top: 2px;
}

.payhere-inst-bank-tab.active .payhere-inst-bank-title {
  color: #0f172a;
}

/* Plan Selection Cards */
.payhere-inst-plans-group {
  display: none;
}

.payhere-inst-plans-group.active {
  display: block;
}

.payhere-inst-plan-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.payhere-inst-plan-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.payhere-inst-plan-card:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.payhere-inst-plan-card.selected {
  border-color: #059669;
  background: #f0fdf4;
}

.payhere-inst-plan-radio-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.payhere-inst-plan-radio-wrap input[type="radio"] {
  margin: 0;
  cursor: pointer;
}

.payhere-inst-plan-label {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
}

.payhere-inst-plan-fee-tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.payhere-inst-plan-fee-tag.free {
  background: #dcfce7;
  color: #15803d;
}

.payhere-inst-plan-fee-tag.fee {
  background: #f1f5f9;
  color: #475569;
}

.payhere-inst-plan-monthly {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  text-align: right;
}

.payhere-inst-plan-monthly small {
  font-size: 10px;
  font-weight: normal;
  color: #64748b;
  display: block;
}

/* Minimum Amount Warning */
.payhere-inst-min-warning {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* PayHere Direct Info Notice */
.payhere-inst-guide {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #cbd5e1;
  font-size: 11.5px;
  color: #64748b;
  line-height: 1.45;
}

/* ==========================================================================
   2. Product Page Installment Badge
   ========================================================================== */
.payhere-product-installment-badge {
  margin: 14px 0 16px 0;
  padding: 10px 14px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  border-left: 4px solid #0f172a;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  font-size: 13px;
  line-height: 1.5;
  color: #1e293b;
}

.payhere-product-badge-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.payhere-product-badge-text {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.payhere-product-badge-pill {
  background: #10b981;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.payhere-modal-trigger-btn {
  background: transparent;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.payhere-modal-trigger-btn:hover {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

/* ==========================================================================
   3. Modal Dialog (Bank Plans Breakdown)
   ========================================================================== */
.payhere-inst-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.payhere-inst-modal-overlay.open {
  display: flex;
  animation: phModalFadeIn 0.2s ease-out;
}

@keyframes phModalFadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.payhere-inst-modal-card {
  background: #ffffff;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  position: relative;
  box-sizing: border-box;
}

.payhere-inst-modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

.payhere-inst-modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.payhere-inst-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s;
}

.payhere-inst-modal-close:hover {
  color: #0f172a;
  background: #e2e8f0;
}

.payhere-inst-modal-body {
  padding: 20px 22px;
}

.payhere-inst-modal-price-callout {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.payhere-inst-modal-price-callout .label {
  font-size: 12px;
  color: #166534;
  font-weight: 600;
}

.payhere-inst-modal-price-callout .val {
  font-size: 16px;
  font-weight: 800;
  color: #15803d;
}

/* Modal Table */
.payhere-inst-table-wrap {
  margin-bottom: 20px;
  overflow-x: auto;
}

.payhere-inst-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  text-align: left;
}

.payhere-inst-table th {
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
  padding: 9px 12px;
  border-bottom: 2px solid #cbd5e1;
}

.payhere-inst-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  color: #1e293b;
}

.payhere-inst-table tr:hover td {
  background: #f8fafc;
}

.payhere-inst-table .bank-col {
  font-weight: 700;
  color: #0f172a;
}

.payhere-inst-table .free-text {
  color: #15803d;
  font-weight: 700;
}

.payhere-inst-modal-steps {
  background: #f8fafc;
  border-radius: 8px;
  padding: 14px 16px;
  border: 1px solid #e2e8f0;
}

.payhere-inst-modal-steps h4 {
  margin: 0 0 10px 0;
  font-size: 13px;
  color: #0f172a;
  font-weight: 700;
}

.payhere-inst-modal-steps ol {
  margin: 0;
  padding-left: 20px;
  font-size: 12px;
  color: #475569;
  line-height: 1.6;
}

/* ==========================================================================
   4. Cart Page Banner
   ========================================================================== */
.payhere-cart-installment-banner {
  margin: 16px 0;
  padding: 12px 16px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  color: #166534;
}

.payhere-cart-installment-banner.qualify {
  background: #ecfdf5;
  border-color: #6ee7b7;
}

.payhere-cart-installment-banner.upsell {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

/* Responsive adjust */
@media (max-width: 600px) {
  .payhere-inst-bank-tab {
    flex: 1 1 100%;
  }
  .payhere-product-badge-content {
    flex-direction: column;
    align-items: flex-start;
  }
  .payhere-modal-trigger-btn {
    align-self: flex-start;
  }
}
