/* ==========================================================================
   WooCommerce Extra - Animated Add to Cart Popup & Notification
   ========================================================================== */

/* Button Loading State */
.single_add_to_cart_button.pk-btn-loading,
.ajax_add_to_cart.pk-btn-loading,
.button.pk-btn-loading {
    position: relative !important;
    pointer-events: none !important;
    opacity: 0.85 !important;
    cursor: wait !important;
}

.pk-cart-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: pkSpin 0.7s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes pkSpin {
    to { transform: rotate(360deg); }
}

/* Backdrop */
.pk-cart-popup-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(17, 24, 39, 0.55);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 999998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s ease;
}

.pk-cart-popup-backdrop.is-active {
    opacity: 1;
    visibility: visible;
}

/* Modal Card */
.pk-cart-popup-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -46%) scale(0.92);
    width: calc(100% - 32px);
    max-width: 460px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.28), 0 0 1px rgba(0, 0, 0, 0.12);
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    padding: 28px 24px 24px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #111827;
    transition: transform 0.38s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.25s ease, visibility 0.38s ease;
    box-sizing: border-box;
}

.pk-cart-popup-modal.is-active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* Close Button */
.pk-popup-close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #f3f4f6;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-size: 22px;
    line-height: 1;
    transition: all 0.2s ease;
    padding: 0;
}

.pk-popup-close-btn:hover {
    background: #e5e7eb;
    color: #111827;
    transform: rotate(90deg);
}

/* Header & Animated Checkmark */
.pk-popup-header {
    text-align: center;
    margin-bottom: 20px;
}

.pk-popup-success-icon-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.pk-popup-checkmark {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: block;
    stroke-width: 3;
    stroke: #10b981;
    stroke-miterlimit: 10;
}

.pk-cart-popup-modal.is-active .pk-popup-checkmark {
    animation: pkScaleBounce 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.1s both;
}

.pk-popup-checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 3;
    stroke-miterlimit: 10;
    stroke: #10b981;
    fill: #ecfdf5;
}

.pk-cart-popup-modal.is-active .pk-popup-checkmark-circle {
    animation: pkStrokeCircle 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.pk-popup-checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pk-cart-popup-modal.is-active .pk-popup-checkmark-check {
    animation: pkStrokeCheck 0.4s cubic-bezier(0.65, 0, 0.45, 1) 0.35s forwards;
}

@keyframes pkScaleBounce {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.18); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes pkStrokeCircle {
    100% { stroke-dashoffset: 0; }
}

@keyframes pkStrokeCheck {
    100% { stroke-dashoffset: 0; }
}

.pk-popup-heading {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 6px 0;
    letter-spacing: -0.01em;
}

.pk-popup-message {
    font-size: 0.92rem;
    color: #4b5563;
    margin: 0;
    line-height: 1.45;
}

.pk-popup-message strong {
    color: #111827;
    font-weight: 600;
}

/* Product Card Inside Modal */
.pk-popup-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #f9fafb;
    border: 1px solid #f3f4f6;
    border-radius: 14px;
    padding: 14px;
    margin: 18px 0;
}

.pk-popup-item-thumb {
    width: 68px;
    height: 68px;
    min-width: 68px;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pk-popup-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pk-popup-item-info {
    flex: 1;
    min-width: 0;
}

.pk-popup-item-title {
    font-size: 0.98rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pk-popup-item-meta {
    font-size: 0.82rem;
    color: #6b7280;
    margin-bottom: 4px;
}

.pk-popup-item-price-qty {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
}

.pk-popup-item-qty {
    background: #e5e7eb;
    color: #374151;
    font-weight: 600;
    font-size: 0.78rem;
    padding: 2px 7px;
    border-radius: 6px;
}

.pk-popup-item-price {
    font-weight: 700;
    color: #111827;
}

/* Subtotal Summary */
.pk-popup-subtotal-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 4px 16px;
    border-bottom: 1px solid #f3f4f6;
    margin-bottom: 18px;
    font-size: 0.92rem;
}

.pk-popup-subtotal-label {
    color: #6b7280;
}

.pk-popup-subtotal-amount {
    font-size: 1.1rem;
    font-weight: 700;
    color: #111827;
}

/* Error Notice Banner inside popup */
.pk-popup-error-banner {
    display: none;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 0.88rem;
    margin-bottom: 16px;
    line-height: 1.4;
}

/* Action Buttons */
.pk-popup-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Proceed to Checkout Button */
.pk-popup-btn-checkout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    background: #111827;
    color: #ffffff !important;
    text-decoration: none !important;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(17, 24, 39, 0.2);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

.pk-popup-btn-checkout:hover {
    background: #27303f;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(17, 24, 39, 0.28);
}

.pk-popup-btn-checkout svg {
    transition: transform 0.2s ease;
}

.pk-popup-btn-checkout:hover svg {
    transform: translateX(4px);
}

/* Secondary Actions row */
.pk-popup-secondary-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.pk-popup-btn-cart {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    background: #ffffff;
    color: #374151 !important;
    text-decoration: none !important;
    font-size: 0.92rem;
    font-weight: 600;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
    text-align: center;
}

.pk-popup-btn-cart:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #111827 !important;
}

.pk-popup-btn-continue {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    color: #6b7280;
    font-size: 0.92rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s ease;
}

.pk-popup-btn-continue:hover {
    color: #111827;
}

/* Mobile Adjustments */
@media (max-width: 480px) {
    .pk-cart-popup-modal {
        padding: 24px 18px 20px;
        border-radius: 18px;
    }
    .pk-popup-secondary-actions {
        flex-direction: column-reverse;
        gap: 8px;
    }
    .pk-popup-btn-cart,
    .pk-popup-btn-continue {
        width: 100%;
    }
}
