/**
 * File: /cts-internal/public/assets/styles.css
 * CTS Internal Frontend Style Addons
 *
 * Addon styles on top of conpacts styles.
 * Inspired by Material Design 3 (M3) and WordPress Admin design principles.
 * Uses cts-int-theme- prefix.
 * 
 * @see /conturalis/framework/assets/css/
 * 
 * @package CTS Internal
 */

/* --- Typography Overrides --- */
.cts-int-theme-type {
    font-weight: 700 !important;
    font-size: var(--cts-theme-font-size-large) !important;
    color: var(--cts-theme-color-neutral-1000) !important;
    line-height: 1.2 !important;
    margin-bottom: 2px;
}

.cts-int-theme-domain {
    font-size: var(--cts-theme-font-size-small) !important;
    color: var(--cts-theme-color-neutral-500) !important;
    font-weight: 400 !important;
}

/* ==========================================================================
   Cart Pill & Add to Cart
   ========================================================================== */
.cts-int-theme-cart-pill {
    display: inline-flex; align-items: center; gap: 6px; line-height: 1;
    border: 1px solid var(--cts-theme-color-neutral-300); 
    border-radius: var(--cts-theme-border-radius-circle); 
    padding: 6px 16px;
    text-decoration: none; 
    color: var(--cts-theme-color-neutral-600) !important; 
    background: var(--cts-theme-color-neutral-50);
    font-weight: 500; 
    font-size: var(--cts-theme-font-size-small); 
    transition: transform 0.2s, border-color 0.2s;
}
.cts-int-theme-cart-pill:hover { transform: scale(1.02); color: var(--cts-theme-color-primary-500) !important; border-color: var(--cts-theme-color-primary-500); }
.cts-int-theme-cart-icon { display: inline-flex; align-items: center; margin-left: 2px; }

.cts-int-theme-add-wrap { display: flex; flex-direction: column; align-items: center; gap: var(--cts-theme-spacing-small); width: 100%; }
.cts-int-theme-add-wrap [hidden] { display: none !important; }
.cts-int-theme-add-wrap .cts-theme-btn-standard.is-primary { min-width: 120px; transition: transform 0.15s ease; }
.cts-int-theme-add-wrap .cts-theme-btn-standard.is-primary:hover:not([disabled]) { transform: scale(1.02); }
.cts-int-theme-add-notice { font-size: var(--cts-theme-font-size-small); color: var(--cts-theme-color-danger-600); text-align: center; margin-top: -4px; }
.cts-int-theme-add__spinner .spin, .cts-int-theme-icon-spin .spin { animation: cts-spin 1s linear infinite; }
@keyframes cts-spin { to { transform: rotate(360deg); } }

/* Variations Dropdown */
.cts-int-theme-variations { width: 100%; max-width: 460px; }
.cts-int-theme-var-label { display: block; margin-bottom: 6px; font-weight: 500; font-size: var(--cts-theme-font-size-small); color: var(--cts-theme-color-neutral-900); }
.cts-int-theme-var-hint { margin-top: 6px; font-size: var(--cts-theme-font-size-small); color: var(--cts-theme-color-danger-600); }

/* ==========================================================================
   Dashboard Universal Grid Systems (.cts-int-theme-grid-*)
   ========================================================================== */

/* Standard Auto-Fit Card Grid */
.cts-int-theme-grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--cts-theme-spacing-large);
    margin-bottom: var(--cts-theme-spacing-x-large);
}

/* Explicit Column Modifiers (M3 Structural Caps) */
.cts-int-theme-grid-cards.is-2-cols { grid-template-columns: repeat(2, 1fr); }
.cts-int-theme-grid-cards.is-3-cols { grid-template-columns: repeat(3, 1fr); }
.cts-int-theme-grid-cards.is-4-cols { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) { 
    .cts-int-theme-grid-cards.is-3-cols,
    .cts-int-theme-grid-cards.is-4-cols { grid-template-columns: repeat(2, 1fr); } 
}
@media (max-width: 639px) { 
    .cts-int-theme-grid-cards,
    .cts-int-theme-grid-cards.is-2-cols,
    .cts-int-theme-grid-cards.is-3-cols,
    .cts-int-theme-grid-cards.is-4-cols { grid-template-columns: 1fr; gap: var(--cts-theme-spacing-medium); } 
}

