/* ─── Interfine Affiliate Plugin Frontend CSS ─── */

:root {
  --ifma-purple: #7c3aed;
  --ifma-purple-dark: #6d28d9;
  --ifma-purple-light: #f3f0ff;
  --ifma-dark: #1e1b4b;
  --ifma-text: #334155;
  --ifma-muted: #64748b;
  --ifma-border: #e2e8f0;
  --ifma-green: #059669;
  --ifma-red: #dc2626;
  --ifma-gold: #d97706;
}

.ifma-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 16px 60px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--ifma-text);
}

/* ─── Card ─── */
.ifma-card {
  background: #fff;
  border: 1px solid var(--ifma-border);
  border-radius: 12px;
  padding: 28px 32px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.ifma-card-header {
  border-bottom: 1px solid var(--ifma-border);
  padding-bottom: 22px;
  margin-bottom: 24px;
}
.ifma-card-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--ifma-dark);
  margin: 0 0 8px;
}
.ifma-card-header p {
  color: var(--ifma-muted);
  margin: 0;
  font-size: 15px;
}
.ifma-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ifma-dark);
  margin: 0 0 10px;
}
.ifma-card-muted {
  background: #fafafa;
}

/* ─── Referrer banner ─── */
.ifma-ref-banner {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  padding: 12px 18px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
}

/* ─── Tier boxes ─── */
.ifma-tiers {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
@media (max-width: 600px) {
  .ifma-tiers { grid-template-columns: repeat(2, 1fr); }
}
.ifma-tier {
  background: var(--ifma-purple-light);
  border: 1px solid #ddd6fe;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}
.ifma-tier-top {
  background: #fffbeb;
  border-color: #fcd34d;
}
.t-icon { display: block; font-size: 22px; margin-bottom: 4px; }
.t-label { display: block; font-size: 12px; font-weight: 600; color: var(--ifma-muted); }
.t-rate { display: block; font-size: 20px; font-weight: 800; color: var(--ifma-purple); }
.t-refs { display: block; font-size: 11px; color: var(--ifma-muted); margin-top: 2px; }

/* ─── Form ─── */
.ifma-field {
  margin-bottom: 16px;
}
.ifma-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ifma-dark);
  margin-bottom: 6px;
}
.ifma-field input[type="text"],
.ifma-field input[type="email"],
.ifma-field input[type="tel"],
.ifma-field input[type="number"],
.ifma-field select,
.ifma-field textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--ifma-border);
  border-radius: 7px;
  font-size: 14px;
  color: var(--ifma-text);
  box-sizing: border-box;
  transition: border-color .15s;
  background: #fff;
}
.ifma-field input:focus,
.ifma-field select:focus,
.ifma-field textarea:focus {
  outline: none;
  border-color: var(--ifma-purple);
  box-shadow: 0 0 0 3px rgba(124,58,237,.1);
}
.ifma-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 540px) {
  .ifma-row-2 { grid-template-columns: 1fr; }
}
.ifma-terms {
  background: var(--ifma-purple-light);
  padding: 12px 14px;
  border-radius: 7px;
}
.ifma-terms label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  margin: 0;
  cursor: pointer;
}
.ifma-terms input[type="checkbox"] {
  width: auto;
}
.req { color: var(--ifma-red); }

/* ─── Button ─── */
.ifma-btn {
  display: inline-block;
  padding: 12px 28px;
  background: var(--ifma-purple);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, transform .1s;
  margin-top: 6px;
}
.ifma-btn:hover {
  background: var(--ifma-purple-dark);
  color: #fff;
  text-decoration: none;
}
.ifma-btn:active { transform: scale(.98); }
.ifma-btn-ghost {
  display: inline-block;
  padding: 8px 18px;
  border: 1px solid var(--ifma-border);
  background: #fff;
  color: var(--ifma-muted);
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.ifma-btn-ghost:hover { background: #f8fafc; }

/* ─── Messages ─── */
.ifma-msg {
  padding: 12px 16px;
  border-radius: 7px;
  font-size: 14px;
  margin-bottom: 12px;
}
.ifma-msg-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--ifma-red);
}
.ifma-msg-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: var(--ifma-green);
}

/* ─── Success / pending box ─── */
.ifma-success-box,
.ifma-pending-box {
  text-align: center;
  padding: 28px 20px;
}
.ifma-success-box h2,
.ifma-pending-box h2 {
  font-size: 22px;
  margin-bottom: 10px;
  color: var(--ifma-dark);
}
.ifma-hint {
  color: var(--ifma-muted);
  font-size: 13px;
  margin-top: 10px;
}

/* ─── Link box ─── */
.ifma-link-box {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 12px 0;
}
.ifma-link-box input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--ifma-border);
  border-radius: 7px;
  font-size: 13px;
  color: var(--ifma-muted);
  background: #f8fafc;
}
.ifma-copy-btn {
  padding: 9px 16px;
  background: var(--ifma-dark);
  color: #fff;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.ifma-copy-btn:hover { background: #312e81; }

/* ─── Share buttons ─── */
.ifma-share-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.ifma-share-wa,
.ifma-share-tw {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.ifma-share-wa { background: #25d366; color: #fff; }
.ifma-share-wa:hover { background: #22c55e; color: #fff; }
.ifma-share-tw { background: #0ea5e9; color: #fff; }
.ifma-share-tw:hover { background: #0284c7; color: #fff; }

/* ─── Dashboard ─── */
.ifma-dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.ifma-dash-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--ifma-dark);
}
.ifma-badge {
  display: inline-block;
  background: var(--ifma-purple-light);
  color: var(--ifma-purple);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 6px;
}
.ifma-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 640px) {
  .ifma-stats-grid { grid-template-columns: repeat(2, 1fr); }
}
.ifma-stat-card {
  background: #fff;
  border: 1px solid var(--ifma-border);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
}
.sc-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--ifma-dark);
}
.sc-label {
  font-size: 12px;
  color: var(--ifma-muted);
  margin-top: 4px;
}

/* ─── Table ─── */
.ifma-table-wrap {
  overflow-x: auto;
}
.ifma-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ifma-table th {
  background: #f8fafc;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--ifma-muted);
  border-bottom: 2px solid var(--ifma-border);
  white-space: nowrap;
}
.ifma-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
}
.ifma-empty {
  color: var(--ifma-muted);
  font-size: 14px;
  text-align: center;
  padding: 24px 0 8px;
}

/* ─── Status badges ─── */
.ifma-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}
.ifma-status-confirmed { background: #dcfce7; color: #166534; }
.ifma-status-pending   { background: #fef9c3; color: #854d0e; }
.ifma-status-cancelled { background: #fee2e2; color: #991b1b; }
.ifma-status-requested { background: #e0f2fe; color: #0369a1; }
.ifma-status-paid      { background: #dcfce7; color: #166534; }
.ifma-status-rejected  { background: #fee2e2; color: #991b1b; }
