/**
 * LooseGallery WooCommerce - Frontend Styles
 */

/* Toast Popups (plugin messages) */
.lg-toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    width: 360px;
    max-width: calc(100vw - 32px);
    pointer-events: none;
}

.admin-bar .lg-toast-container {
    top: 56px;
}

.lg-toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    padding: 14px 16px;
    background: #ffffff;
    color: #111111;
    border: 2px solid #111111;
    border-left-width: 8px;
    border-radius: 4px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    font-size: 15px;
    line-height: 1.4;
    font-weight: 500;
    pointer-events: auto;
    animation: lg-toast-in 0.3s ease forwards, lg-toast-out 0.4s ease 5s forwards;
}

/* Keep the message on screen while it is being read */
.lg-toast:hover,
.lg-toast:focus-within {
    animation-play-state: paused;
}

.lg-toast--success {
    border-left-color: #4bff66;
}

.lg-toast--error {
    border-left-color: #dc3232;
}

.lg-toast--info {
    border-left-color: #0073aa;
}

.lg-toast__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #111111;
    color: #ffffff;
    font-size: 13px;
    font-weight: bold;
    line-height: 1;
}

.lg-toast--success .lg-toast__icon {
    background: #4bff66;
    /* Dark glyph: white on this neon green is unreadable */
    color: #111111;
}

.lg-toast--error .lg-toast__icon {
    background: #dc3232;
}

.lg-toast--info .lg-toast__icon {
    background: #0073aa;
}

.lg-toast__message {
    flex: 1 1 auto;
}

.lg-toast__close {
    flex: 0 0 auto;
    margin: -4px -4px 0 0;
    padding: 0 4px;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    color: inherit;
    font-size: 20px;
    line-height: 1;
    opacity: 0.5;
    cursor: pointer;
}

.lg-toast__close:hover,
.lg-toast__close:focus {
    opacity: 1;
    background: none !important;
}

@keyframes lg-toast-in {
    from {
        opacity: 0;
        transform: translateX(24px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes lg-toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
        max-height: 200px;
    }
    to {
        opacity: 0;
        transform: translateX(24px);
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        border-top-width: 0;
        border-bottom-width: 0;
        margin-top: -10px;
        /* Never leave an invisible click blocker behind if the node lingers */
        visibility: hidden;
        pointer-events: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lg-toast {
        animation: lg-toast-fade-in 0.01s linear forwards, lg-toast-fade-out 0.01s linear 5s forwards;
    }

    @keyframes lg-toast-fade-in {
        from { opacity: 0; }
        to { opacity: 1; }
    }

    @keyframes lg-toast-fade-out {
        from { opacity: 1; }
        to { opacity: 0; visibility: hidden; pointer-events: none; }
    }
}

/* Customize Me Tag */
.lg-customize-tag-wrapper {
    position: absolute;
    top: 25px;
    right: -24px;
    z-index: 10;
    pointer-events: none;
}

.lg-customize-tag {
    display: block;
    width: 24px;
    height: 144px;
    border-radius: 0 !important;
}

.lg-customize-tag-single {
    top: 15px;
    right: 15px;
    font-size: 16px;
    padding: 8px 16px;
}

/* Design Button */
.lg-design-button-wrapper {
    margin: 20px 0;
}

.lg-design-link {
    display: inline-block !important;
    text-decoration: none !important;
    border: none !important;
    background: none !important;
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
    line-height: 0 !important;
    box-shadow: none !important;
    font-size: 0 !important;
    border-radius: 0 !important;
}

.lg-design-link:hover,
.lg-design-link:focus,
.lg-design-link:active,
.lg-design-link:visited {
    transform: scale(1.05);
    opacity: 0.9;
    background: none !important;
    text-decoration: none !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    border-radius: 0 !important;
}

.lg-design-button-image {
    display: block !important;
    max-width: 300px;
    height: auto;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
}

.lg-design-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 12px;
    background: #e7f7ef;
    border: 1px solid #46b450;
    border-radius: 4px;
    color: #006505;
    font-weight: 500;
}

.lg-design-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #46b450;
    color: white;
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
}

.lg-design-button {
    display: inline-block;
    padding: 12px 24px;
    border: none !important;
    border-radius: 4px;
    font-weight: 600;
    text-decoration: none !important;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.lg-design-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    opacity: 0.9;
}

/* Design Preview */
.lg-design-preview-wrapper {
    position: relative;
    display: inline-block;
}

.lg-design-preview {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.lg-design-badge {
    position: absolute;
    bottom: 10px;
    left: 10px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

/* Cart Styles */
.lg-cart-preview-wrapper {
    position: relative;
    display: inline-block;
}

.lg-cart-preview {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    border: 2px solid #46b450;
}

.lg-cart-preview-badge {
    position: absolute;
    bottom: 5px;
    left: 5px;
    padding: 4px 8px;
    background: #46b450;
    color: white;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
}

.lg-cart-design-badge {
    display: inline-block;
    padding: 4px 8px;
    background: #46b450;
    color: white;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

.lg-cart-edit-wrapper {
    margin-top: 10px;
    display: inline-block;
    max-width: fit-content;
}

.lg-cart-edit-button {
    display: inline-block;
    padding: 6px 12px;
    background: #0073aa;
    color: white !important;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none !important;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
    width: auto !important;
    max-width: fit-content;
}

.lg-cart-edit-button:hover {
    background: #005177;
}

.lg-has-custom-design {
    position: relative;
}

.lg-has-custom-design::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 2px solid #46b450;
    border-radius: 4px;
    pointer-events: none;
    opacity: 0.3;
}

/* Responsive Design */
@media (max-width: 768px) {
    .lg-toast-container {
        top: 12px;
        right: 12px;
        left: 12px;
        width: auto;
        max-width: none;
    }

    .admin-bar .lg-toast-container {
        top: 58px;
    }

    .lg-toast {
        font-size: 14px;
    }

    .lg-customize-tag-wrapper {
        right: -25px;
    }
    
    .lg-customize-tag {
        height: 120px;
    }

    .lg-customize-tag-single {
        top: 10px;
        right: 10px;
        font-size: 13px;
        padding: 6px 12px;
    }

    .lg-design-button {
        display: block;
        width: 100%;
    }

    .lg-design-status {
        font-size: 14px;
    }
}

/* Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.lg-design-button.loading {
    animation: pulse 1.5s ease-in-out infinite;
    pointer-events: none;
}

/* Product Loop Compatibility */
.woocommerce ul.products li.product .lg-customize-tag,
.woocommerce-page ul.products li.product .lg-customize-tag {
    position: absolute;
    top: 10px;
    right: 10px;
}

/* Single Product Compatibility */
.single-product .lg-design-button-wrapper {
    clear: both;
    margin-top: 20px;
}

/* Theme Compatibility Fixes */
.product .lg-customize-tag {
    z-index: 99;
}

.woocommerce div.product form.cart .lg-design-button-wrapper {
    clear: both;
    width: 100%;
}