/* Small Compact Grid (e.g. Products/Engines list minmax 240px) */
.cts-int-theme-grid-compact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--cts-theme-spacing-large);
    margin-bottom: var(--cts-theme-spacing-x-large);
}
@media (max-width: 639px) { .cts-int-theme-grid-compact { grid-template-columns: 1fr; gap: var(--cts-theme-spacing-medium); } }

/* Two-Column Strict Layout (e.g. Usage / Forms) */
.cts-int-theme-grid-2-col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--cts-theme-spacing-large);
    margin-bottom: var(--cts-theme-spacing-x-large);
}
@media (max-width: 800px) { .cts-int-theme-grid-2-col { grid-template-columns: 1fr !important; } }

/* Add-Website Form Grid */
.cts-int-theme-add-grid {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: var(--cts-theme-spacing-medium);
    align-items: flex-end;
}
@media (max-width: 800px) { .cts-int-theme-add-grid { grid-template-columns: 1fr; } }

/* Basic Data Rows */
.cts-int-theme-row { display: grid; grid-template-columns: 80px 1fr; gap: 10px; padding: 6px 0; align-items: center; }
.cts-int-theme-row-label { color: var(--cts-theme-color-neutral-500); font-size: var(--cts-theme-font-size-small); font-weight: 500; }
.cts-int-theme-row-val { display: flex; align-items: center; gap: 10px; }

/* Dashboard Section Headers */
.cts-int-theme-section-header { 
    display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--cts-theme-spacing-medium); 
}

/* Status Chip - Pending/Setup (Orange) */
.cts-int-theme-conn-chip {
    font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px; 
    display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; text-transform: uppercase; letter-spacing: 0.5px;
}
.cts-int-theme-conn-chip.connected { background: var(--cts-theme-color-success-50); color: var(--cts-theme-color-success-800); border-color: var(--cts-theme-color-success-200); }
.cts-int-theme-conn-chip.not-connected { background: var(--cts-theme-color-danger-50); color: var(--cts-theme-color-danger-800); border-color: var(--cts-theme-color-danger-200); }
.cts-int-theme-conn-chip.setup { background: var(--cts-theme-color-warning-50); color: var(--cts-theme-color-warning-800); border-color: var(--cts-theme-color-warning-200); }

/* ==========================================================================
   Agent Licenses & Engines Stats
   ========================================================================== */
.cts-int-theme-status-pill { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 99px; text-transform: uppercase; }
.cts-int-theme-status-pill.available { background: var(--cts-theme-color-success-50); color: var(--cts-theme-color-success-800); border: 1px solid var(--cts-theme-color-success-200); }
.cts-int-theme-status-pill.full { background: var(--cts-theme-color-danger-50); color: var(--cts-theme-color-danger-800); border: 1px solid var(--cts-theme-color-danger-200); }
.cts-int-theme-status-pill.inactive { background: var(--cts-theme-color-neutral-100); color: var(--cts-theme-color-neutral-500); border: 1px solid var(--cts-theme-color-neutral-200); }

