/**
 * ATS surfaces — account, auth and affiliate area.
 *
 * Scoped deliberately. These are the screens a member actually lives in and the
 * ones that read as unfinished: wp-login.php, WooCommerce My Account, and the
 * AffiliateWP affiliate area, none of which the theme styles meaningfully.
 *
 * Everything here consumes design-tokens.css. No literal colours.
 */

/* ===============================================================
   Shared primitives
   =============================================================== */

.ats-surface {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

/* ===============================================================
   Account navigation

   Previously one undifferentiated 20-item list: the section headings were
   styled the same as the links, so the eye had nothing to group on. Each
   section is now its own panel with a neon-green pill heading, which is the
   "eyebrow" pattern from the api.algotradingspace.com entry theme and the one
   place the design system does sanction neon green.
   =============================================================== */

.woocommerce-account .woocommerce-MyAccount-navigation {
  width: 264px;
}

.woocommerce-account .woocommerce-MyAccount-navigation ul {
  list-style: none;
  margin: 0;
  padding: 0;
  background: none;
  border: none;
}

.woocommerce-account .woocommerce-MyAccount-navigation li {
  margin: 0;
  list-style: none;
}

/* Links --------------------------------------------------------- */

.woocommerce-account .woocommerce-MyAccount-navigation li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: var(--text-dense-body);
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.woocommerce-account .woocommerce-MyAccount-navigation li a:hover {
  background: var(--color-surface-alt);
  color: var(--color-title);
}

.woocommerce-account .woocommerce-MyAccount-navigation li.is-active > a {
  background: color-mix(in srgb, var(--color-brand) 14%, transparent);
  color: var(--color-brand);
  font-weight: 600;
}

.woocommerce-account .woocommerce-MyAccount-navigation li a::before,
.woocommerce-account .woocommerce-MyAccount-navigation li a i {
  color: inherit;
  opacity: 0.75;
  font-size: 0.9em;
  width: 1.1em;
  text-align: center;
}

/* Section headings ---------------------------------------------- */

.woocommerce-account .woocommerce-MyAccount-navigation li[class*="_section"] {
  background: none;
  border: none;
  box-shadow: none;
  margin: 0 0 8px;
  padding: 0;
  pointer-events: none;
}

.woocommerce-account .woocommerce-MyAccount-navigation li[class*="_section"] a {
  display: inline-flex;
  background: color-mix(in srgb, var(--color-brand-accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-brand-accent) 30%, transparent);
  border-radius: var(--radius-full);
  color: var(--color-brand-accent);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  padding: 4px 12px;
  text-transform: uppercase;
}

.woocommerce-account .woocommerce-MyAccount-navigation li[class*="_section"] a:hover {
  background: color-mix(in srgb, var(--color-brand-accent) 14%, transparent);
  color: var(--color-brand-accent);
}

/* Grouping ------------------------------------------------------

   WooCommerce renders one flat <ul>, so the sections cannot be wrapped in real
   containers without replacing the template. Instead each heading opens a new
   visual group: the panel background is drawn by the items, and a heading
   introduces a gap and a rule above itself. */

.woocommerce-account .woocommerce-MyAccount-navigation li:not([class*="_section"]) {
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  padding: 2px 6px;
}

.woocommerce-account .woocommerce-MyAccount-navigation li[class*="_section"] + li {
  border-top: 1px solid var(--color-border);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  padding-top: 6px;
}

/* Close the panel on the last item before the next heading. */
.woocommerce-account .woocommerce-MyAccount-navigation li:not([class*="_section"]):has(+ li[class*="_section"]),
.woocommerce-account .woocommerce-MyAccount-navigation li:not([class*="_section"]):last-child {
  border-bottom: 1px solid var(--color-border);
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
  margin-bottom: 22px;
  padding-bottom: 6px;
}

.woocommerce-account .woocommerce-MyAccount-navigation li:not([class*="_section"]):last-child {
  margin-bottom: 0;
}

/* Dashboard sits above the first heading and is its own single-item panel. */
.woocommerce-account .woocommerce-MyAccount-navigation li:first-child:not([class*="_section"]) {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: 22px;
  padding: 6px;
}

/* ===============================================================
   Account content
   =============================================================== */

.woocommerce-account .woocommerce-MyAccount-content {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  font-size: var(--text-dense-body);
  color: var(--color-text);
}

.woocommerce-account .woocommerce-MyAccount-content h2,
.woocommerce-account .woocommerce-MyAccount-content h3 {
  color: var(--color-title);
  font-family: var(--font-title);
  font-size: var(--text-dense-section);
  margin-top: 0;
}

.woocommerce table.shop_table {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

@media (max-width: 768px) {
  .woocommerce-account .woocommerce-MyAccount-navigation {
    width: 100%;
    margin-bottom: 24px;
  }
}

/* ===============================================================
   Site header

   algotradingspace.com uses a flat --color-surface-2 masthead. Matching it is
   most of what makes the two properties read as one product.
   =============================================================== */

.site-header,
#masthead,
.ast-primary-header-bar {
  border-bottom: 1px solid var(--color-border);
}

.site-header .main-header-menu > .menu-item > .menu-link,
.ast-header-break-point .main-header-menu > .menu-item > .menu-link {
  color: var(--color-text-light);
}

.site-header .main-header-menu > .menu-item > .menu-link:hover,
.site-header .main-header-menu > .current-menu-item > .menu-link {
  color: var(--color-brand);
}

/* ===============================================================
   Notices — WooCommerce and our own onboarding pages
   =============================================================== */

.woocommerce-message,
.woocommerce-info,
.woocommerce-error,
.ats-recovery,
.ums-notice {
  border-radius: var(--radius-md);
  border-left: 4px solid var(--color-brand);
  background: var(--color-surface-alt);
  color: var(--color-title);
  font-size: var(--text-dense-body);
  padding: 14px 16px;
  margin-bottom: 20px;
}

.woocommerce-message {
  border-left-color: var(--color-success);
  background: color-mix(in srgb, var(--color-success) 12%, transparent);
}
.woocommerce-error {
  border-left-color: var(--color-error);
  background: color-mix(in srgb, var(--color-error) 12%, transparent);
}
.woocommerce-info,
.ats-recovery        { border-left-color: var(--color-brand); }

.ats-recovery a,
.ums-notice a,
.woocommerce-info a {
  color: var(--color-brand);
  font-weight: 600;
}

/* ===============================================================
   AffiliateWP — affiliate area

   Selectors verified against AffiliateWP 2.35 markup. The dashboard sits
   inside an `alignfull` block on the Affiliate Area page, so it escapes the
   theme container and runs edge to edge; the max-width below puts it back.
   =============================================================== */

#affwp-affiliate-dashboard {
  max-width: 1240px;
  margin: 0 auto;
  padding: 8px 16px 48px;
  font-size: var(--text-dense-body);
}

/* The account nav is injected above the shortcode, so it needs the same
   gutter the dashboard gives itself. */
.ats-affiliate > .ats-account-nav {
  max-width: 1240px;
  margin: 0 auto 8px;
  padding-left: 16px;
  padding-right: 16px;
}

/* --- Tabs --- */

#affwp-affiliate-dashboard-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  border-bottom: 1px solid var(--color-border);
}

