/* ============================================================
   Creet Referrals — Customer Account Tab
   Arabic / RTL / Store-color aware
   ============================================================ */

.creet-ref-account {
  --ref-primary: #c3fd73;
  --ref-secondary: #0f172a;
  --ref-primary-rgb: 195, 253, 115;
  --ref-border: #e2e8f0;
  --ref-surface: #f8fafc;
  --ref-muted: #64748b;
  direction: rtl;
  font-family: inherit;
}

/* ── Hero ── */
.creet-ref-hero {
  background: linear-gradient(135deg, #000, #1a1a2e, #16213e) !important;
  border-radius: 16px;
  padding: 20px 18px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
}
.creet-ref-hero::before {
  content: "";
  position: absolute;
  inset: -40px;
  background: radial-gradient(
    circle at 20% 60%,
    rgba(var(--ref-primary-rgb), 0.12),
    transparent 55%
  );
  pointer-events: none;
}
.creet-ref-hero-icon {
  width: 50px;
  height: 50px;
  border-radius: 13px;
  background: rgba(var(--ref-primary-rgb), 0.1) !important;
  border: 1px solid rgba(var(--ref-primary-rgb), 0.2);
  color: var(--ref-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.creet-ref-hero h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  position: relative;
}
.creet-ref-hero p {
  margin: 5px 0 0;
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.5;
  position: relative;
}

/* ── Code + Share Grid ── */
.creet-ref-top-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

/* ── Card Base ── */
.creet-ref-card {
  background: #fff !important;
  border: 1.5px solid var(--ref-border) !important;
  border-radius: 14px;
  padding: 16px;
  box-sizing: border-box;
}
.creet-ref-card-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ref-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 14px;
}

/* ── Code Card ── */
.creet-ref-code-display {
  text-align: center;
  background: linear-gradient(135deg, #000 0%, #1a1a2e 100%) !important;
  border-radius: 10px;
  padding: 18px 10px;
  margin-bottom: 12px;
  letter-spacing: 6px;
  font-size: 26px;
  font-weight: 900;
  color: var(--ref-primary);
  font-family: "Courier New", monospace;
}
.creet-ref-code-edit {
  margin-bottom: 10px;
}
.creet-ref-code-edit input[type="text"] {
  width: 100%;
  border: 1.5px solid var(--ref-border);
  border-radius: 8px;
  padding: 10px 12px;
  direction: ltr;
  text-align: left;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 3px;
  color: var(--ref-secondary);
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.creet-ref-code-edit input:focus {
  outline: none;
  border-color: var(--ref-primary);
  box-shadow: 0 0 0 3px rgba(var(--ref-primary-rgb), 0.2);
}
.creet-ref-code-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.creet-ref-hint {
  font-size: 11px;
  color: var(--ref-muted);
  margin: 6px 0 0;
}

/* ── Share Card ── */
.creet-ref-link-field {
  margin-bottom: 12px;
}
.creet-ref-link-field input[type="text"] {
  width: 100%;
  border: 1.5px solid var(--ref-border);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 12px;
  color: var(--ref-muted);
  background: var(--ref-surface);
  box-sizing: border-box;
  direction: ltr;
  text-align: left;
}
.creet-ref-share-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Buttons ── */
.creet-ref-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  line-height: 1;
}
.creet-ref-btn--primary {
  background: var(--ref-secondary);
  color: var(--ref-primary);
}
.creet-ref-btn--primary:hover {
  opacity: 0.88;
  color: var(--ref-primary);
}
.creet-ref-btn--ghost {
  background: transparent;
  color: var(--ref-muted);
  border: 1.5px solid var(--ref-border);
}
.creet-ref-btn--ghost:hover {
  border-color: #94a3b8;
  color: var(--ref-secondary);
  background: var(--ref-surface);
}
.creet-ref-btn--outline {
  background: transparent;
  color: var(--ref-secondary);
  border: 1.5px solid var(--ref-border);
}
.creet-ref-btn--outline:hover {
  border-color: var(--ref-secondary);
  background: var(--ref-surface);
}
.creet-ref-btn--whatsapp {
  background: #25d366;
  color: #fff;
  width: 100%;
  justify-content: center;
}
.creet-ref-btn--whatsapp:hover {
  background: #1ebe5a;
  color: #fff;
}
.creet-ref-edit-btn {
  width: 100%;
  margin-top: 4px;
}

/* ── Reward Info Row ── */
.creet-ref-reward-info-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.creet-ref-reward-info-card {
  background: #fff;
  border: 1.5px solid var(--ref-border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.creet-ref-points-card {
  border-color: rgba(var(--ref-primary-rgb), 0.5);
  background: linear-gradient(135deg, rgba(var(--ref-primary-rgb), 0.06), #fff);
}
.creet-ref-coupon-card {
  border-color: rgba(99, 102, 241, 0.3);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.04), #fff);
}
.creet-ref-reward-info-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(var(--ref-primary-rgb), 0.15);
  color: var(--ref-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.creet-ref-reward-info-icon--coupon {
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
}
.creet-ref-reward-info-value {
  font-size: 24px;
  font-weight: 900;
  color: var(--ref-secondary);
  line-height: 1;
}
.creet-ref-coupon-value {
  font-family: monospace;
  font-size: 17px;
  letter-spacing: 1px;
  background: var(--ref-surface);
  border: 1px dashed var(--ref-border);
  border-radius: 6px;
  padding: 4px 10px;
  display: inline-block;
}
.creet-ref-coupon-actions {
  margin-top: 8px;
}
.creet-ref-copy-coupon {
  padding: 7px 12px;
  font-size: 12px;
}
.creet-ref-reward-info-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ref-muted);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.creet-ref-reward-info-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

/* How it works */
.creet-ref-how-card {
  background: #fff;
  border: 1.5px solid var(--ref-border);
  border-radius: 14px;
  padding: 16px;
}
.creet-ref-how-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ref-secondary);
  margin-bottom: 10px;
}
.creet-ref-how-list {
  margin: 0;
  padding-right: 18px;
  padding-left: 0;
  font-size: 13px;
  color: #475569;
  line-height: 2;
}
.creet-ref-how-list li::marker {
  color: var(--ref-primary);
  font-weight: 700;
}

/* ── Notice ── */
.creet-ref-account-notice {
  margin: 0 0 12px;
  border-radius: 9px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
}
.creet-ref-account-notice.is-success {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}
.creet-ref-account-notice.is-error {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

/* ── Section Title ── */
.creet-ref-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ref-secondary);
  margin: 0 0 14px;
}
.creet-ref-friends-count {
  background: var(--ref-secondary);
  color: var(--ref-primary);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 12px;
  font-weight: 700;
}

/* ── Friends Section ── */
.creet-ref-friends-section {
  margin-bottom: 14px;
}
.creet-ref-friends-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

/* ── Empty State ── */
.creet-ref-empty-state {
  text-align: center;
  padding: 36px 20px;
  background: #fff;
  border: 1.5px solid var(--ref-border);
  border-radius: 14px;
  color: #94a3b8;
}
.creet-ref-empty-icon {
  width: 64px;
  height: 64px;
  background: var(--ref-surface);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  color: #cbd5e1;
}
.creet-ref-empty-state p {
  margin: 0;
  font-size: 14px;
}

/* ── Friend Card ── */
.creet-ref-friend-card {
  background: #fff;
  border: 1.5px solid var(--ref-border);
  border-radius: 13px;
  padding: 14px;
  transition: border-color 0.15s;
}
.creet-ref-friend-card--done {
  border-color: rgba(var(--ref-primary-rgb), 0.6);
  background: linear-gradient(135deg, rgba(var(--ref-primary-rgb), 0.04), #fff);
}
.creet-ref-friend-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.creet-ref-friend-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--ref-secondary);
  color: var(--ref-primary);
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.creet-ref-friend-avatar--done {
  background: #16a34a;
  color: #fff;
}
.creet-ref-friend-info {
  flex: 1;
  min-width: 0;
}
.creet-ref-friend-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ref-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.creet-ref-friend-date {
  font-size: 11px;
  color: var(--ref-muted);
  margin-top: 2px;
}
.creet-ref-friend-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

/* ── Progress ── */
.creet-ref-progress {
  position: relative;
  padding-top: 6px;
}
.creet-ref-progress-track {
  position: absolute;
  top: 14px;
  right: 19px;
  left: 19px;
  height: 3px;
  background: #e2e8f0;
  border-radius: 999px;
}
.creet-ref-progress-fill {
  height: 100%;
  background: var(--ref-primary);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.creet-ref-progress-steps {
  display: flex;
  justify-content: space-between;
  position: relative;
}
.creet-ref-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 1;
}
.creet-ref-step-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e2e8f0;
  border: 2px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  color: transparent;
  z-index: 1;
}
.creet-ref-step.done .creet-ref-step-dot {
  background: var(--ref-primary);
  border-color: var(--ref-primary);
  color: var(--ref-secondary);
}
.creet-ref-step span {
  font-size: 11px;
  font-weight: 600;
  color: var(--ref-muted);
  text-align: center;
  white-space: nowrap;
}
.creet-ref-step.done span {
  color: var(--ref-secondary);
}

