/* ----------------------- 01. Khung trang ----------------------- */
.pl-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 30px;
}

.pl-card {
  background-color: #fff;
  border-radius: 8px;
  padding: 20px 24px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.pl-card h3,
.pl-custom h3 {
  margin: 0 0 12px;
  font-size: 16px;
  color: #222;
}

.pl-muted {
  font-size: 13px;
  color: #888;
}

/* ----------------------- 02. Gói đang dùng ----------------------- */
.pl-current {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  border-radius: 8px;
  background: linear-gradient(135deg, #4a5cf0, #7b5cf0);
  color: #fff;
}

.pl-current > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pl-current strong {
  font-size: 22px;
}

.pl-current .pl-muted {
  color: rgba(255, 255, 255, 0.8);
}

.pl-current-coins {
  text-align: right;
}

/* ----------------------- 03. Thẻ gói cước ----------------------- */
.pl-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.pl-plan {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 24px;
  border: 2px solid transparent;
  border-radius: 12px;
  background-color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pl-plan:hover {
  border-color: #b8c0fa;
}

.pl-plan.current {
  border-color: #2e7d32;
}

/* Gói đang chọn: viền xanh theo gói người dùng bấm vào */
.pl-plan.selected {
  border-color: #4a5cf0;
  box-shadow: 0 4px 16px rgba(74, 92, 240, 0.18);
}

.pl-ribbon {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 3px 10px;
  border-radius: 12px;
  background-color: #4a5cf0;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.pl-plan.current .pl-ribbon {
  background-color: #2e7d32;
}

.pl-plan-name {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #4a5cf0;
  letter-spacing: 1px;
}

.pl-plan-price {
  margin: 10px 0 16px;
  font-size: 30px;
  font-weight: 700;
  color: #222;
}

.pl-plan-price small {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: #888;
}

.pl-features {
  flex: 1;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
  font-size: 14px;
  color: #444;
}

.pl-features li {
  display: flex;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed #eee;
}

.pl-features li::before {
  content: "✓";
  color: #2e7d32;
  font-weight: 700;
}

.pl-features li.off {
  color: #aaa;
}

.pl-features li.off::before {
  content: "✕";
  color: #ccc;
}

/* ----------------------- 04. Gói tự cấu hình ----------------------- */
.pl-custom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border: 1px dashed #9fa8f5;
  border-radius: 8px;
  background-color: #f8f9ff;
}

.pl-custom p {
  margin: 0;
  font-size: 14px;
  color: #666;
}

.pl-custom-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.pl-custom-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  margin-bottom: 16px;
}

.pl-custom-fields label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #444;
}

.pl-custom-fields select,
.pl-summary select,
.pl-input,
.pl-inline input {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background-color: #fff;
}

.pl-input {
  width: 100%;
  margin-bottom: 16px;
  box-sizing: border-box;
}

.pl-notes ul {
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
  color: #555;
  line-height: 1.6;
}

/* ----------------------- 05. Đơn hàng ----------------------- */
.pl-table-wrap {
  overflow-x: auto;
}

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

.pl-table th,
.pl-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #f0f0f0;
  text-align: left;
  white-space: nowrap;
}

.pl-table th {
  color: #888;
  font-weight: 500;
}

.pl-status {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
}

