/* Coupon page styling follows the shared course/admin page theme. */
* { box-sizing: border-box; }

:root {
  --coupon-blue: #248afd;
  --coupon-green: #1cc88a;
  --coupon-border: #dee2e6;
}

.coupons-page-body {
  margin: 0;
  background: #c8ecf5 !important;
  color: #333;
  font-family: 'Roboto', sans-serif;
  font-size: 14px;
  overflow-x: hidden;
}

.coupon-page {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}

.page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.page-header-left { min-width: 0; }
.page-eyebrow {
  color: #4e73df;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.page-header h1 {
  color: #333;
  font-size: 2rem;
  font-weight: 700;
  margin: 6px 0 8px;
}
.page-header p,
.card-title p { margin: 0; color: #666; }

.coupons-page-body .btn {
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
}
.coupons-page-body .btn-primary { background: #4e73df; border-color: #4e73df; color: #fff; }
.coupons-page-body .btn-primary:hover { background: #2e59d9; border-color: #2653d4; }
.coupons-page-body .btn-secondary { background: #6c757d; border-color: #6c757d; color: #fff; }
.coupons-page-body .btn-danger { background: #e74a3b; border-color: #e74a3b; color: #fff; }

.coupon-card {
  background: #fff;
  border: 1px solid var(--coupon-border);
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0,0,0,.1);
  padding: 0;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--coupon-border);
}
.title-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #e8f1ff;
  color: #4e73df;
  font-size: 18px;
}
.card-title h2 { margin: 0 0 4px; font-size: 1.25rem; font-weight: 700; }

.table-wrap { overflow-x: auto; }
.coupon-table {
  width: 100%;
  min-width: 930px;
  border-collapse: collapse;
  border-spacing: 0;
  background: #fff;
}
.coupon-table th,
.coupon-table td {
  padding: 12px;
  text-align: center;
  border: 1px solid var(--coupon-border);
  white-space: nowrap;
  vertical-align: middle;
}
.coupon-table td .coupon-action-group {
  justify-content: center;
}
.coupon-table th {
  color: #495057;
  background: #f8f9fa;
  font-size: 12px;
  font-weight: 700;
}
.coupon-table td { font-size: 13px; }
.coupon-table tbody tr:hover { background: #f8f9fa; }
.coupon-table tr:last-child td { border-bottom: 1px solid var(--coupon-border); }
.code { color: #4e73df; font-family: monospace; font-weight: 700; }
.type { font-size: 12px; font-weight: 700; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 700;
}
.status.active { background: #d1f1e3; color: #16845c; }
.status.inactive { background: #e9ecef; color: #6c757d; }
.coupon-action-group { display: inline-flex; gap: 5px; flex-wrap: nowrap; vertical-align: middle; }
.coupon-action-btn {
  min-width: 60px;
  padding: 6px 12px !important;
  font-size: 13px !important;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  border-radius: 6px !important;
}
.coupon-action-btn.btn-primary { background-color: #0d6efd; border-color: #0d6efd; color: #fff; }
.coupon-action-btn.btn-danger { background-color: #dc3545; border-color: #dc3545; color: #fff; }
.coupon-action-btn.btn-success { background-color: #198754; border-color: #198754; color: #fff; }
.coupon-action-btn:hover { filter: brightness(.92); }

.empty,
.loading { padding: 58px 20px; text-align: center; color: #6c757d; }
.spinner-ring,
.btn-spinner {
  display: inline-block;
  width: 25px;
  height: 25px;
  border: 3px solid #dce3f7;
  border-top-color: #4e73df;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  vertical-align: middle;
}
.btn-spinner { display: none; width: 14px; height: 14px; border-width: 2px; border-top-color: #fff; margin-right: 5px; }
@keyframes spin { to { transform: rotate(360deg); } }

.alert-msg { display: none; margin: 12px 20px; padding: 10px 12px; border-radius: 4px; color: #842029; background: #f8d7da; font-size: 13px; }
.alert-msg.show { display: block; }

.coupon-modal { display: none; position: fixed; inset: 0; z-index: 20; align-items: center; justify-content: center; padding: 16px; background: transparent; cursor: default; }
.coupon-modal.open { display: flex; }
.coupon-modal__dialog { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; border-radius: 8px; background: #fff; box-shadow: 0 4px 15px rgba(0,0,0,.2); cursor: default; }
.coupon-modal__dialog--small { width: min(500px, calc(100vw - 32px)); }
.coupon-modal__header { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--coupon-border); }
.coupon-modal__header h3 { margin: 0; font-size: 1.35rem; font-weight: 700; }
.coupon-modal__close { width: 34px; height: 34px; border: 0; background: transparent; color: #6c757d; cursor: pointer; font-size: 1.35rem; }
.coupon-modal__form { width: 100%; margin: 0; padding: 22px 24px 0; }
.coupon-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; row-gap: 18px; width: 100%; }
.coupon-field { min-width: 0; width: 100%; }
.coupon-field label { display: block; margin: 0 0 7px; font-size: 13px; font-weight: 600; }
.coupon-field label span { color: #e74a3b; }
.coupon-field input, .coupon-field select { display: block; width: 100%; min-height: 42px; margin: 0; border: 1px solid #ced4da; border-radius: 4px; padding: 9px 12px; color: #333; background: #fff; font: inherit; font-size: 14px; }
.coupon-field input:focus, .coupon-field select:focus { border-color: #80bdff; outline: 0; box-shadow: 0 0 0 .2rem rgba(0,123,255,.15); }
#couponCode { text-transform: uppercase; }
.coupon-modal__footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--coupon-border); }
.coupon-confirm { padding: 28px 32px 30px; text-align: center; }
.coupon-confirm p { margin: 22px 0 12px; font-size: 18px; line-height: 1.4; }
.coupon-confirm strong { font-weight: 700; }
.coupon-confirm small { max-width: 380px; margin: 0 auto; }
.coupon-confirm .confirm-icon { width: 52px; height: 52px; display: grid; place-items: center; margin: 0 auto 15px; border-radius: 50%; color: #856404; background: #fff3cd; font-size: 22px; }
.coupon-confirm small { display: block; color: #6c757d; line-height: 1.5; font-size: 14px; }
.coupon-confirm .alert-msg { margin: 12px 0 0; text-align: left; }
#toastContainer .toast { min-width: 280px; margin-bottom: 8px; box-shadow: 0 4px 12px rgba(0,0,0,.15); }
#toastContainer .toast-body { font-size: 13px; }
#toastContainer .btn-close { margin-right: 8px !important; }

@media (max-width: 575.98px) {
  .coupon-page { padding: 24px 8px 48px; }
  .page-header { align-items: flex-start; flex-direction: column; }
  .page-header h1 { font-size: 1.65rem; }
  .card-title { padding: 15px; }
  .coupon-modal { padding: 10px; }
  .coupon-modal__dialog { width: min(100%, 520px); max-height: calc(100vh - 20px); }
  .coupon-modal__dialog--small { width: min(100%, 430px); }
  .coupon-confirm { padding: 24px 18px; }
  .coupon-modal__header, .coupon-modal__form { padding-left: 16px; padding-right: 16px; }
  .coupon-form-grid { grid-template-columns: minmax(0, 1fr); row-gap: 14px; }
  .coupon-modal__footer { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; flex-wrap: wrap; }
  .coupon-modal__footer .btn { flex: 1 1 120px; }
}