.cts-int-theme-stat-row { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.cts-int-theme-big-number, .cts-int-theme-stat-big { font-size: 32px; font-weight: 700; color: var(--cts-theme-color-neutral-900); line-height: 1; }
.cts-int-theme-total-number { font-size: 20px; font-weight: 500; color: var(--cts-theme-color-neutral-500); }
.cts-int-theme-divider-slash { font-size: 24px; color: var(--cts-theme-color-neutral-300); font-weight: 300; }
.cts-int-theme-small-text { font-size: 12px; font-weight: 400; color: var(--cts-theme-color-neutral-400); display: block; margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }

.cts-int-theme-progress-track { height: 6px; background: var(--cts-theme-color-neutral-100); border-radius: 3px; overflow: hidden; margin-bottom: 12px; }
.cts-int-theme-progress-fill { height: 100%; background: var(--cts-theme-color-primary-500); border-radius: 3px; }

.cts-int-theme-breakdown { font-size: var(--cts-theme-font-size-small); color: var(--cts-theme-color-neutral-500); background: var(--cts-theme-color-neutral-50); padding: 8px 12px; border-radius: 8px; display: flex; gap: 8px; align-items: center; border: 1px solid var(--cts-theme-color-neutral-100); }
.cts-int-theme-bd-plus { color: var(--cts-theme-color-neutral-300); }
.cts-int-theme-breakdown strong { color: var(--cts-theme-color-neutral-900); }

.cts-int-theme-lic-box { display: flex; gap: 16px; align-items: center; border: 1px dashed var(--cts-theme-color-neutral-300); border-radius: var(--cts-theme-border-radius-medium); background: var(--cts-theme-color-neutral-50); padding: 10px 12px; margin: 14px 0; }
.cts-int-theme-lic-item { font-size: var(--cts-theme-font-size-small); color: var(--cts-theme-color-neutral-900); }

/* Overview Specifics */
.cts-int-theme-card-header { padding: 20px 24px 0 24px; display: flex; justify-content: space-between; align-items: center; }
.cts-int-theme-card-title { font-size: 14px; font-weight: 600; color: var(--cts-theme-color-neutral-500); text-transform: uppercase; letter-spacing: 0.5px; }
.cts-int-theme-header-link { font-size: 13px; color: var(--cts-theme-color-primary-500); text-decoration: none; font-weight: 500; }

.cts-int-theme-card-main { padding: 12px 24px; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.cts-int-theme-big-val { font-size: 28px; font-weight: 700; color: var(--cts-theme-color-neutral-900); margin-bottom: 4px; }
.cts-int-theme-sub-label { font-size: 13px; color: var(--cts-theme-color-neutral-500); }
.text-truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cts-int-theme-card-footer-info {
    background: var(--cts-theme-color-neutral-50); border-top: 1px solid var(--cts-theme-color-neutral-100); padding: 12px 24px;
    font-size: 13px; color: var(--cts-theme-color-neutral-500);
    display: flex; align-items: center; gap: 8px;
}

/* Info Grid */
.cts-int-theme-info-hd { padding: 16px 20px; border-bottom: 1px solid var(--cts-theme-color-neutral-100); font-weight: 600; font-size: 15px; color: var(--cts-theme-color-neutral-1000); background: var(--cts-theme-color-neutral-50); }
.cts-int-theme-info-body { padding: 20px; flex: 1; }
.cts-int-theme-agent-meter { margin-bottom: 12px; }
.cts-int-theme-meter-label { font-size: 13px; color: var(--cts-theme-color-neutral-500); margin-bottom: 4px; }
.cts-int-theme-meter-val { font-size: 18px; font-weight: 600; color: var(--cts-theme-color-neutral-900); }

/* Quick Links */
.cts-int-theme-quick-links { display: flex; flex-direction: column; }
.cts-int-theme-ql-item {
    display: flex; align-items: center; gap: 12px; padding: 14px 20px;
    border-bottom: 1px dashed var(--cts-theme-color-neutral-200); color: var(--cts-theme-color-neutral-700); text-decoration: none; font-size: 14px; font-weight: 500;
    transition: background 0.1s;
}
.cts-int-theme-ql-item:last-child { border-bottom: none; }
.cts-int-theme-ql-item:hover { background: var(--cts-theme-color-neutral-50); color: var(--cts-theme-color-primary-500); }
.cts-int-theme-ql-icon {
    width: 28px; height: 28px; border-radius: 6px; background: var(--cts-theme-color-neutral-100); color: var(--cts-theme-color-neutral-500);
    display: flex; align-items: center; justify-content: center;
}
.cts-int-theme-ql-item:hover .cts-int-theme-ql-icon { background: var(--cts-theme-color-primary-50); color: var(--cts-theme-color-primary-500); }

/* ==========================================================================
   My Engines & Usage Specifics
   ========================================================================== */
.cts-int-theme-usage-sync { font-size: 12px; color: var(--cts-theme-color-neutral-500); }
.cts-int-theme-usage-sync .info { color: var(--cts-theme-color-neutral-600); font-style: italic; }
.cts-int-theme-usage-wrapper { display: flex; flex-direction: column; gap: 16px; }
.cts-int-theme-usage-top-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cts-int-theme-usage-bottom-row { width: 100%; }
.cts-int-theme-usage-title { font-size: 14px; font-weight: 600; color: var(--cts-theme-color-neutral-900); margin-bottom: 2px; display: flex; justify-content: space-between; align-items: center; }

/* Usage Progress Bar */
.cts-int-theme-progress-track.usage {
    height: 8px; background: var(--cts-theme-color-neutral-100); border-radius: 4px; overflow: hidden; margin-top: 16px;
}
.cts-int-theme-progress-fill.usage {
    height: 100%; background: var(--cts-theme-color-primary-500); border-radius: 4px; transition: width 0.3s ease;
}

/* Toggle Switch */
.cts-int-theme-toggle { position: relative; display: inline-block; width: 36px; height: 20px; margin-bottom: 0; }
.cts-int-theme-toggle input { opacity: 0; width: 0; height: 0; }
.cts-int-theme-toggle .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--cts-theme-color-neutral-300); transition: .2s; border-radius: 34px; }
.cts-int-theme-toggle .slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 2px; bottom: 2px; background-color: white; transition: .2s; border-radius: 50%; }
.cts-int-theme-toggle input:checked + .slider { background-color: var(--cts-theme-color-primary-500); }
.cts-int-theme-toggle input:focus + .slider { box-shadow: 0 0 0 2px var(--cts-theme-color-primary-200); }
.cts-int-theme-toggle input:checked + .slider:before { transform: translateX(16px); }
.cts-int-theme-toggle input:disabled + .slider { background-color: var(--cts-theme-color-neutral-200); cursor: not-allowed; }