.pl-status.paid      { background-color: #e8f5e9; color: #2e7d32; }
.pl-status.pending   { background-color: #fff4e5; color: #b26a00; }
.pl-status.cancelled { background-color: #f5f5f5; color: #888; }

.pl-empty {
  margin: 16px 0 0;
  font-size: 14px;
  color: #999;
  text-align: center;
}

/* ----------------------- 06. Thanh toán ----------------------- */
.pl-summary {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  background-color: #f8f9ff;
}

.pl-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  font-size: 14px;
  color: #444;
}

.pl-inline {
  display: flex;
  gap: 6px;
}

.pl-inline input {
  width: 150px;
}

.pl-discounts {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: #2e7d32;
}

.pl-discounts li {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}

.pl-total {
  margin-top: 6px;
  border-top: 1px solid #e3e5f5;
  font-size: 16px;
}

.pl-total strong {
  color: #4a5cf0;
  font-size: 20px;
}

.pl-label {
  margin: 0 0 8px;
  font-size: 14px;
  color: #333;
}

.pl-methods {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.pl-method {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}

.pl-method:has(input:checked) {
  border-color: #4a5cf0;
  background-color: #f5f6ff;
}

.pl-method:has(input:disabled) {
  color: #aaa;
  cursor: not-allowed;
}

.pl-method small {
  margin-left: auto;
  color: #888;
  font-size: 12px;
}

.pl-warning {
  margin: 0 0 12px;
  font-size: 13px;
  color: #c62828;
}

.pl-warning[hidden] {
  display: none;
}

.pl-paypal-logo {
  font-weight: 800;
  font-style: italic;
  color: #003087;
}

.pl-paypal-buttons {
  margin-bottom: 8px;
}

.pl-paypal-buttons[hidden] {
  display: none;
}

/* ----------------------- 07. Nút ----------------------- */
.pl-primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  background-color: #4a5cf0;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s;
}

.pl-primary-btn:hover {
  background-color: #3846d4;
}

.pl-primary-btn:disabled {
  background-color: #a9b1f5;
  cursor: not-allowed;
}

.pl-secondary-btn {
  padding: 10px 20px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background-color: #fff;
  color: #333;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}

.pl-outline-btn {
  padding: 9px 16px;
  border: 1px solid #4a5cf0;
  border-radius: 6px;
  background-color: #fff;
  color: #4a5cf0;
  font-size: 14px;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
}

.pl-outline-btn:hover {
  background-color: #eef0fe;
}

.pl-link-btn {
  padding: 0;
  border: none;
  background: none;
  color: #4a5cf0;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

.pl-plan .pl-primary-btn {
  width: 100%;
}

/* ----------------------- 08. Modal ----------------------- */
.pl-modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 16px 16px;
  background-color: rgba(0, 0, 0, 0.45);
  z-index: 20000; /* Trên header (z-index 10000) */
  overflow-y: auto;
}

.pl-modal-overlay.open {
  display: flex;
}

.pl-modal {
  position: relative;
  width: 100%;
  max-width: 560px;
  background-color: #fff;
  border-radius: 10px;
  padding: 22px 24px 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
}

.pl-modal h3 {
  margin: 0 0 16px;
  font-size: 19px;
}

.pl-modal > p {
  margin: 0 0 14px;
  font-size: 14px;
  color: #555;
  line-height: 1.5;
}

.pl-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: #999;
  cursor: pointer;
}

.pl-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

/* ----------------------- 09. Thông báo nhanh (toast) ----------------------- */
.pl-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 20001;
}

.pl-toast {
  min-width: 240px;
  max-width: 380px;
  padding: 12px 16px;
  border-radius: 6px;
  background-color: #323232;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.pl-toast.success { background-color: #2e7d32; }
.pl-toast.error   { background-color: #c62828; }

/* ----------------------- 10. Màn hình nhỏ ----------------------- */
@media (max-width: 700px) {
  .pl-current,
  .pl-custom {
    flex-direction: column;
    align-items: flex-start;
  }

  .pl-current-coins {
    text-align: left;
  }

  .pl-custom-fields {
    grid-template-columns: 1fr;
  }
}

.pl-primary-btn[hidden] {
  display: none;
}

/* Tự động gia hạn và nạp coin trên thanh gói hiện tại */
.pl-renewal {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
}

.pl-renewal.warn {
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  background-color: #fff4e5;
  color: #b26a00;
}

.pl-topup-link {
  margin-top: 4px;
  color: #fff;
  font-size: 13px;
  text-decoration: underline;
}

/* ----------------------- Trang ELS Coin ----------------------- */
.gc-topup-btn {
  border-color: #fff;
}

.gc-renew-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.gc-renew-head p {
  margin: 0;
  max-width: 640px;
  line-height: 1.5;
}

.gc-renew-status {
  margin: 12px 0 0;
  font-size: 14px;
  color: #333;
}

.gc-renew-status.warn {
  color: #b26a00;
}

/* Công tắc bật / tắt */
.gc-switch {
  position: relative;
  flex-shrink: 0;
  width: 46px;
  height: 26px;
}

.gc-switch input {
  width: 0;
  height: 0;
  opacity: 0;
}

.gc-slider {
  position: absolute;
  inset: 0;
  border-radius: 26px;
  background-color: #ccc;
  cursor: pointer;
  transition: background-color 0.2s;
}

.gc-slider::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #fff;
  transition: transform 0.2s;
}

.gc-switch input:checked + .gc-slider {
  background-color: #4a5cf0;
}

.gc-switch input:checked + .gc-slider::before {
  transform: translateX(20px);
}

.gc-switch input:focus-visible + .gc-slider {
  outline: 2px solid #4a5cf0;
  outline-offset: 2px;
}

/* Chọn số tiền nạp */
.gc-presets {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.gc-preset {
  padding: 10px 4px;
  border: 1px solid #d6d8e3;
  border-radius: 8px;
  background-color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.gc-preset small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 400;
  color: #888;
}

.gc-preset.active {
  border-color: #4a5cf0;
  background-color: #f5f6ff;
  color: #4a5cf0;
}

.gc-amount {
  width: 140px;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

@media (max-width: 600px) {
  .gc-presets {
    grid-template-columns: repeat(3, 1fr);
  }

  .gc-renew-head {
    flex-direction: column;
  }
}

/* ----------------------- Popup chi tiết gói ----------------------- */
.pl-plan-detail h3 {
  margin-bottom: 4px;
  color: #4a5cf0;
  letter-spacing: 1px;
}

.pl-plan-detail .pl-plan-price {
  margin: 0 0 12px;
}

.pl-detail-list {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  max-height: 60vh;
  overflow-y: auto;
}

.pl-detail-list li {
  position: relative;
  padding: 10px 0 10px 26px;
  border-bottom: 1px dashed #eee;
}

.pl-detail-list li::before {
  content: "✓";
  position: absolute;
  left: 2px;
  top: 10px;
  color: #2e7d32;
  font-weight: 700;
}

.pl-detail-list li.off::before {
  content: "✕";
  color: #ccc;
}

.pl-detail-list strong {
  display: block;
  font-size: 14px;
  color: #222;
}

.pl-detail-list li.off strong {
  color: #999;
}

.pl-detail-list p {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: #666;
}

/* ----------------------- Cửa hàng ELS Coin ----------------------- */
.gc-shop {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  margin: 14px 0 22px;
}

.gc-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border: 1px solid #e6e8f2;
  border-radius: 10px;
  background-color: #fafbff;
}

.gc-item-icon {
  font-size: 24px;
}

.gc-item-name {
  font-weight: 700;
  color: #222;
}

.gc-item-desc {
  flex: 1;
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: #666;
}

.gc-item-price {
  font-weight: 700;
  color: #4a5cf0;
}

.gc-item .pl-primary-btn {
  width: 100%;
}

.gc-shop-subtitle {
  margin: 0 0 8px;
  font-size: 15px;
}

/* Ghi chú giá nâng cấp (bù chênh lệch) trên thẻ gói */
.pl-upgrade-note {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #eef6ff;
  color: #1d4f91;
  font-size: 13px;
  line-height: 1.45;
}

/* Nút nâng cấp lên gói cao hơn (bù chênh lệch) */
.pl-plan .pl-upgrade-btn {
  background: #1f9d55;
  border-color: #1f9d55;
}

.pl-plan .pl-upgrade-btn:hover {
  background: #17803f;
  border-color: #17803f;
}
