/*
 * AIXS Cloud client area: Nexus child theme (docs/frontend-plan.md section 6).
 * A light, readable body inside the dark AIXS brand frame.
 *
 * This file replaces Nexus' own css/custom.css, which is where Nexus defines
 * its design tokens, so the full token set below must stay complete. Nexus
 * Cart reads --primary & co. through its --vl-* variables (inside its Shadow
 * DOM), so the cart follows these tokens too.
 *
 * Files: custom.css (tokens, base, Bootstrap/Nexus components),
 * aixs-shell.css (header, title band, footer, shared AIXS atoms),
 * aixs-pages.css (portal home, auth, support, checkout, client area);
 * the store and configure pages live in orderforms/aixs_cart/css/custom.css.
 *
 * Contrast (WCAG AA): --primary #5B3FD9 is 6.65:1 on white and carries white
 * text at 6.65:1; --text #14141F is 16.7:1 on --bg-lifted; --text-lifted
 * #6E6C85 is 5.0:1 on white.
 */

/* ---------- fonts (self-hosted: mainland visitors cannot rely on Google Fonts) ---------- */
@font-face { font-family: "Chakra Petch"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/chakra-petch-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Chakra Petch"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/chakra-petch-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2"); }

:root {
    /* AIXS brand (dark frame) */
    --aixs-abyss: #0b0b16;
    --aixs-void: #121222;
    --aixs-band: #10101f;
    --aixs-neon: #9d7bff;
    --aixs-quantum: #7b61ff;
    --aixs-plasma: #ff2e8c;
    --aixs-cold: #8a8aa3;
    --aixs-dim: #5c5c75;
    --aixs-signal: #3ddc97;
    --aixs-amber: #ffb547;
    --aixs-line-dark: rgba(157, 123, 255, 0.22);

    /* Light body: inks for status on white (AA) */
    --aixs-paper: #f4f3f9;
    --aixs-signal-ink: #04784f;
    --aixs-amber-ink: #9a4d00;
    --aixs-plasma-ink: #b01f6c;
    --aixs-ease: cubic-bezier(0.2, 0.8, 0.2, 1);

    --aixs-font-display: "Chakra Petch", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
    --aixs-font-mono: "JetBrains Mono", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", ui-monospace, monospace;

    --white: #fff;

    /* Neutral shades, faintly violet so the body sits in the same family as the frame */
    --neutral-50: #fafafc;
    --neutral-100: #f4f3f9;
    --neutral-200: #e7e5ef;
    --neutral-300: #d6d4e2;
    --neutral-400: #a3a1b8;
    --neutral-500: #6e6c85;
    --neutral-600: #545269;
    --neutral-700: #3b3a4f;
    --neutral-800: #23222f;
    --neutral-900: #14141f;
    --neutral-950: #0b0b16;

    /* Primary: AIXS violet ramp (600 is the accessible ink on light backgrounds) */
    --primary-50: #f5f3ff;
    --primary-100: #ede9fe;
    --primary-200: #ddd6fe;
    --primary-300: #c4b5fd;
    --primary-400: #a78bfa;
    --primary-500: #8b6cf7;
    --primary-600: #5b3fd9;
    --primary-700: #4f35c4;
    --primary-800: #432ba8;
    --primary-900: #2e1d78;
    --primary-950: #1b1150;

    --primary: var(--primary-600);
    --primary-lifted: var(--primary-700);
    --primary-accented: var(--primary-800);

    --secondary: var(--neutral-500);
    --secondary-lifted: var(--neutral-600);
    --secondary-accented: var(--neutral-700);

    --success: #04784f;
    --success-lifted: #03663f;
    --success-accented: #025433;

    --info: var(--primary-600);
    --info-lifted: var(--primary-700);
    --info-accented: var(--primary-800);

    --notice: #b01f6c;
    --notice-lifted: #961a5c;
    --notice-accented: #7b154b;

    --warning: #9a4d00;
    --warning-lifted: #803f00;
    --warning-accented: #663200;

    --error: #c81e1e;
    --error-lifted: #a91919;
    --error-accented: #8a1414;

    --grayscale: var(--neutral-900);
    --grayscale-lifted: var(--neutral-800);
    --grayscale-accented: var(--neutral-700);

    --neutral: var(--neutral-500);
    --neutral-lifted: var(--neutral-600);
    --neutral-accented: var(--neutral-700);

    --text-inverted: var(--white);
    --text-muted: var(--neutral-400);
    --text-lifted: var(--neutral-500);
    --text-accented: var(--neutral-600);
    --text: var(--neutral-900);

    --border-muted: var(--neutral-200);
    --border: var(--neutral-300);
    --border-lifted: var(--neutral-400);
    --border-accented: var(--neutral-600);

    --bg: var(--white);
    --bg-muted: var(--neutral-50);
    --bg-lifted: var(--neutral-100);
    --bg-accented: var(--neutral-200);
    --bg-inverted: var(--aixs-abyss);

    --yellow-200: #fff085;
    --yellow-300: #ffdf20;
    --teal-300: #46edd5;
    --teal-400: #00d5be;
    --emerald-300: #5ee9b5;
    --pink-400: #fb64b6;

    --text-xs: 0.6875rem;
    --text-sm: 0.75rem;
    --text-md: 0.875rem;
    --text-lg: 1rem;

    --outline-sm: 1px;
    --outline-md: 2px;
    --outline-lg: 3px;

    /* AIXS is square-cornered; a hairline of rounding on form controls only */
    --rounding-sm: 0;
    --rounding-md: 2px;
    --rounding-lg: 2px;

    --letter-spacing: 0em;
    --disabled-opacity: 35%;
}

