/* Unified styles for Advanced Affiliate System shortcodes */

:root {
  --aas-primary: #7c3aed; /* violet */
  --aas-accent: #22d3ee;  /* cyan */
  --aas-bg: #0b1220;      /* deep navy */
  --aas-card: rgba(17, 24, 39, 0.6);
}

.aas-shortcode { box-sizing: border-box; }

/* Card-like containers */
.aas-card {
  background: linear-gradient(160deg, rgba(12, 18, 32, 0.85), rgba(12, 18, 32, 0.65));
  border: 1px solid rgba(124, 58, 237, 0.25);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(124, 58, 237, 0.15), inset 0 0 0 1px rgba(255,255,255,0.02);
  backdrop-filter: blur(8px);
  color: #e5e7eb;
}

/* Headings inside cards */
.aas-card h3,
.aas-card h4 { margin-top: 0; color: #0f172a; }

/* Tables */
.aas-table { width: 100%; border-collapse: collapse; }
.aas-table th,
.aas-table td { padding: 10px 12px; font-size: 14px; }
.aas-table thead th { background: #f8fafc; color: #0f172a; text-align: left; border-bottom: 1px solid #e6e8eb; }
.aas-table tbody tr { border-bottom: 1px solid #f0f2f5; }
.aas-table tbody tr:hover { background: #f3f6ff; }

/* Dark theme for tables inside cards */
.aas-card .aas-table thead th { background: rgba(124,58,237,0.12); color: #e5e7eb; border-bottom: 1px solid rgba(124,58,237,0.3); }
.aas-card .aas-table tbody tr { border-bottom: 1px solid rgba(255,255,255,0.05); }
.aas-card .aas-table tbody tr:hover { background: rgba(255,255,255,0.04); }

/* Modal table styling */
.aas-modal-content .aas-table thead th { background: rgba(124,58,237,0.12); color: #e5e7eb; border-bottom: 1px solid rgba(124,58,237,0.3); }
.aas-modal-content .aas-table tbody tr { border-bottom: 1px solid rgba(255,255,255,0.05); }
.aas-modal-content .aas-table tbody tr:hover { background: rgba(255,255,255,0.04); }

/* Force high-contrast body text in modal tables */
.aas-modal-content .aas-table tbody td,
.aas-modal-content .widefat tbody td { color: #e5e7eb !important; }

/* Neutralize inline light row backgrounds from AJAX so text stays readable */
.aas-modal-content .aas-table tbody tr[style],
.aas-modal-content .widefat tbody tr[style] { background: transparent !important; }

/* Kill striped/light backgrounds inside modal tables */
.aas-modal-content .widefat.striped tbody tr:nth-child(odd),
.aas-modal-content .widefat.striped tbody tr:nth-child(even) { background: transparent !important; }

/* Links inside modal table (e.g., order links) */
.aas-modal-content a { color: var(--aas-accent); text-decoration: none; }
.aas-modal-content a:hover { text-decoration: underline; }

/* Light theme for history table in modal: dark text on light bg */
.aas-modal-content .aas-table,
.aas-modal-content .widefat { background: #ffffff !important; color: #0f172a !important; }
.aas-modal-content .aas-table thead th,
.aas-modal-content .widefat thead th { background: #f8fafc !important; color: #0f172a !important; border-bottom: 1px solid #e5e7eb !important; }
.aas-modal-content .aas-table tbody td,
.aas-modal-content .widefat tbody td { color: #0f172a !important; }
.aas-modal-content .aas-table tbody tr,
.aas-modal-content .widefat tbody tr { background: #ffffff !important; }
.aas-modal-content .aas-table tbody tr:hover,
.aas-modal-content .widefat tbody tr:hover { background: #f6f8ff !important; }

/* Ensure modal summaries (inline-styled) are readable */
.aas-modal-content #aas-history-content > div:first-child {
  background: linear-gradient(160deg, rgba(12,18,32,0.9), rgba(12,18,32,0.7)) !important;
  color: #e5e7eb !important;
  border: 1px solid rgba(124,58,237,0.25) !important;
}
.aas-modal-content #aas-history-content > div:first-child strong { color: #ffffff !important; }

/* Normalize widefat tables in modal */
.aas-modal-content .widefat,
.aas-modal-content .widefat.striped,
.aas-modal-content .aas-table {
  background: transparent !important;
  color: #e5e7eb;
}
.aas-modal-content .widefat thead th { background: rgba(124,58,237,0.12) !important; color: #e5e7eb !important; }
.aas-modal-content .widefat tbody tr:hover { background: rgba(255,255,255,0.04) !important; }

/* Legacy contract table override to match unified style */
.aas-member-contracts .aas-contract-table { width: 100%; border-collapse: collapse; }
.aas-member-contracts .aas-contract-table th,
.aas-member-contracts .aas-contract-table td { padding: 10px 12px; font-size: 14px; border: none !important; }
.aas-member-contracts .aas-contract-table thead th { background: #f8fafc; text-align: left; border-bottom: 1px solid #e6e8eb !important; }
.aas-member-contracts .aas-contract-table tbody tr { border-bottom: 1px solid #f0f2f5 !important; }
.aas-member-contracts .aas-contract-table tbody tr:hover { background: #fafcff; }

/* Buttons (scope to shortcode areas to avoid site-wide overrides) */
.aas-shortcode .button,
.aas-shortcode .button-primary {
  border-radius: 10px;
}
.aas-shortcode .button-primary {
  background: linear-gradient(135deg, var(--aas-primary), var(--aas-accent));
  border-color: rgba(34, 211, 238, 0.5);
  box-shadow: 0 0 0 rgba(34, 211, 238, 0.0), 0 0 0 rgba(124, 58, 237, 0.0);
  transition: box-shadow 200ms ease, transform 120ms ease, filter 200ms ease;
}
.aas-shortcode .button-primary:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.35), 0 0 32px rgba(124, 58, 237, 0.25);
}

/* Modal (overlay + content) */
.aas-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: radial-gradient(1200px 600px at 20% 10%, rgba(124,58,237,0.15), transparent 70%),
              radial-gradient(900px 500px at 80% 80%, rgba(34,211,238,0.12), transparent 60%),
              rgba(6, 8, 15, 0.6);
  z-index: 9999;
  justify-content: center !important;
  align-items: center !important;
}
.aas-modal-overlay.active { display: flex; }
.aas-modal-content {
  background: linear-gradient(180deg, rgba(17,24,39,0.85), rgba(17,24,39,0.75));
  border-radius: 16px;
  padding: 22px;
  width: 100%;
  max-width: 640px;
  max-height: 82vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.03), 0 0 0 1px rgba(124,58,237,0.15) inset;
  position: relative;
  color: #e5e7eb;
  backdrop-filter: blur(10px) saturate(110%);
  animation: aas-fade-scale 220ms ease-out;
  display: flex;
  flex-direction: column;
}
.aas-modal-close {
  align-self: flex-end;
  position: sticky !important;
  top: 8px;
  z-index: 2;
  font-size: 16px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  color: #ffffff;
  background: linear-gradient(135deg, var(--aas-primary), var(--aas-accent));
  padding: 6px 10px;
  border-radius: 9999px;
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 6px 18px rgba(124,58,237,0.25);
  transition: transform 120ms ease, filter 150ms ease, box-shadow 150ms ease;
}
.aas-modal-close:hover { filter: brightness(1.05); transform: translateY(-1px); box-shadow: 0 10px 24px rgba(124,58,237,0.35); }

@keyframes aas-fade-scale {
  0% { opacity: 0; transform: translateY(6px) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
}

/* Legacy contract modal to behave like unified modal */
#aas-contract-modal { display: none; position: fixed; inset: 0; background: rgba(6,8,15,0.6); z-index: 9999; justify-content: center; align-items: center; }
#aas-contract-modal.active { display: flex; }
#aas-contract-modal .aas-modal-content { background: linear-gradient(180deg, rgba(17,24,39,0.85), rgba(17,24,39,0.75)); border-radius: 16px; padding: 22px; width: 100%; max-width: 640px; max-height: 82vh; overflow-y: auto; box-shadow: 0 25px 60px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.03), 0 0 0 1px rgba(124,58,237,0.15) inset; position: relative; color: #e5e7eb; backdrop-filter: blur(10px) saturate(110%); animation: aas-fade-scale 220ms ease-out; }
#aas-contract-modal .aas-modal-close { position: absolute; top: 10px; right: 12px; font-size: 20px; font-weight: 700; cursor: pointer; color: #cbd5e1; }

/* Toasts */
.aas-toast,
#aas-toast {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #111827;
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 8px;
  z-index: 10000;
}

/* Specific component tweaks */
.aas-exchange .aas-table { margin-top: 8px; }
.aas-transfer-list .aas-table { margin-top: 8px; }
.aas-member-contracts .aas-table { margin-top: 8px; }

/* Transfer search results container */
.aas-search-results { max-height: 160px; overflow: auto; margin-top: 6px; border: 1px solid #e6e8eb; border-radius: 8px; padding: 6px; }

/* Form controls in modals */
.aas-modal-content input[type="text"],
.aas-modal-content input[type="number"],
.aas-modal-content textarea,
.aas-modal-content .widefat {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(124, 58, 237, 0.25);
  color: #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
}
.aas-modal-content label,
.aas-card label { color: #cbd5e1; }
.aas-modal-content input:focus,
.aas-modal-content textarea:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.35);
}
.aas-modal-content #aas-history-content { max-height: none !important; overflow: visible !important; }
.aas-modal-content #aas-history-content .widefat,
.aas-modal-content #aas-history-content .widefat tbody,
.aas-modal-content #aas-history-content .widefat thead,
.aas-modal-content #aas-history-content .widefat tr,
.aas-modal-content #aas-history-content .widefat th,
.aas-modal-content #aas-history-content .widefat td { background: #ffffff !important; }
.aas-modal-content #aas-history-content .widefat th { color: #0f172a !important; }
.aas-modal-content #aas-history-content .widefat td { color: #0f172a !important; }
.aas-modal-content #aas-history-content .widefat thead th { background: #f8fafc !important; border-bottom: 1px solid #e5e7eb !important; }
.aas-modal-content #aas-history-content .widefat tbody tr:hover { background: #f6f8ff !important; }

/* myCRED badges list – lightweight theme to blend in */
.mycred-badges-list { margin-top: 12px; }
.mycred-badges-list .mycred-badges-list-tabs { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 12px; flex-wrap: wrap; }
.mycred-badges-list .mycred-badges-list-tabs li { padding: 6px 10px; border-radius: 9999px; background: rgba(124,58,237,0.12); color: #e5e7eb; cursor: pointer; border: 1px solid rgba(124,58,237,0.3); }
.mycred-badges-list .mycred-badges-list-tabs li.active { background: linear-gradient(135deg, var(--aas-primary), var(--aas-accent)); color: #fff; border-color: transparent; }
.mycred-badges-list .the-badge { background: rgba(17,24,39,0.55); border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; padding: 12px; display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.mycred-badges-list .the-badge .title { margin: 0; color: #e5e7eb; }
.mycred-badges-list .badge-images { display: flex; gap: 10px; align-items: center; }