/* ---------------------------------------------------------
   Account Page Adjustments
   --------------------------------------------------------- */
.cts-account-grid { display: grid; grid-template-columns: 240px 1fr; gap: 32px; align-items: start; }

.cts-account-nav--desktop { display: block; }
.cts-account-nav--mobile { display: none; }

@media(max-width: 768px) { 
    /* minmax(0, 1fr) prevents the grid column from blowing out past the screen width */
    .cts-account-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; } 
    .cts-account-nav--desktop { display: none; }
    .cts-account-nav--mobile { display: block; }
}
.cts-addresses-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media(max-width: 600px) { .cts-addresses-grid { grid-template-columns: 1fr; } }

/* ==========================================================================
   NATIVE WOOCOMMERCE M3 CSS ADAPTER
   ========================================================================== */

/* 1. Notices (High Specificity M3 Overrides for Classic & Block Notices) */
body .woocommerce-message, 
body .woocommerce-error, 
body .woocommerce-info,
body .wc-block-components-notice-banner { 
    display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 18px; margin: 0 0 16px 0; 
    background: var(--cts-theme-color-neutral-0) !important; border: 1px solid var(--cts-theme-color-neutral-200) !important; 
    border-radius: 8px !important; box-shadow: 0 1px 3px rgba(0,0,0,0.05) !important; color: var(--cts-theme-color-neutral-900) !important; 
    font-size: 14.5px; line-height: 1.5; font-family: var(--cts-theme-font-sans); position: relative;
    animation: ctsNoticeFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; clear: both; width: 100%; box-sizing: border-box;
}
body .woocommerce-message::before, body .woocommerce-error::before, body .woocommerce-info::before,
body .wc-block-components-notice-banner::before {
    content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 6px; border-radius: 0 4px 4px 0; display: block !important; color: transparent !important;
}
body .woocommerce-message::after, body .woocommerce-error::after, body .woocommerce-info::after,
body .wc-block-components-notice-banner::after {
    font-family: 'Material Symbols Outlined'; font-weight: normal; font-style: normal; font-size: 20px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 20px; height: 20px;
    order: -1; margin: 0;
}

/* Hide WooCommerce native SVGs inside Block Notices */
body .wc-block-components-notice-banner > svg { display: none !important; }
body .wc-block-components-notice-banner__content { margin: 0 !important; width: 100%; }

/* Success Mapping */
body .woocommerce-message, body .wc-block-components-notice-banner.is-success { background-color: var(--cts-theme-color-success-50) !important; border-color: var(--cts-theme-color-success-200) !important; }
body .woocommerce-message::before, body .wc-block-components-notice-banner.is-success::before { background-color: var(--cts-theme-color-success-600) !important; }
body .woocommerce-message::after, body .wc-block-components-notice-banner.is-success::after { content: 'check_circle'; color: var(--cts-theme-color-success-600) !important; }

/* Error Mapping */
body .woocommerce-error, body .wc-block-components-notice-banner.is-error { background-color: var(--cts-theme-color-danger-50) !important; border-color: var(--cts-theme-color-danger-200) !important; }
body .woocommerce-error::before, body .wc-block-components-notice-banner.is-error::before { background-color: var(--cts-theme-color-danger-600) !important; }
body .woocommerce-error::after, body .wc-block-components-notice-banner.is-error::after { content: 'error'; color: var(--cts-theme-color-danger-600) !important; }

/* Info Mapping */
body .woocommerce-info, body .wc-block-components-notice-banner.is-info { background-color: var(--cts-theme-color-primary-50) !important; border-color: var(--cts-theme-color-primary-200) !important; }
body .woocommerce-info::before, body .wc-block-components-notice-banner.is-info::before { background-color: var(--cts-theme-color-primary-600) !important; }
body .woocommerce-info::after, body .wc-block-components-notice-banner.is-info::after { content: 'info'; color: var(--cts-theme-color-primary-600) !important; }

