/**
 * WooKit — toast notifications.
 * Styled with the --wookit-* design tokens so they match the rest of the plugin.
 * Replaces WooCommerce's full-width success/info banners (see includes/notices.php).
 */

.wookit-toasts {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min( 360px, calc( 100vw - 32px ) );
    pointer-events: none;
}
/* Clear the WP admin bar when logged in. */
.admin-bar .wookit-toasts { top: 52px; }

.wookit-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 14px;
    background: var( --wookit-surface, #fff );
    color: var( --wookit-text, #1f2937 );
    border: 1px solid var( --wookit-border, #e2e4e7 );
    border-left: 3px solid var( --wookit-accent, #2271b1 );
    border-radius: var( --wookit-radius-md, 8px );
    box-shadow: 0 8px 28px rgba( 15, 23, 42, 0.14 );
    font-family: var( --wookit-font, inherit );
    font-size: 0.875rem;
    line-height: 1.45;
    transform: translateX( 120% );
    opacity: 0;
    transition: transform 300ms cubic-bezier( 0.2, 0.8, 0.2, 1 ), opacity 260ms ease;
    box-sizing: border-box;
}
.wookit-toast.is-visible { transform: translateX( 0 ); opacity: 1; }
.wookit-toast.is-leaving { transform: translateX( 120% ); opacity: 0; }

.wookit-toast--success { border-left-color: var( --wookit-success, #16a34a ); }
.wookit-toast--error   { border-left-color: var( --wookit-danger, #dc2626 ); }
.wookit-toast--info    { border-left-color: var( --wookit-accent, #2271b1 ); }

.wookit-toast__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-top: 1px;
}
.wookit-toast--success .wookit-toast__icon { color: var( --wookit-success, #16a34a ); }
.wookit-toast--error   .wookit-toast__icon { color: var( --wookit-danger, #dc2626 ); }
.wookit-toast--info    .wookit-toast__icon { color: var( --wookit-accent, #2271b1 ); }

.wookit-toast__body {
    flex: 1 1 auto;
    min-width: 0;
    color: var( --wookit-text, inherit );
    word-wrap: break-word;
}
/* WC injects a "View cart" button + raw text inside the message — render the
   link as a tidy inline action, drop the bulky default button chrome. */
.wookit-toast__body a,
.wookit-toast__body .button {
    display: inline-block;
    margin: 4px 8px 0 0 !important;
    padding: 0 !important;
    background: none !important;
    border: 0 !important;
    color: var( --wookit-accent, #2271b1 ) !important;
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    text-decoration: none !important;
    box-shadow: none !important;
    min-height: 0 !important;
    line-height: 1.3 !important;
}
.wookit-toast__body a:hover,
.wookit-toast__body .button:hover { text-decoration: underline !important; }
.wookit-toast__body p { margin: 0 !important; }

.wookit-toast__close {
    flex-shrink: 0;
    appearance: none;
    -webkit-appearance: none;
    background: none !important;
    border: 0 !important;
    padding: 3px !important;
    margin: -2px -3px 0 0 !important;
    color: var( --wookit-muted, #9ca3af ) !important;
    cursor: pointer !important;
    border-radius: var( --wookit-radius-sm, 6px ) !important;
    display: flex;
    align-items: center;
    line-height: 1 !important;
    transition: color 0.15s ease, background 0.15s ease;
}
.wookit-toast__close:hover { color: var( --wookit-text, #1f2937 ) !important; background: var( --wookit-surface-alt, #f3f4f6 ) !important; }

/* ── Hide native WC notices (they're re-shown as toasts by includes/notices.php).
   Killing them in CSS from first paint stops the duplicate / flash next to our
   toast — whatever theme or template printed them, wherever it placed them.
   .woocommerce-message & .woocommerce-error are ALWAYS transient notices in WC,
   so hide broadly. .woocommerce-info also serves as PERSISTENT page content
   (empty cart, "no products found", account prompts) → only hide the transient
   ones (inside the notices wrapper, or carrying a role). ── */
.woocommerce-message,
.woocommerce-error,
.woocommerce-notices-wrapper > .woocommerce-info,
.woocommerce-info[role]:not( .wc-no-matching-variations ):not( .wc-variation-is-unavailable ) {
    display: none !important;
}

/* The variation form's own live messages ("no products matched your selection",
   "this product is unavailable") are NOT store notices — they stay inline and
   are styled in product-price-cart.css. Keep them visible regardless of order. */
.wc-no-matching-variations,
.wc-variation-is-unavailable {
    display: block !important;
}

/* But never hide the sitewide demo "store notice" banner — not a transient
   notice, and our JS leaves it in place too. */
.woocommerce-store-notice,
.demo_store {
    display: block !important;
}

@media ( prefers-reduced-motion: reduce ) {
    .wookit-toast { transition: opacity 200ms ease; transform: none; }
    .wookit-toast.is-leaving { transform: none; }
}

@media ( max-width: 600px ) {
    .wookit-toasts {
        top: auto;
        bottom: 16px;
        right: 16px;
        left: 16px;
        width: auto;
    }
    .wookit-toast { transform: translateY( 140% ); }
    .wookit-toast.is-visible { transform: translateY( 0 ); }
    .wookit-toast.is-leaving { transform: translateY( 140% ); }
}