/* ---------- base ---------- */
html { scroll-padding-top: 5.5rem; }
body {
    font-family: var(--aixs-font-mono);
    font-size: 0.875rem;
    line-height: 1.65;
    color: var(--text);
    background-color: var(--aixs-paper);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
body.aixs-zh { line-height: 1.75; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6, .card-title, .pricing-card-title {
    font-family: var(--aixs-font-display);
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--text);
}
a { color: var(--primary); text-underline-offset: 3px; }
a:hover { color: var(--primary-accented); }
::selection { background: rgba(157, 123, 255, 0.3); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.text-muted { color: var(--text-lifted) !important; }
strong, b { font-weight: 700; }
code, kbd, pre, samp { font-family: var(--aixs-font-mono); }
hr { border-top-color: var(--border-muted); }
small, .small { font-size: 0.8125em; }
@media (min-width: 1200px) {
    .container { max-width: 1240px; }
}

/* ---------- cards and panels (Nexus) ---------- */
.card,
.panel,
.mc-promo-manage,
.mc-promo-login {
    border-radius: 0;
    border: 1px solid var(--border-muted);
    box-shadow: 0 1px 0 rgba(11, 11, 22, 0.03);
}
.card-header,
.card-footer { border-radius: 0 !important; }
.card-header {
    background-color: var(--bg);
    border-bottom-color: var(--border-muted);
}
.card-footer { background-color: var(--bg-muted); border-top-color: var(--border-muted); }
.card-title { font-size: 1.125rem; }
.card-header .card-title,
.card-header h3 { font-size: 0.9375rem; margin: 0; }

/* ---------- buttons (Bootstrap ships #007bff; every variant mapped to the palette) ---------- */
.btn {
    border-radius: 0;
    font-family: var(--aixs-font-display);
    font-weight: 600;
    font-size: 0.8125rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: background-color 160ms var(--aixs-ease), border-color 160ms var(--aixs-ease), color 160ms var(--aixs-ease), box-shadow 160ms var(--aixs-ease);
}
.aixs-zh .btn { letter-spacing: 0.04em; }
.btn-sm { font-size: 0.6875rem; }
.btn-lg { font-size: 0.9375rem; padding: 0.75rem 1.5rem; }
.btn-primary,
.btn-primary:disabled,
.btn-primary.disabled,
.btn-success,
.btn-success:disabled,
.btn-success.disabled {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:not(:disabled):not(.disabled):active,
.btn-primary:not(:disabled):not(.disabled).active,
.btn-success:hover,
.btn-success:focus,
.btn-success:not(:disabled):not(.disabled):active {
    background-color: var(--primary-lifted);
    border-color: var(--primary-lifted);
    color: #fff;
    box-shadow: 0 6px 18px rgba(91, 63, 217, 0.28);
}
.btn-default,
.btn-secondary,
.btn-light,
.btn-info,
.btn-warning,
.btn-outline-primary,
.btn-outline-secondary,
body #main-body .btn-outline-primary {
    background-color: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-default:hover,
.btn-secondary:hover,
.btn-light:hover,
.btn-info:hover,
.btn-warning:hover,
.btn-outline-primary:hover,
.btn-outline-secondary:hover,
body #main-body .btn-outline-primary:hover {
    background-color: var(--primary-50);
    border-color: var(--primary);
    color: var(--primary-accented);
}
.btn-danger { background-color: var(--error); border-color: var(--error); color: #fff; }
.btn-danger:hover { background-color: var(--error-lifted); border-color: var(--error-lifted); color: #fff; }
.btn-link { color: var(--primary); text-transform: none; letter-spacing: 0; font-family: var(--aixs-font-mono); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; box-shadow: none; }

/*
 * Nexus paints its main cart actions with var(--bg-inverted) (near-black here).
 * Same selectors as theme.min.css; custom.css loads later, so these win.
 */
body #order-standard_cart .products .product footer .btn-order-now,
body #order-standard_cart .text-right .btn-checkout,
body .sidebar .btn-success {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
body #order-standard_cart .products .product footer .btn-order-now:hover,
body #order-standard_cart .text-right .btn-checkout:hover,
body .sidebar .btn-success:hover {
    background-color: var(--primary-lifted);
    border-color: var(--primary-lifted);
    color: #fff;
}

/* ---------- forms ---------- */
label,
.form-control-label,
.control-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-accented);
    letter-spacing: 0.04em;
}
.form-control,
.custom-select,
select.form-control,
.input-group-text {
    min-height: 2.75rem;
    border-radius: var(--rounding-md);
    border-color: var(--border);
    font-family: var(--aixs-font-mono);
    font-size: 0.875rem;
    color: var(--text);
    background-color: var(--bg);
}
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { min-height: 8rem; line-height: 1.6; }
.form-control:hover,
.custom-select:hover { border-color: var(--border-lifted); }
.form-control:focus,
.custom-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(91, 63, 217, 0.16);
}
.form-control:disabled,
.form-control[readonly] { background-color: var(--bg-lifted); }
.input-group-text { background-color: var(--bg-lifted); color: var(--text-lifted); }
.input-group .btn { min-height: 2.75rem; }
.custom-control-input:checked ~ .custom-control-label::before {
    background-color: var(--primary);
    border-color: var(--primary);
}
input[type="checkbox"],
input[type="radio"] { accent-color: var(--primary); }
.field-help-text,
.form-text { color: var(--text-lifted); font-size: 0.75rem; }
.is-invalid,
.form-control.is-invalid { border-color: var(--error); }

/* iCheck (standard_cart replaces native inputs with blue sprites): drawn boxes instead; Nexus greys them with a filter */
body .icheckbox_square-blue,
body .iradio_square-blue {
    filter: none !important;
    width: 20px;
    height: 20px;
    background: var(--bg) !important;
    border: 1px solid var(--border-lifted);
    vertical-align: middle;
    transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}
body .iradio_square-blue { border-radius: 50%; }
body .icheckbox_square-blue.hover,
body .iradio_square-blue.hover { border-color: var(--primary); }
body .icheckbox_square-blue.checked {
    border-color: var(--primary);
    background: var(--primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E") center / 14px no-repeat !important;
}
body .iradio_square-blue.checked { border-color: var(--primary); box-shadow: inset 0 0 0 5px var(--primary); }
body .icheckbox_square-blue.disabled,
body .iradio_square-blue.disabled { opacity: 0.4; }

/* Bootstrap Switch (mailing-list opt-in) */
.bootstrap-switch { border-radius: 0; border-color: var(--border); }
.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success,
.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary { background: var(--primary); color: #fff; }
.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default { background: var(--bg-lifted); color: var(--text-accented); }
.bootstrap-switch .bootstrap-switch-handle-on,
.bootstrap-switch .bootstrap-switch-handle-off,
.bootstrap-switch .bootstrap-switch-label { font-family: var(--aixs-font-mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; border-radius: 0 !important; }

/* ---------- badges, alerts, tables, tabs, pagination ---------- */
.badge,
.label {
    border-radius: 0;
    font-family: var(--aixs-font-mono);
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.badge-primary,
.badge-info { background-color: var(--primary); }
.badge-success { background-color: var(--success); }
.badge-warning { background-color: var(--warning); color: #fff; }
.badge-danger { background-color: var(--error); }
.alert {
    border-radius: 0;
    border-width: 1px 1px 1px 3px;
    font-size: 0.8125rem;
}
.alert-info,
.alert-primary {
    background-color: var(--primary-50);
    border-color: var(--primary-200) var(--primary-200) var(--primary-200) var(--primary);
    color: var(--primary-900);
}
.alert-success {
    background-color: #ecfaf4;
    border-color: #bfe9d6 #bfe9d6 #bfe9d6 var(--success);
    color: #03432c;
}
.alert-warning {
    background-color: #fff6e8;
    border-color: #f6dcb2 #f6dcb2 #f6dcb2 var(--warning);
    color: #5e3000;
}
.alert-danger {
    background-color: #fdf0f0;
    border-color: #f3c7c7 #f3c7c7 #f3c7c7 var(--error);
    color: #761212;
}
.alert-link { color: inherit; text-decoration: underline; }
.table { color: var(--text); }
.table td,
.table th {
    border-top-color: var(--border-muted);
    font-variant-numeric: tabular-nums;
    vertical-align: middle;
}
.table thead th,
.table th {
    font-family: var(--aixs-font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-lifted);
    border-bottom: 1px solid var(--border);
}
.table-hover tbody tr:hover,
.table-list tbody tr:hover { background: linear-gradient(90deg, rgba(91, 63, 217, 0.06), rgba(91, 63, 217, 0.01) 70%); }
.nav-tabs { border-bottom-color: var(--border); }
.nav-tabs .nav-link {
    border-radius: 0;
    font-family: var(--aixs-font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-lifted);
}
.nav-tabs .nav-link.active { color: var(--text); border-color: var(--border) var(--border) var(--bg); box-shadow: inset 0 2px 0 var(--primary); }
.page-item.active .page-link { background-color: var(--primary); border-color: var(--primary); }
.page-link { color: var(--primary); border-radius: 0 !important; font-family: var(--aixs-font-mono); }
.progress { border-radius: 0; background-color: var(--bg-accented); }
.progress-bar { background-color: var(--primary); }

/* ---------- list groups, dropdowns, modals, popovers ---------- */
.list-group-item { border-color: var(--border-muted); }
.list-group-item:first-child,
.list-group-item:last-child { border-radius: 0; }
.list-group-item-action:hover,
.list-group-item-action:focus { background-color: var(--primary-50); color: var(--primary-accented); }
.list-group-item.active {
    background-color: var(--primary-50);
    border-color: var(--border-muted);
    color: var(--primary-accented);
    box-shadow: inset 3px 0 0 var(--primary);
}
.dropdown-menu {
    border-radius: 0;
    border: 1px solid var(--border);
    box-shadow: 0 18px 40px rgba(11, 11, 22, 0.16);
    padding: 0.375rem 0;
    font-size: 0.8125rem;
}
.dropdown-item { color: var(--text); padding: 0.5rem 1rem; }
.dropdown-item:hover,
.dropdown-item:focus { background-color: var(--primary-50); color: var(--primary-accented); }
.dropdown-divider { border-top-color: var(--border-muted); }
.modal-content { border-radius: 0; border: 1px solid var(--border); box-shadow: 0 30px 80px rgba(11, 11, 22, 0.3); }
.modal-header { border-bottom-color: var(--border-muted); }
.modal-footer { border-top-color: var(--border-muted); }
.modal-title { font-family: var(--aixs-font-display); font-weight: 700; }
.modal-backdrop.show { opacity: 0.6; background-color: var(--aixs-abyss); }
.popover { border-radius: 0; border-color: var(--border); font-family: var(--aixs-font-mono); }
.tooltip-inner { border-radius: 0; background: var(--aixs-abyss); font-family: var(--aixs-font-mono); font-size: 0.75rem; }

/* language and currency chooser */
.modal-localisation .modal-content { background: var(--aixs-abyss); border-color: var(--aixs-line-dark); }
.modal-localisation .h5,
.modal-localisation h5 { color: #fff; font-family: var(--aixs-font-display); }
.modal-localisation .item-selector .item {
    border-radius: 0;
    border: 1px solid var(--aixs-line-dark);
    color: #c9c8da;
    font-family: var(--aixs-font-mono);
}
.modal-localisation .item-selector .item:hover,
.modal-localisation .item-selector .item.active { border-color: var(--aixs-neon); background: rgba(157, 123, 255, 0.12); color: #fff; }
.modal-localisation .modal-footer { border-top-color: var(--aixs-line-dark); }
/* languages are not countries: no flags on the language switch (WHMCS shows the ROC flag for its zh_TW file) */
.iti-flag { display: none !important; }
.modal-localisation .iti-flag { display: none !important; }

/* full-page overlay (payment redirects) */
#fullpage-overlay { background: rgba(11, 11, 22, 0.86); }
#fullpage-overlay .msg { color: #fff; font-family: var(--aixs-font-mono); }

/* ---------- motion and high contrast ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
    .btn-primary { border: 1px solid ButtonText; }
}