li.affwp-affiliate-dashboard-tab {
  margin: 0;
  list-style: none;
}

li.affwp-affiliate-dashboard-tab a {
  display: block;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  color: var(--color-text-muted);
  font-size: var(--text-dense-body);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

li.affwp-affiliate-dashboard-tab a:hover {
  background: var(--color-surface-alt);
  color: var(--color-title);
}

li.affwp-affiliate-dashboard-tab.active a {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-brand);
  font-weight: 600;
  margin-bottom: -1px;
  padding-bottom: 11px;
}

/* --- Cards --- */

.affwp-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  overflow: hidden;
}

.affwp-card__header {
  border-bottom: 1px solid var(--color-border);
  padding: 16px 20px;
}

.affwp-card__header h1,
.affwp-card__header h2,
.affwp-card__header h3 {
  font-family: var(--font-title);
  font-size: var(--text-dense-section);
  font-weight: 600;
  color: var(--color-title);
  margin: 0;
  line-height: 1.3;
}

.affwp-card__content {
  padding: 20px;
}

/* --- Tables --- */

table.affwp-table {
  width: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  font-size: var(--text-dense-body);
}

table.affwp-table th {
  background: var(--color-surface-alt);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: var(--text-dense-small);
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 12px 16px;
  text-align: left;
  text-transform: uppercase;
}