/* Handle Lists and links inside notices gracefully */
body .woocommerce-error li { margin: 0; list-style: none; }
body .woocommerce-error ul { margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
body .woocommerce-message a:not(.button), body .woocommerce-error a:not(.button), body .woocommerce-info a:not(.button),
body .wc-block-components-notice-banner a:not(.button) { 
    font-weight: 600; text-decoration: underline; text-underline-offset: 2px; color: inherit; 
}

/* Ensure interactive buttons inside native notices ("Undo") align properly and look clean */
body .woocommerce-message .button, body .woocommerce-error .button, body .woocommerce-info .button,
body .wc-block-components-notice-banner .button, body .wc-block-components-notice-banner .components-button {
    margin-left: auto !important;
    order: 98; /* Just before close button */
    background: transparent !important; color: inherit !important; border: 1px solid currentColor !important; 
    box-shadow: none !important; min-height: 28px !important; padding: 0 12px !important; font-size: 13px !important;
}
body .woocommerce-message .button:hover, body .woocommerce-error .button:hover, body .woocommerce-info .button:hover,
body .wc-block-components-notice-banner .button:hover, body .wc-block-components-notice-banner .components-button:hover {
    background: rgba(0,0,0,0.05) !important;
}

/* Native notice wrapper for the injected close button */
.cts-native-notice-close {
    background-color: transparent; border: 0; cursor: pointer; color: var(--cts-theme-color-neutral-500); width: 28px; height: 28px; 
    border-radius: 8px; display: flex; align-items: center; justify-content: center; transition: background 0.2s, color 0.2s; 
    padding: 0; margin-left: auto; margin-right: -4px; order: 99; flex-shrink: 0; outline: none;
}
.cts-native-notice-close:hover { background-color: var(--cts-theme-color-neutral-100); color: var(--cts-theme-color-neutral-900); }
.cts-native-notice-close:focus-visible { box-shadow: 0 0 0 3px var(--cts-theme-color-primary-200); }

/* 2. Inputs */
.woocommerce form .form-row input.input-text, 
.woocommerce form input[type="text"],
.woocommerce form input[type="email"],
.woocommerce form input[type="password"],
.woocommerce form input[type="tel"],
.woocommerce form .form-row textarea {
    display: block; width: 100%; height: var(--cts-theme-ui-height); padding: 0 var(--cts-theme-ui-padding-x);
    font-family: var(--cts-theme-font-sans); font-size: var(--cts-theme-ui-font-size); font-weight: 400;
    color: var(--cts-theme-color-neutral-900); background-color: var(--cts-theme-color-neutral-0);
    border: 1px solid var(--cts-theme-color-neutral-300); border-radius: var(--cts-theme-border-radius-medium);
    box-shadow: none; outline: none; transition: border-color 0.2s, box-shadow 0.2s; box-sizing: border-box;
}
.woocommerce form .form-row textarea { height: auto; padding-top: 12px; padding-bottom: 12px; }
.woocommerce form input[type="text"]:hover, .woocommerce form input[type="email"]:hover, .woocommerce form input[type="password"]:hover, .woocommerce form input[type="tel"]:hover, .woocommerce form .form-row textarea:hover { border-color: var(--cts-theme-color-neutral-400); }
.woocommerce form input[type="text"]:focus, .woocommerce form input[type="email"]:focus, .woocommerce form input[type="password"]:focus, .woocommerce form input[type="tel"]:focus, .woocommerce form .form-row textarea:focus {
    border-color: var(--cts-theme-color-primary-500); box-shadow: 0 0 0 3px var(--cts-theme-color-primary-200); z-index: 1;
}

/* 3. Buttons & Anchors (.wp-element-button fixes the core WP override) */
.woocommerce button.button, 
.woocommerce a.button, 
.woocommerce input.button,
.woocommerce .woocommerce-Button,
.woocommerce button[type="submit"]:not(.cts-native-notice-close),
.woocommerce .wp-element-button {
    display: inline-flex; align-items: center; justify-content: center; text-decoration: none; vertical-align: middle;
    cursor: pointer; user-select: none; box-sizing: border-box; white-space: nowrap;
    transition: 0.2s background-color, 0.2s border-color, 0.2s color, 0.2s box-shadow, 0.2s opacity;
    font-family: var(--cts-theme-font-sans) !important; font-weight: 600 !important; line-height: 1; gap: 6px; 
    min-height: var(--cts-theme-btn-min-h) !important; padding: 0 var(--cts-theme-btn-pad-x) !important; font-size: var(--cts-theme-btn-font) !important;
    border-radius: var(--cts-theme-border-radius-circle) !important; margin: 0; text-transform: none;
    background-color: var(--cts-theme-color-primary-500) !important; border: 1px solid var(--cts-theme-color-primary-500) !important; color: #fff !important;
}
.woocommerce button.button:hover, 
.woocommerce a.button:hover, 
.woocommerce input.button:hover,
.woocommerce .woocommerce-Button:hover,
.woocommerce button[type="submit"]:not(.cts-native-notice-close):hover,
.woocommerce .wp-element-button:hover { 
    background-color: var(--cts-theme-color-primary-600) !important; border-color: var(--cts-theme-color-primary-600) !important; color: #fff !important; 
}
.woocommerce button.button:disabled, 
.woocommerce button.button.disabled,
.woocommerce a.button.disabled {
    background-color: var(--cts-theme-color-neutral-100) !important; border-color: var(--cts-theme-color-neutral-200) !important; 
    color: var(--cts-theme-color-neutral-500) !important; cursor: not-allowed; opacity: 1; box-shadow: none !important;
}
.woocommerce a.button.checkout-button { width: 100%; } /* Force checkout button to fill container */

/* 4. Fieldsets (Account Details) */
.woocommerce fieldset {
    border: 1px solid var(--cts-theme-color-neutral-200); padding: 24px; border-radius: var(--cts-theme-border-radius-medium); 
    background: var(--cts-theme-color-neutral-0); margin-top: 32px; margin-bottom: 0; box-shadow: none;
}
.woocommerce legend {
    all: unset; display: block; width: 100%; margin-bottom: 12px; box-sizing: border-box;
    font-family: var(--cts-theme-font-sans); font-weight: 600; font-size: 16px; padding: 0; color: var(--cts-theme-color-neutral-900); 
}
/* Wrap the Edit Account form to match the fieldset aesthetic */
.woocommerce form.edit-account {
    border: 1px solid var(--cts-theme-color-neutral-200); padding: 24px; border-radius: var(--cts-theme-border-radius-medium); 
    background: var(--cts-theme-color-neutral-0);
}
.woocommerce form.edit-account fieldset {
    margin-top: 32px; border: 1px solid var(--cts-theme-color-neutral-200); padding: 24px; border-radius: var(--cts-theme-border-radius-medium); 
    background: var(--cts-theme-color-neutral-50);
}
/* Address form layout adjustments */
.woocommerce form.edit-address {
    padding-top: 8px;
}
.woocommerce h3, 
.woocommerce h2.woocommerce-column__title, 
.woocommerce h2.woocommerce-order-details__title {
    font-size: var(--cts-theme-title-3-size);
    font-weight: var(--cts-theme-title-weight-semi);
    color: var(--cts-theme-color-neutral-900);
    margin-top: 0; margin-bottom: var(--cts-theme-spacing-medium);
}

/* Reduce WC description paragraph font sizes to M3 small standards */
.cts-account-content form p:not(.form-row) {
    font-size: var(--cts-theme-font-size-small);
    color: var(--cts-theme-color-neutral-600);
    margin-bottom: var(--cts-theme-spacing-medium);
}

/* WC Select2 & Form Validation Mappings */
.select2-container .select2-selection--single {
    display: block; width: 100%; height: var(--cts-theme-btn-min-h); padding: 0 var(--cts-theme-spacing-medium); 
    font-family: var(--cts-theme-font-sans); font-size: var(--cts-theme-font-size-medium); 
    color: var(--cts-theme-color-neutral-900); background-color: var(--cts-theme-color-neutral-0); 
    border: 1px solid var(--cts-theme-color-neutral-300); border-radius: var(--cts-theme-border-radius-medium); 
    transition: border-color 0.2s, box-shadow 0.2s; box-sizing: border-box; box-shadow: none; display: flex; align-items: center;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: var(--cts-theme-btn-min-h);
    right: 12px;
}
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: var(--cts-theme-color-primary-500); outline: none; box-shadow: 0 0 0 3px var(--cts-theme-color-primary-200);
}
.woocommerce-invalid input.cts-theme-input,
.woocommerce-invalid select.cts-theme-input,
.woocommerce-invalid .select2-container .select2-selection--single {
    border-color: var(--cts-theme-color-danger-600) !important;
    background-color: var(--cts-theme-color-danger-50) !important;
}
.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: var(--cts-theme-color-primary-500); outline: none; box-shadow: 0 0 0 3px var(--cts-theme-color-primary-200) !important;
}
.woocommerce-invalid input.cts-theme-input:focus,
.woocommerce-invalid select.cts-theme-input:focus,
.woocommerce-invalid .select2-container--focus .select2-selection--single {
    box-shadow: 0 0 0 3px var(--cts-theme-color-danger-200) !important;
}