/* ── History Section ── */
.creet-ref-history-section {
  margin-bottom: 20px;
}
.creet-ref-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
  border: 1.5px solid var(--ref-border);
}
.creet-ref-account-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
}
.creet-ref-account-table thead th {
  background: var(--ref-secondary);
  color: var(--ref-primary);
  text-align: right;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 11px 14px;
  border: none;
}
.creet-ref-account-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.1s;
}
.creet-ref-account-table tbody tr:last-child {
  border-bottom: none;
}
.creet-ref-account-table tbody tr:hover {
  background: var(--ref-surface);
}
.creet-ref-account-table td {
  padding: 10px 14px;
  font-size: 13px;
  color: #334155;
  vertical-align: middle;
}

.creet-ref-event-type {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  background: #f1f5f9;
  color: #475569;
  text-transform: uppercase;
}
.creet-ref-event-reward {
  background: #f0fdf4;
  color: #15803d;
}
.creet-ref-event-click {
  background: #eff6ff;
  color: #2563eb;
}

.creet-ref-status-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.creet-ref-status-badge--accepted {
  background: #dcfce7;
  color: #166534;
}
.creet-ref-status-badge--rejected {
  background: #fee2e2;
  color: #991b1b;
}
.creet-ref-status-badge--warning {
  background: #fef3c7;
  color: #92400e;
}
.creet-ref-status-badge--info {
  background: #eff6ff;
  color: #1e40af;
}

