/* ==========================================================================
   Mind Affiliates — Frontend CSS  v1.1
   Totalmente escopado sob .maff-scope para isolar do tema WordPress.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* --------------------------------------------------------------------------
   Variáveis — fora do escopo para que o :root não seja sobrescrito
   -------------------------------------------------------------------------- */
.maff-scope {
  /* cores */
  --maff-white:       #ffffff;
  --maff-bg:          #f9fafb;
  --maff-border:      #e5e7eb;
  --maff-border-light:#f3f4f6;
  --maff-text:        #111827;
  --maff-text-2:      #374151;
  --maff-muted:       #6b7280;
  --maff-muted-light: #9ca3af;
  --maff-primary:     #2563eb;
  --maff-primary-h:   #1d4ed8;
  --maff-primary-bg:  #eff6ff;
  --maff-success:     #16a34a;
  --maff-warning:     #d97706;
  --maff-danger:      #dc2626;
  /* geometria */
  --maff-radius:      8px;
  --maff-radius-sm:   6px;
  --maff-font:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* --------------------------------------------------------------------------
   RESET dentro do escopo — anula herança do tema
   -------------------------------------------------------------------------- */
.maff-scope,
.maff-scope *,
.maff-scope *::before,
.maff-scope *::after {
  box-sizing: border-box !important;
  -webkit-font-smoothing: antialiased;
}

.maff-scope {
  font-family: var(--maff-font) !important;
  font-size: 14px !important;
  line-height: 1.5 !important;
  color: var(--maff-text) !important;
  background: none !important;
}

/* Reset seletivo em elementos que temas geralmente mexem */
.maff-scope h1,
.maff-scope h2,
.maff-scope h3,
.maff-scope h4 {
  font-family: var(--maff-font) !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  color: var(--maff-text) !important;
  background: none !important;
}

.maff-scope p {
  margin: 0 !important;
  padding: 0 !important;
  font-size: inherit !important;
  line-height: 1.5 !important;
}

.maff-scope ul,
.maff-scope ol {
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

.maff-scope a {
  color: var(--maff-primary) !important;
  text-decoration: none !important;
  font-weight: 500 !important;
}
.maff-scope a:hover {
  text-decoration: underline !important;
}

.maff-scope table {
  border-collapse: collapse !important;
  border-spacing: 0 !important;
}

.maff-scope input,
.maff-scope select,
.maff-scope textarea,
.maff-scope button {
  font-family: var(--maff-font) !important;
  font-size: 14px !important;
  box-shadow: none !important;
  outline: none !important;
}

/* --------------------------------------------------------------------------
   Card
   -------------------------------------------------------------------------- */
.maff-scope .maff-card {
  background: var(--maff-white) !important;
  border: 1px solid var(--maff-border) !important;
  border-radius: var(--maff-radius) !important;
  padding: 1.5rem !important;
  box-shadow: none !important;
  margin: 0 !important;
}
.maff-scope .maff-card + .maff-card {
  margin-top: 1rem !important;
}
.maff-scope .maff-card__title {
  font-size: 14px !important;
  font-weight: 600 !important;
  color: var(--maff-text) !important;
  letter-spacing: -.01em !important;
  margin-bottom: 1.25rem !important;
}

/* --------------------------------------------------------------------------
   Dashboard
   -------------------------------------------------------------------------- */
.maff-scope .maff-dashboard {
  max-width: 960px !important;
  margin: 0 auto !important;
  background: var(--maff-bg) !important;
  padding: 1.75rem !important;
  border-radius: var(--maff-radius) !important;
}
.maff-scope .maff-dashboard__header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  margin-bottom: 1.5rem !important;
}
.maff-scope .maff-dashboard__title {
  font-size: 20px !important;
  font-weight: 700 !important;
  color: var(--maff-text) !important;
  letter-spacing: -.03em !important;
  margin-bottom: 2px !important;
}
.maff-scope .maff-dashboard__sub {
  font-size: 13px !important;
  color: var(--maff-muted) !important;
}

/* --------------------------------------------------------------------------
   Tabs
   -------------------------------------------------------------------------- */
.maff-scope .maff-tabs {
  display: flex !important;
  border-bottom: 1px solid var(--maff-border) !important;
  margin-bottom: 1.25rem !important;
  gap: 0 !important;
  padding: 0 !important;
  background: none !important;
}
.maff-scope .maff-tab {
  background: none !important;
  border: none !important;
  border-bottom: 2px solid transparent !important;
  margin-bottom: -1px !important;
  padding: .6rem 1.1rem !important;
  font-family: var(--maff-font) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: var(--maff-muted) !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  transition: color .12s, border-color .12s !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  line-height: 1.4 !important;
}
.maff-scope .maff-tab:hover {
  color: var(--maff-text-2) !important;
  background: none !important;
}
.maff-scope .maff-tab--active {
  color: var(--maff-text) !important;
  border-bottom-color: var(--maff-text) !important;
  font-weight: 600 !important;
}
.maff-scope .maff-tab-panel { display: none !important; }
.maff-scope .maff-tab-panel--active { display: block !important; }

/* --------------------------------------------------------------------------
   Big numbers — grid com divisórias finas
   -------------------------------------------------------------------------- */
.maff-scope .maff-stats {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  background: var(--maff-white) !important;
  border: 1px solid var(--maff-border) !important;
  border-radius: var(--maff-radius) !important;
  margin-bottom: 1rem !important;
  overflow: hidden !important;
}
.maff-scope .maff-stat-card {
  padding: 1.25rem 1.5rem !important;
  border-right: 1px solid var(--maff-border) !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  background: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}
.maff-scope .maff-stat-card:nth-child(3n)  { border-right: none !important; }
.maff-scope .maff-stat-card:nth-child(n+4) { border-top: 1px solid var(--maff-border) !important; }
.maff-scope .maff-stat-card__label {
  font-size: 11px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: .06em !important;
  color: var(--maff-muted) !important;
  line-height: 1 !important;
}
.maff-scope .maff-stat-card__value {
  font-size: 24px !important;
  font-weight: 700 !important;
  color: var(--maff-text) !important;
  letter-spacing: -.03em !important;
  line-height: 1.1 !important;
}
.maff-scope .maff-stat-card--highlight .maff-stat-card__value { color: var(--maff-primary) !important; }
.maff-scope .maff-stat-card--highlight .maff-stat-card__label { color: var(--maff-primary) !important; }

/* --------------------------------------------------------------------------
   Link box
   -------------------------------------------------------------------------- */
.maff-scope .maff-link-box {
  display: flex !important;
  gap: .5rem !important;
  margin-bottom: .75rem !important;
  align-items: center !important;
}
.maff-scope .maff-link-box input {
  flex: 1 !important;
  min-width: 0 !important;
  border: 1px solid var(--maff-border) !important;
  border-radius: var(--maff-radius-sm) !important;
  padding: .55rem .85rem !important;
  font-size: 13px !important;
  color: var(--maff-muted) !important;
  background: var(--maff-bg) !important;
  height: 38px !important;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.maff-scope .maff-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: .35rem !important;
  padding: .55rem 1.1rem !important;
  border-radius: var(--maff-radius-sm) !important;
  font-family: var(--maff-font) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  border: 1px solid transparent !important;
  transition: background .12s, border-color .12s, color .12s !important;
  text-decoration: none !important;
  line-height: 1.4 !important;
  white-space: nowrap !important;
  box-shadow: none !important;
  background-image: none !important;
  text-shadow: none !important;
}
.maff-scope .maff-btn--primary {
  background: var(--maff-primary) !important;
  color: #fff !important;
  border-color: var(--maff-primary) !important;
}
.maff-scope .maff-btn--primary:hover {
  background: var(--maff-primary-h) !important;
  border-color: var(--maff-primary-h) !important;
  color: #fff !important;
}
.maff-scope .maff-btn--ghost {
  background: var(--maff-white) !important;
  color: var(--maff-text-2) !important;
  border-color: var(--maff-border) !important;
}
.maff-scope .maff-btn--ghost:hover {
  background: var(--maff-bg) !important;
  color: var(--maff-text) !important;
}
.maff-scope .maff-btn--sm { padding: .35rem .75rem !important; font-size: 12px !important; }
.maff-scope .maff-btn:disabled { opacity: .5 !important; cursor: not-allowed !important; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.maff-scope .maff-form__row {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
  gap: 1rem !important;
  margin-bottom: 1rem !important;
}
.maff-scope .maff-form__field {
  display: flex !important;
  flex-direction: column !important;
  gap: 5px !important;
}
.maff-scope .maff-form__field label {
  display: block !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: var(--maff-text-2) !important;
  margin: 0 !important;
  padding: 0 !important;
  float: none !important;
  width: auto !important;
}
.maff-scope .maff-form__field input,
.maff-scope .maff-form__field select,
.maff-scope .maff-form__field textarea {
  display: block !important;
  width: 100% !important;
  height: 40px !important;
  padding: .55rem .85rem !important;
  font-family: var(--maff-font) !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  color: var(--maff-text) !important;
  background: var(--maff-white) !important;
  border: 1px solid var(--maff-border) !important;
  border-radius: var(--maff-radius-sm) !important;
  box-shadow: none !important;
  outline: none !important;
  margin: 0 !important;
  transition: border-color .12s, box-shadow .12s !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}
.maff-scope .maff-form__field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right .75rem center !important;
  padding-right: 2.25rem !important;
  cursor: pointer !important;
}
.maff-scope .maff-form__field textarea {
  height: auto !important;
  resize: vertical !important;
}
.maff-scope .maff-form__field input::placeholder,
.maff-scope .maff-form__field textarea::placeholder {
  color: var(--maff-muted-light) !important;
  font-weight: 400 !important;
}
.maff-scope .maff-form__field input:focus,
.maff-scope .maff-form__field select:focus,
.maff-scope .maff-form__field textarea:focus {
  border-color: var(--maff-primary) !important;
  box-shadow: 0 0 0 3px rgba(37,99,235,.1) !important;
}
.maff-scope .maff-req { color: var(--maff-danger) !important; margin-left: 1px !important; }
.maff-scope .maff-form__footer {
  margin-top: .85rem !important;
  font-size: 13px !important;
  color: var(--maff-muted) !important;
}

/* --------------------------------------------------------------------------
   Tables — Stripe/Linear
   -------------------------------------------------------------------------- */
.maff-scope .maff-table-wrap {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  border: 1px solid var(--maff-border) !important;
  border-radius: var(--maff-radius-sm) !important;
}
.maff-scope .maff-table {
  width: 100% !important;
  border-collapse: collapse !important;
  font-size: 13px !important;
}
.maff-scope .maff-table th {
  background: var(--maff-bg) !important;
  font-family: var(--maff-font) !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: .06em !important;
  color: var(--maff-muted) !important;
  padding: .65rem 1rem !important;
  text-align: left !important;
  border-bottom: 1px solid var(--maff-border) !important;
  white-space: nowrap !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
}
.maff-scope .maff-table td {
  padding: .7rem 1rem !important;
  border-bottom: 1px solid var(--maff-border-light) !important;
  vertical-align: middle !important;
  color: var(--maff-text-2) !important;
  font-size: 13px !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
}
.maff-scope .maff-table td strong { color: var(--maff-text) !important; font-weight: 600 !important; }
.maff-scope .maff-table tr:last-child td { border-bottom: none !important; }
.maff-scope .maff-table tbody tr:hover td { background: var(--maff-bg) !important; }

/* --------------------------------------------------------------------------
   Badges
   -------------------------------------------------------------------------- */
.maff-scope .maff-badge {
  display: inline-flex !important;
  align-items: center !important;
  padding: 2px 8px !important;
  border-radius: 4px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  letter-spacing: .02em !important;
  white-space: nowrap !important;
  line-height: 1.6 !important;
}
.maff-scope .maff-badge--pending   { background: #fef9c3 !important; color: #854d0e !important; }
.maff-scope .maff-badge--approved,
.maff-scope .maff-badge--active    { background: #dcfce7 !important; color: #166534 !important; }
.maff-scope .maff-badge--paid      { background: #dbeafe !important; color: #1e40af !important; }
.maff-scope .maff-badge--rejected,
.maff-scope .maff-badge--cancelled,
.maff-scope .maff-badge--suspended { background: #fee2e2 !important; color: #991b1b !important; }

/* --------------------------------------------------------------------------
   Notices
   -------------------------------------------------------------------------- */
.maff-scope .maff-notice {
  padding: .75rem 1rem !important;
  border-radius: var(--maff-radius-sm) !important;
  border: 1px solid !important;
  font-size: 13px !important;
  margin-bottom: 1rem !important;
  line-height: 1.5 !important;
  display: block !important;
}
.maff-scope .maff-notice--info    { background: var(--maff-primary-bg) !important; border-color: #bfdbfe !important; color: #1e3a8a !important; }
.maff-scope .maff-notice--warning { background: #fffbeb !important; border-color: #fde68a !important; color: #78350f !important; }
.maff-scope .maff-notice--success { background: #f0fdf4 !important; border-color: #bbf7d0 !important; color: #14532d !important; }
.maff-scope .maff-notice--error   { background: #fef2f2 !important; border-color: #fecaca !important; color: #7f1d1d !important; }

/* --------------------------------------------------------------------------
   Misc
   -------------------------------------------------------------------------- */
.maff-scope .maff-hint {
  font-size: 12px !important;
  color: var(--maff-muted) !important;
  line-height: 1.5 !important;
}
.maff-scope .maff-empty {
  text-align: center !important;
  color: var(--maff-muted) !important;
  padding: 2.5rem 0 !important;
  font-size: 13px !important;
}
.maff-scope .maff-details summary {
  cursor: pointer !important;
  color: var(--maff-primary) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  list-style: disclosure-closed !important;
}
.maff-scope .maff-product-list {
  margin: .35rem 0 0 1.25rem !important;
  list-style: disc !important;
  font-size: 12px !important;
  color: var(--maff-muted) !important;
  line-height: 1.6 !important;
}
.maff-scope .maff-product-list li { margin: 0 !important; padding: 0 !important; }

/* --------------------------------------------------------------------------
   Register — largura maior, form generoso
   -------------------------------------------------------------------------- */
.maff-scope.maff-register {
  max-width: 820px !important;
  width: 100% !important;
  margin: 0 auto !important;
}
.maff-scope.maff-register .maff-card {
  padding: 2.5rem 3rem !important;
}
.maff-scope.maff-register .maff-card__title {
  font-size: 20px !important;
  margin-bottom: 1.75rem !important;
}
.maff-scope.maff-register .maff-form__row {
  grid-template-columns: 1fr 1fr !important;
  gap: 1.25rem !important;
  margin-bottom: 1.25rem !important;
}
.maff-scope.maff-register .maff-form__field label { font-size: 14px !important; }
.maff-scope.maff-register .maff-form__field input,
.maff-scope.maff-register .maff-form__field select {
  height: 44px !important;
  font-size: 15px !important;
  padding: .7rem 1rem !important;
}
.maff-scope.maff-register .maff-btn--primary {
  margin-top: .75rem !important;
  padding: .8rem 2rem !important;
  font-size: 15px !important;
  height: 46px !important;
}

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */
.maff-scope.maff-login {
  max-width: 440px !important;
  width: 100% !important;
  margin: 0 auto !important;
}
.maff-scope.maff-login .maff-card {
  padding: 2.25rem 2.5rem !important;
}
.maff-scope.maff-login .maff-card__title {
  font-size: 20px !important;
  margin-bottom: 1.5rem !important;
}
.maff-scope.maff-login .maff-form__field {
  margin-bottom: .75rem !important;
}
.maff-scope.maff-login .maff-form__field label { font-size: 14px !important; }
.maff-scope.maff-login .maff-form__field input {
  height: 44px !important;
  font-size: 15px !important;
}
.maff-scope.maff-login .maff-btn--primary {
  width: 100% !important;
  height: 46px !important;
  font-size: 15px !important;
  margin-top: .5rem !important;
}

/* --------------------------------------------------------------------------
   Responsive — tablet (≤ 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .maff-scope .maff-stats {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .maff-scope .maff-stat-card:nth-child(3n)  { border-right: 1px solid var(--maff-border) !important; }
  .maff-scope .maff-stat-card:nth-child(2n)  { border-right: none !important; }
  .maff-scope .maff-stat-card:nth-child(n+3) { border-top: 1px solid var(--maff-border) !important; }
  .maff-scope .maff-stat-card:nth-child(3)   { border-top: 1px solid var(--maff-border) !important; }
  .maff-scope .maff-link-box { flex-direction: column !important; }
  .maff-scope .maff-link-box .maff-btn { width: 100% !important; }
  .maff-scope.maff-register .maff-form__row  { grid-template-columns: 1fr !important; }
  .maff-scope.maff-register .maff-card { padding: 1.75rem 1.5rem !important; }
}

/* --------------------------------------------------------------------------
   Responsive — mobile (≤ 480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .maff-scope .maff-dashboard { padding: 1rem .75rem !important; }
  .maff-scope .maff-dashboard__header { flex-direction: column !important; align-items: flex-start !important; gap: .5rem !important; }
  .maff-scope .maff-dashboard__title  { font-size: 17px !important; }
  .maff-scope .maff-card { padding: 1rem !important; }
  .maff-scope .maff-stats { grid-template-columns: 1fr 1fr !important; }
  .maff-scope .maff-stat-card { padding: 1rem !important; }
  .maff-scope .maff-stat-card__value { font-size: 18px !important; }

  .maff-scope .maff-tabs {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }
  .maff-scope .maff-tabs::-webkit-scrollbar { display: none !important; }
  .maff-scope .maff-tab { padding: .5rem .75rem !important; font-size: 12px !important; }

  .maff-scope .maff-form__row { grid-template-columns: 1fr !important; }

  /* tabela empilhada como cards */
  .maff-scope .maff-table-wrap { border: none !important; }
  .maff-scope .maff-table thead { display: none !important; }
  .maff-scope .maff-table,
  .maff-scope .maff-table tbody,
  .maff-scope .maff-table tr,
  .maff-scope .maff-table td { display: block !important; width: 100% !important; }
  .maff-scope .maff-table tr {
    background: var(--maff-white) !important;
    border: 1px solid var(--maff-border) !important;
    border-radius: var(--maff-radius-sm) !important;
    padding: .75rem 1rem !important;
    margin-bottom: .5rem !important;
  }
  .maff-scope .maff-table tbody tr:hover td { background: transparent !important; }
  .maff-scope .maff-table td {
    border: none !important;
    padding: .18rem 0 !important;
    font-size: 13px !important;
    display: flex !important;
    align-items: baseline !important;
    gap: .35rem !important;
  }
  .maff-scope .maff-table td::before {
    content: attr(data-label) !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: .05em !important;
    color: var(--maff-muted) !important;
    min-width: 72px !important;
    flex-shrink: 0 !important;
  }

  .maff-scope.maff-register .maff-card,
  .maff-scope.maff-login .maff-card { padding: 1.25rem !important; }
  .maff-scope.maff-register .maff-card__title,
  .maff-scope.maff-login .maff-card__title { font-size: 16px !important; }
  .maff-scope.maff-register .maff-form__row { grid-template-columns: 1fr !important; }
  .maff-scope.maff-register .maff-form__field input,
  .maff-scope.maff-register .maff-form__field select,
  .maff-scope.maff-login .maff-form__field input { height: 42px !important; font-size: 14px !important; }
}