/* Fix Checkout Select2 Focus specificities */
body .woocommerce form .form-row .select2-container--default.select2-container--open .select2-selection--single,
body .woocommerce form .form-row .select2-container--default.select2-container--focus .select2-selection--single {
    border-color: var(--cts-theme-color-primary-500) !important; 
    box-shadow: 0 0 0 3px var(--cts-theme-color-primary-200) !important;
}

/* Hide Edit Account display name hint */
.woocommerce-EditAccountForm .form-row em {
    display: none !important;
}

/* 5. NATIVE TABLES (Order Details) */
.woocommerce table.shop_table,
.woocommerce table.woocommerce-table--order-details {
    border-collapse: collapse; width: 100%; background: transparent; margin-bottom: var(--cts-theme-spacing-medium); font-family: var(--cts-theme-font-sans);
}
.woocommerce table.shop_table thead th,
.woocommerce table.woocommerce-table--order-details thead th {
    color: var(--cts-theme-color-neutral-900); font-weight: 700; font-size: var(--cts-theme-font-size-small);
    padding: var(--cts-theme-spacing-medium) var(--cts-theme-spacing-large);
    border-bottom: 1px solid var(--cts-theme-color-neutral-200); text-align: left; 
}
.woocommerce table.shop_table tbody td,
.woocommerce table.woocommerce-table--order-details tbody td {
    padding: var(--cts-theme-spacing-medium) var(--cts-theme-spacing-large);
    border-top: 1px solid var(--cts-theme-color-neutral-100); color: var(--cts-theme-color-neutral-700); 
    vertical-align: middle; font-size: var(--cts-theme-font-size-small); 
}
.woocommerce table.shop_table tbody tr:first-child td,
.woocommerce table.woocommerce-table--order-details tbody tr:first-child td {
    border-top: none;
}