/* ── Responsive ── */
@media (min-width: 640px) {
  .creet-ref-top-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .creet-ref-reward-info-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .creet-ref-friends-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .creet-ref-share-actions {
    flex-direction: row;
  }
  .creet-ref-share-actions .creet-ref-btn--whatsapp {
    width: auto;
  }
}
@media (min-width: 900px) {
  .creet-ref-reward-info-row {
    grid-template-columns: repeat(3, 1fr);
  }
  .creet-ref-friends-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 639px) {
  .creet-ref-hero {
    padding: 16px 14px;
  }
  .creet-ref-hero h2 {
    font-size: 17px;
  }
  .creet-ref-code-display {
    font-size: 20px;
    letter-spacing: 4px;
  }
  .creet-ref-account-table {
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
  }
  .creet-ref-account-table thead {
    display: none;
  }
  .creet-ref-account-table tbody tr {
    display: block;
    border: 1.5px solid var(--ref-border);
    border-radius: 10px;
    padding: 8px;
    margin-bottom: 6px;
    background: #fff;
  }
  .creet-ref-account-table td {
    display: flex;
    gap: 8px;
    border: 0;
    padding: 5px 6px;
    align-items: flex-start;
  }
  .creet-ref-account-table td::before {
    content: attr(data-label) ": ";
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
    padding-top: 2px;
  }
  .creet-ref-code-edit-actions {
    flex-direction: column;
  }
}