table.affwp-table td {
  border-top: 1px solid var(--color-border);
  padding: 12px 16px;
  color: var(--color-text);
}

table.affwp-table tbody tr:first-child td {
  border-top: none;
}

table.affwp-table tbody tr:hover td {
  background: var(--color-surface-alt);
}

table.affwp-table a {
  color: var(--color-brand);
}

/* --- Forms --- */

/* Full width like every other card on the page — capping this at 520px left
   the link generator as a narrow slab beside a full-width table. */
.affwp-form {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

/* Inputs inside it stay readable rather than stretching the full span. */
.affwp-form input[type="text"],
.affwp-form input[type="email"],
.affwp-form input[type="url"],
.affwp-form select {
  max-width: 520px;
}

/* The generator form wraps its own card, so it must not double the chrome. */
.affwp-form .affwp-card {
  background: none;
  border: none;
  margin: 0;
}

.affwp-form .affwp-card__content { padding: 0; }

.affwp-form legend {
  font-family: var(--font-title);
  font-size: var(--text-dense-section);
  font-weight: 600;
  color: var(--color-title);
  padding: 0 0 16px;
}

.affwp-form label {
  display: block;
  margin-bottom: 6px;
  color: var(--color-text);
  font-size: var(--text-dense-small);
  font-weight: 600;
}

.affwp-form input[type="text"],
.affwp-form input[type="email"],
.affwp-form input[type="password"],
.affwp-form input[type="url"],
.affwp-form textarea,
.affwp-form select {
  width: 100%;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-form-border);
  border-radius: var(--radius-md);
  color: var(--color-title);
  font-family: var(--font-sans);
  font-size: var(--text-dense-body);
  padding: 10px 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.affwp-form input:focus,
.affwp-form textarea:focus,
.affwp-form select:focus {
  border-color: var(--color-form-focus);
  box-shadow: 0 0 0 3px var(--color-brand-hover-shadow);
  outline: none;
}

.affwp-form input[type="submit"],
.affwp-form button[type="submit"],
#affwp-affiliate-dashboard .button {
  background: var(--color-brand);
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-surface-white);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: var(--text-dense-body);
  font-weight: 600;
  padding: 11px 22px;
  width: auto;
  transition: filter 0.15s ease, box-shadow 0.15s ease;
}

.affwp-form input[type="submit"]:hover,
.affwp-form button[type="submit"]:hover,
#affwp-affiliate-dashboard .button:hover {
  background: var(--color-brand-dark);
  box-shadow: var(--shadow-brand);
}

.affwp-errors {
  background: var(--color-surface-warm);
  border-left: 4px solid var(--color-error);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 20px;
}

.affwp-error {
  color: var(--color-title);
  font-size: var(--text-dense-body);
  margin: 0 0 4px;
}

.affwp-lost-password a {
  color: var(--color-brand);
  font-size: var(--text-dense-small);
}

/* ===============================================================
   Onboarding pages (confirm-your-email, email-verified)
   =============================================================== */

.ums-resend-form {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  max-width: 480px;
}

.ums-resend-form input[type="email"] {
  width: 100%;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-form-border);
  border-radius: var(--radius-md);
  color: var(--color-title);
  font-size: var(--text-dense-body);
  padding: 10px 12px;
}

