/* ===================================================================
   admin-promo-codes.css  (v1 — Phase 4.2)

   Styles for the Promo Codes section on /admin/courses/index.html.
   Uses existing brand variables (--cp-*) from admin-courses.css.
   Loaded AFTER admin-courses.css so it can override where needed.
   =================================================================== */

/* ============= CARD SECTION ============= */

.promo-codes-card {
  margin-top: 24px;
}

.promo-codes-card .pc-explainer {
  font-size: 12px;
  line-height: 1.5;
  margin: 0 0 16px 0;
  padding: 10px 14px;
  background: rgba(64, 156, 255, 0.04);
  border-left: 3px solid rgba(64, 156, 255, 0.4);
  border-radius: 0 6px 6px 0;
}

.promo-codes-card .pc-explainer strong {
  color: #58a6ff;
}

.pc-toolbar {
  margin-bottom: 12px;
}

/* ============= TABLE ============= */

.pc-table-wrap {
  overflow-x: auto;
}

.pc-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 4px;
  font-size: 13px;
}

.pc-table thead th {
  text-align: left;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--cp-text-muted, rgba(240, 240, 245, 0.55));
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pc-table tbody tr.pc-row {
  background: rgba(255, 255, 255, 0.02);
  transition: background 0.15s ease;
}

.pc-table tbody tr.pc-row:hover {
  background: rgba(255, 140, 0, 0.04);
}

.pc-table tbody tr.pc-row.is-expanded {
  background: rgba(64, 156, 255, 0.06);
}

.pc-table tbody tr.pc-row + tr.pc-row td,
.pc-table tbody tr.pc-detail-row + tr.pc-row td {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.pc-table td {
  padding: 12px;
  vertical-align: middle;
}

.pc-table td:first-child { padding-left: 14px; padding-right: 4px; }
.pc-table td:last-child  { padding-right: 14px; }

/* ============= EXPAND BUTTON ============= */

.pc-expand-cell {
  text-align: center;
}

.pc-expand-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--cp-text-muted, rgba(240, 240, 245, 0.55));
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.pc-expand-btn:hover {
  border-color: rgba(255, 140, 0, 0.4);
  color: #ffa733;
  background: rgba(255, 140, 0, 0.06);
}

/* ============= CODE CELL ============= */

.pc-code-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pc-code {
  display: inline-block;
  background: rgba(255, 140, 0, 0.08);
  color: #ffd07a;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.5px;
  border: 1px solid rgba(255, 140, 0, 0.2);
}

.pc-description {
  font-size: 11px;
  color: var(--cp-text-muted, rgba(240, 240, 245, 0.55));
  margin-top: 4px;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============= PILLS ============= */

.pc-discount-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, rgba(255, 140, 0, 0.18), rgba(255, 140, 0, 0.06));
  color: #ffa733;
  border: 1px solid rgba(255, 140, 0, 0.4);
}

.pc-used-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.pc-expires-cell {
  font-size: 12px;
}

.pc-scope-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 11px;
  white-space: nowrap;
}

.pc-scope-all {
  background: rgba(120, 200, 130, 0.10);
  color: #7ee08a;
  border: 1px solid rgba(120, 200, 130, 0.3);
}

.pc-scope-limited {
  background: rgba(64, 156, 255, 0.10);
  color: #58a6ff;
  border: 1px solid rgba(64, 156, 255, 0.3);
}

.pc-stack-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  cursor: help;
}

.pc-stack-yes {
  background: rgba(120, 200, 130, 0.10);
  color: #7ee08a;
  border: 1px solid rgba(120, 200, 130, 0.25);
}

.pc-stack-no {
  background: rgba(255, 80, 80, 0.10);
  color: #ff8080;
  border: 1px solid rgba(255, 80, 80, 0.25);
}

/* Status badges — additional variant for 'expired' */
.cp-badge.b-expired {
  background: rgba(255, 200, 0, 0.10);
  color: #ffd24a;
  border: 1px solid rgba(255, 200, 0, 0.30);
}

/* ============= EXPANDED DETAIL ROW ============= */

.pc-detail-row td {
  padding: 0 !important;
  background: rgba(0, 0, 0, 0.18);
  border-top: 1px solid rgba(64, 156, 255, 0.15);
}