/* WPO WCPDF Native Button Alignment */
.woocommerce a.button.wpo_wcpdf {
    margin-bottom: var(--cts-theme-spacing-large);
}

/* View Order: Wrap tables and addresses in M3 Cards */
.woocommerce-order-details {
    background-color: var(--cts-theme-color-neutral-0);
    border: 1px solid var(--cts-theme-color-neutral-200);
    border-radius: var(--cts-theme-border-radius-medium);
    padding: var(--cts-theme-spacing-large);
    margin-bottom: var(--cts-theme-spacing-large);
}
/* Make the wrapper the card */
.woocommerce-customer-details {
    background-color: var(--cts-theme-color-neutral-0);
    border: 1px solid var(--cts-theme-color-neutral-200);
    border-radius: var(--cts-theme-border-radius-medium);
    margin-bottom: var(--cts-theme-spacing-large);
    overflow: hidden;
}

/* Make the heading act as the card header */
.woocommerce-customer-details h2.woocommerce-column__title {
    margin: 0;
    padding: 20px 24px; /* Matches var(--cts-theme-spacing-large) roughly, standard card header */
    border-bottom: 1px solid var(--cts-theme-color-neutral-100);
    font-size: var(--cts-theme-title-3-size);
    font-weight: var(--cts-theme-title-weight-semi);
    color: var(--cts-theme-color-neutral-900);
    background-color: var(--cts-theme-color-neutral-0);
}

/* Make the address act as the card body */
.woocommerce-customer-details address {
    padding: 24px; /* Matches var(--cts-theme-spacing-large) */
    font-style: normal;
    background: transparent;
    border: none;
    margin: 0;
}
.woocommerce table.shop_table tfoot td,
.woocommerce table.shop_table tfoot th,
.woocommerce table.woocommerce-table--order-details tfoot td,
.woocommerce table.woocommerce-table--order-details tfoot th {
    padding: var(--cts-theme-spacing-medium) var(--cts-theme-spacing-large);
    background-color: var(--cts-theme-color-neutral-50); color: var(--cts-theme-color-neutral-900); 
    font-weight: 600; font-size: var(--cts-theme-font-size-small); vertical-align: middle;
    border-top: 2px solid var(--cts-theme-color-neutral-200); border-bottom: none;
}

   
.cts-int-theme-site-card > summary {
    pointer-events: auto; 
    cursor: pointer; 
    padding: 14px 20px; 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    list-style: none;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    transition: background 0.2s;
}
.cts-int-theme-site-card > summary:hover { background: var(--cts-theme-color-neutral-50); }
.cts-int-theme-site-card[open] > summary { border-bottom: 1px solid var(--cts-theme-color-neutral-100); }
.cts-int-theme-site-card > summary::-webkit-details-marker { 
    display: none; 
}
.cts-int-theme-site-card[open] > summary .cts-accordion-arrow { transform: rotate(180deg); }