.ums-resend-form button {
  background: var(--color-brand);
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-surface-white);
  cursor: pointer;
  font-size: var(--text-dense-body);
  font-weight: 600;
  padding: 11px 22px;
}

.ums-resend-form button:hover {
  background: var(--color-brand-dark);
  box-shadow: var(--shadow-brand);
}

/* ===============================================================
   Responsive
   =============================================================== */

@media (max-width: 768px) {
  .woocommerce-account .woocommerce-MyAccount-navigation {
    width: 100%;
    margin-bottom: 20px;
  }

  .affwp-form,
  .ums-resend-form {
    max-width: none;
  }

  #affwp-affiliate-dashboard .affwp-tab-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
  }
}

/* ===============================================================
   Dark surface corrections

   The stock logo is dark artwork for a light masthead. On the dark member
   surfaces it is swapped for the same white asset algotradingspace.com serves
   in dark mode, rather than being filter-inverted.
   =============================================================== */

.dark .custom-logo,
.dark .site-logo-img img,
.dark .ast-site-identity img {
  content: url("../img/Algo-Trading-Space-logo-white-min.png");
}

/* WooCommerce and Astra draw light-mode dividers between account rows. */
.dark .woocommerce-account .woocommerce-MyAccount-navigation li,
.dark .woocommerce-account .woocommerce-MyAccount-navigation li + li {
  border: none;
}

.dark .woocommerce-account .woocommerce-MyAccount-navigation ul {
  background: var(--color-surface);
}

/* Astra paints the content area from its own global colour; on a dark surface
   that leaves a pale slab behind the cards. */
.dark #content,
.dark #primary,
.dark .site-content,
.dark .ast-container,
.dark .entry-content {
  background: transparent;
}

.dark body,
.dark #page {
  background: var(--color-body);
  color: var(--color-text);
}

.dark h1, .dark h2, .dark h3, .dark h4, .dark h5, .dark h6,
.dark .entry-title {
  color: var(--color-title);
}

/* Deliberately low specificity (0,1,1). The buttons and the account nav below
   set their own colours and must win; a :not() chain here raised this rule
   above them and turned every sidebar item brand-green. */
.dark a {
  color: var(--color-brand);
}

/* WooCommerce buttons. --color-body is near-black in dark and white in light,
   so it stays legible on the brand fill in both themes. */
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce a.woocommerce-button,
.wp-element-button {
  background: var(--color-brand);
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-body);
  font-size: var(--text-dense-body);
  font-weight: 600;
  padding: 9px 18px;
  line-height: 1.4;
  transition: filter 0.15s ease, box-shadow 0.15s ease;
}

.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover,
.woocommerce a.woocommerce-button:hover,
.wp-element-button:hover {
  background: var(--color-brand-dark);
  color: var(--color-body);
  box-shadow: var(--shadow-brand);
}

.dark input[type="text"],
.dark input[type="email"],
.dark input[type="password"],
.dark input[type="tel"],
.dark input[type="url"],
.dark input[type="number"],
.dark textarea,
.dark select {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-form-border);
  color: var(--color-title);
}

.dark input::placeholder,
.dark textarea::placeholder {
  color: var(--color-text-muted);
}

.dark .site-footer,
.dark .ast-small-footer,
.dark footer.site-footer {
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
}

/* Account nav colours, re-asserted under .dark so the blanket link rule above
   cannot repaint every item in the brand colour. */
.dark .woocommerce-account .woocommerce-MyAccount-navigation li a {
  color: var(--color-text);
}

.dark .woocommerce-account .woocommerce-MyAccount-navigation li a:hover {
  color: var(--color-title);
}

.dark .woocommerce-account .woocommerce-MyAccount-navigation li.is-active > a {
  color: var(--color-brand);
}

.dark .woocommerce-account .woocommerce-MyAccount-navigation li[class*="_section"] a {
  color: var(--color-text-muted);
}