.pc-detail {
  padding: 18px 22px;
  animation: pc-slidedown 0.18s ease;
}

@keyframes pc-slidedown {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.pc-detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.pc-meta-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--cp-text-muted, rgba(240, 240, 245, 0.5));
  font-weight: 600;
}

.pc-meta-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #f0f0f5);
}

.pc-detail-section-title {
  margin: 0 0 10px 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
  color: var(--cp-text-muted, rgba(240, 240, 245, 0.6));
}

/* ============= REDEMPTIONS SUB-TABLE ============= */

.pc-redemptions-wrap {
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  overflow: hidden;
}

.pc-redemptions-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.pc-redemptions-table thead th {
  text-align: left;
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--cp-text-muted, rgba(240, 240, 245, 0.5));
  padding: 7px 12px;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.pc-redemptions-table tbody td {
  padding: 8px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.pc-redemptions-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.pc-user-email {
  font-size: 12px;
  font-weight: 500;
  color: var(--text, #f0f0f5);
}

.pc-user-name {
  font-size: 11px;
  color: var(--cp-text-muted, rgba(240, 240, 245, 0.5));
}

.pc-purchase-id {
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 5px;
  border-radius: 3px;
  cursor: help;
}

/* ============= EMPTY / LOADING ============= */

.pc-empty,
.pc-loading {
  text-align: center;
  padding: 36px 18px;
  color: var(--cp-text-muted, rgba(240, 240, 245, 0.55));
  font-size: 13px;
}

.pc-loading {
  font-size: 12px;
  padding: 24px;
}

/* ============= MODAL ============= */

.pc-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  animation: pc-fadein 0.15s ease;
}

@keyframes pc-fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.pc-modal {
  background: linear-gradient(180deg, #14141c, #0e0e16);
  border: 1px solid rgba(255, 140, 0, 0.3);
  border-radius: 14px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow:
    0 12px 60px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 140, 0, 0.1);
  animation: pc-slidein 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pc-slidein {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

.pc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, #14141c, #14141c);
  z-index: 2;
}

.pc-modal-header h3 {
  margin: 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  color: #ffd07a;
}

.pc-modal-close {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--cp-text-muted, rgba(240, 240, 245, 0.55));
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pc-modal-close:hover {
  border-color: rgba(255, 80, 80, 0.4);
  color: #ff8080;
}

.pc-modal-body {
  padding: 20px;
}

.pc-modal-body .cp-form-row {
  margin-bottom: 14px;
}

.pc-modal-body .cp-form-row:last-child {
  margin-bottom: 0;
}

.pc-input-code {
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.pc-toggles {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.pc-toggles .cp-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  flex-wrap: wrap;
}

.pc-toggles .cp-checkbox-row > span:not(.cp-text-muted) {
  font-weight: 600;
}

.pc-toggles .cp-checkbox-row small {
  display: block;
  width: 100%;
  margin-left: 24px;
  font-size: 11px;
  line-height: 1.4;
}

/* ============= COURSE PICKER ============= */

.pc-course-picker {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px;
}

.pc-course-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 6px;
  font-size: 13px;
  transition: background 0.15s ease;
}

.pc-course-item:hover {
  background: rgba(255, 140, 0, 0.04);
}

.pc-course-cb {
  cursor: pointer;
  accent-color: #ffa733;
}

.pc-course-title {
  flex: 1;
  color: var(--text, #f0f0f5);
}

.pc-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0 0 14px 14px;
  position: sticky;
  bottom: 0;
}

/* ============= MOBILE ============= */

@media (max-width: 700px) {
  .pc-table thead th,
  .pc-table td {
    padding: 8px;
    font-size: 12px;
  }
  .pc-table td .cp-btn-sm {
    padding: 4px 8px;
    font-size: 11px;
  }
  .pc-description {
    max-width: 180px;
  }
  .pc-modal {
    max-width: 100%;
    margin: 0;
  }
  .pc-modal-body .cp-form-grid {
    grid-template-columns: 1fr;
  }
  .pc-detail-meta {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* End of admin-promo-codes.css v1 */
