/**
 * WC Purchase Notifications - frontend CSS.
 * Toast w lewym dolnym rogu.
 */

.wcpn-toasts,
.wcpn-toasts * {
    box-sizing: border-box;
}

.wcpn-toasts {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9998; /* niżej niż modal/cookies, wyżej niż treść */
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.wcpn-toast {
    background: var(--wcpn-background, #fff);
    color: var(--wcpn-text, #111827);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15), 0 4px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px 12px 12px;
    min-width: 280px;
    max-width: 360px;
    text-decoration: none;
    color: inherit;
    pointer-events: auto;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.06);
    overflow: hidden;
    position: relative;

    /* Animacja wejścia */
    transform: translateX(-120%) scale(0.95);
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
}

.wcpn-toast.is-visible {
    transform: translateX(0) scale(1);
    opacity: 1;
}

.wcpn-toast.is-leaving {
    transform: translateX(-120%) scale(0.95);
    opacity: 0;
}

.wcpn-toast:hover {
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.2), 0 6px 12px rgba(0, 0, 0, 0.08);
    transform: translateX(0) scale(1.015);
}

/* Lewy zielony pasek - akcent */
.wcpn-toast::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 4px;
    background: var(--wcpn-primary, #10b981);
}

.wcpn-toast-image {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: #f9fafb;
    margin-left: 4px; /* żeby nie nachodziło na zielony pasek */
}

.wcpn-toast-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wcpn-toast-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.wcpn-toast-line-top {
    font-size: 13px;
    line-height: 1.3;
    color: var(--wcpn-text, #111827);
}

.wcpn-toast-name {
    font-weight: 700;
}

.wcpn-toast-action {
    color: #6b7280;
}

.wcpn-toast-product {
    font-size: 13px;
    line-height: 1.3;
    font-weight: 600;
    color: var(--wcpn-text, #111827);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}

.wcpn-toast-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #6b7280;
    margin-top: 2px;
}

.wcpn-toast-time {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.wcpn-toast-time::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--wcpn-primary, #10b981);
    border-radius: 50%;
    display: inline-block;
    animation: wcpn-pulse 1.6s ease-in-out infinite;
}

@keyframes wcpn-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.wcpn-toast-price {
    font-weight: 700;
    color: var(--wcpn-text, #111827);
}

.wcpn-toast-price del { color: #9ca3af; font-weight: 400; margin-right: 4px; }

.wcpn-toast-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 14px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.15s ease, color 0.15s ease;
    pointer-events: auto;
}

.wcpn-toast:hover .wcpn-toast-close {
    opacity: 1;
}

.wcpn-toast-close:hover {
    background: #f3f4f6;
    color: #111827;
}

/* === MOBILE === */
@media (max-width: 600px) {
    .wcpn-toasts {
        left: 12px;
        right: 12px;
        /* 90px od dołu - nad sticky bottom menu sklepu (typowo ~70-80px wysokości) */
        bottom: calc(90px + env(safe-area-inset-bottom, 0px));
    }
    .wcpn-toast {
        min-width: auto;
        max-width: 100%;
        padding: 14px 18px 14px 14px;
        gap: 14px;
        border-radius: 16px;
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22), 0 4px 10px rgba(0, 0, 0, 0.08);
    }
    .wcpn-toast-image {
        width: 56px;
        height: 56px;
    }
    .wcpn-toast-line-top { font-size: 14px; }
    .wcpn-toast-product { font-size: 14px; }
    .wcpn-toast-meta { font-size: 12px; gap: 10px; }

    .wcpn-toast-close {
        width: 32px;
        height: 32px;
        font-size: 18px;
        opacity: 0.5;
        top: 4px;
        right: 4px;
    }
    .wcpn-toast-close:active {
        opacity: 1;
        background: #f3f4f6;
    }

    /* Animacja od dołu na mobile */
    .wcpn-toast {
        transform: translateY(120%) scale(0.95);
    }
    .wcpn-toast.is-visible {
        transform: translateY(0) scale(1);
    }
    .wcpn-toast.is-leaving {
        transform: translateY(120%) scale(0.95);
    }
    .wcpn-toast:hover {
        transform: translateY(0) scale(1);
    }
}

/* Bardzo małe ekrany */
@media (max-width: 380px) {
    .wcpn-toast-image {
        width: 50px;
        height: 50px;
    }
    .wcpn-toast {
        padding: 12px 14px 12px 12px;
        gap: 12px;
    }
}

/* Reduced motion - bez animacji */
@media (prefers-reduced-motion: reduce) {
    .wcpn-toast {
        transition: opacity 0.2s ease;
        transform: none;
    }
    .wcpn-toast.is-leaving {
        transform: none;
    }
    .wcpn-toast-time::before {
        animation: none;
    }
}