.cts-int-theme-hd-right {
    margin-left: auto;
}

/* Explicit Focus States for Local Internal Buttons to block Elementor Bleed */
.cts-theme-card .cts-theme-btn-standard.is-ghost:is(:focus-visible, :active) {
    box-shadow: 0 0 0 3px var(--cts-theme-color-primary-200) !important;
    outline: none !important;
    background-color: var(--cts-theme-color-neutral-100);
    color: var(--cts-theme-color-neutral-900);
}

/* ---------------------------------------------------------
   Agent Sites List Cleanup
   --------------------------------------------------------- */
.cts-int-theme-toggle-sites summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--cts-theme-color-neutral-700);
}
.cts-int-theme-toggle-sites summary::-webkit-details-marker {
    display: none;
}
.cts-int-theme-sites-list ul {
    list-style: none;
    padding: 0;
    margin: 12px 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cts-int-theme-sites-list ul li {
    font-size: 13px;
    color: var(--cts-theme-color-neutral-700);
    display: flex;
    align-items: center;
    padding-left: 10px;
    border-left: 2px solid var(--cts-theme-color-primary-200);
}

/* ==========================================================================
   NATIVE WOOCOMMERCE BLOCKS (MD3 Architecture Mapping)
   ========================================================================== */

/* Map Conturalis Global Tokens to WooCommerce Block Presets */
.wp-block-woocommerce-cart,
.wp-block-woocommerce-checkout {
    /* Colors */
    --wp--preset--color--primary: var(--cts-theme-color-primary-600);
    --wp--preset--color--secondary: var(--cts-theme-color-secondary-600);
    --wp--preset--color--text: var(--cts-theme-color-neutral-900);
    --wp--preset--color--background: var(--cts-theme-color-neutral-0);
    --wp--preset--color--border: var(--cts-theme-color-neutral-200);
    
    /* Semantic Colors */
    --wp--preset--color--danger: var(--cts-theme-color-danger-600);
    --wp--preset--color--success: var(--cts-theme-color-success-600);
    --wp--preset--color--warning: var(--cts-theme-color-warning-600);
    --wp--preset--color--info: var(--cts-theme-color-primary-600);
    
    /* Element Specifics */
    --wp--custom--button--primary--background: var(--cts-theme-color-primary-600);
    --wp--custom--button--primary--text: #ffffff;
    --wp--custom--border--radius: var(--cts-theme-border-radius-medium);
    
    /* Typography */
    font-family: var(--cts-theme-font-sans) !important;
}

/* Force specific button matches to CTS Standards */
.wc-block-components-button:not(.is-link) {
    border-radius: 99px !important; /* Pill shape */
    font-family: var(--cts-theme-font-sans) !important;
    font-weight: 600 !important;
    text-transform: none !important;
}

.wc-block-components-button.is-primary {
    background-color: var(--cts-theme-color-primary-600) !important;
    color: #fff !important;
    border: 1px solid var(--cts-theme-color-primary-600) !important;
}

.wc-block-components-button.is-primary:hover {
    background-color: var(--cts-theme-color-primary-700) !important;
    border-color: var(--cts-theme-color-primary-700) !important;
}

/* Ensure inputs match our border radiuses */
.wc-block-components-text-input input[type=text], 
.wc-block-components-text-input input[type=email], 
.wc-block-components-text-input input[type=tel] {
    border-radius: var(--cts-theme-border-radius-medium) !important;
}
.wc-block-components-text-input input:focus {
    border-color: var(--cts-theme-color-primary-500) !important;
    box-shadow: 0 0 0 3px var(--cts-theme-color-primary-200) !important;
}

/* ---------------------------------------------------------
   Navigation Overrides
   --------------------------------------------------------- */
@media (max-width: 768px) {
    .cts-theme-tabs-wrap {
        border-bottom: none !important;
    }
}
