/**
 * Product Variation Popup Styles
 * Styles for product listing buttons and variation popup modal
 */

/* Product buttons container */
.shost-product-buttons {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    width: 100%;
}

/* Button styles */
.shost-product-buttons .button {
    flex: 1;
    font-size: 13px;
    padding: 10px 15px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-weight: 600;
    line-height: 1.2;
}

/* Add to cart button */
.shost-add-to-cart-button {
    background-color: var(--primary-color, #0b3e40) !important;
    color: white !important;
}

.shost-add-to-cart-button:hover {
    background-color: var(--primary-hover, #094044) !important;
    opacity: 0.9;
}

/* Buy now button */
.shost-buy-now-button {
    background-color: var(--primary-color, #0b3e40) !important;
    color: white !important;
}

.shost-buy-now-button:hover {
    background-color: var(--primary-hover, #094044) !important;
    opacity: 0.9;
}

/* View details button (for products without price) */
.shost-view-details-button {
    background-color: var(--primary-color, #0b3e40) !important;
    color: white !important;
    display: block;
    text-decoration: none;
}

.shost-view-details-button:hover {
    background-color: var(--primary-hover, #094044) !important;
    opacity: 0.9;
}

/* Variation popup modal */
.shost-variation-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    overflow-y: auto;
    padding: 20px;
}

.shost-variation-popup-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Popup container */
.shost-variation-popup {
    background: white;
    border-radius: 8px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* Close button */
.shost-popup-close {
    position: absolute;
    top: 5px;
    right: -19px;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    color: #333;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.shost-popup-close:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* Popup content */
.shost-popup-content {
    display: flex;
    flex-wrap: wrap;
    padding: 30px;
    gap: 30px;
}

/* Popup image section */
.shost-popup-image {
    flex: 0 0 45%;
    max-width: 45%;
}

.shost-popup-image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

/* Popup details section */
.shost-popup-details {
    flex: 1;
    min-width: 300px;
}

.shost-popup-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--text-primary, #121B21);
    line-height: 1.4;
}

.shost-popup-price {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-color, #0b3e40);
    margin-bottom: 20px;
}

.shost-popup-price .amount {
    font-size: 22px;
}

.shost-popup-description {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary, #666);
    margin-bottom: 25px;
}

/* Variations form */
.shost-popup-variations {
    margin-bottom: 25px;
}

.variations {
    margin: 0;
}

.variations tr {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.variations .label {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text-primary, #121B21);
}

.variations .value {
    width: 100%;
}

.variations select {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color, #E7DED5);
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
    cursor: pointer;
}

.variations select:focus {
    outline: none;
    border-color: var(--primary-color, #0b3e40);
}

/* Quantity input */
.shost-popup-quantity {
    margin-bottom: 25px;
}

.shost-popup-quantity label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text-primary, #121B21);
}

.quantity {
    display: flex;
    align-items: center;
}

.quantity input[type="number"] {
    width: 80px;
    padding: 10px;
    border: 1px solid var(--border-color, #E7DED5);
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
}

.quantity input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color, #0b3e40);
}

/* Popup buttons */
.shost-popup-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.shost-popup-buttons .button {
    flex: 1;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.shost-popup-buttons .shost-popup-add-to-cart {
    background-color: var(--primary-color, #0b3e40) !important;
    color: white !important;
}

.shost-popup-buttons .shost-popup-add-to-cart:hover {
    background-color: var(--primary-hover, #094044) !important;
    opacity: 0.9;
}

.shost-popup-buttons .shost-popup-buy-now {
    background-color: var(--primary-color, #0b3e40) !important;
    color: white !important;
}

.shost-popup-buttons .shost-popup-buy-now:hover {
    background-color: var(--primary-hover, #094044) !important;
    opacity: 0.9;
}

.shost-popup-buttons .button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Success message container */
.shost-add-to-cart-message {
    margin-top: 12px;
    padding: 10px 15px;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    color: #155724;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    display: none;
}

.shost-add-to-cart-message.show {
    display: block;
}

/* Loading state */
.shost-variation-popup.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.shost-variation-popup.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid var(--primary-color, #0b3e40);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 6;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    .shost-popup-close {
        right: -14px; !important;
    }

    .shost-product-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .shost-product-buttons .button {
        width: 100%;
        font-size: 12px;
        padding: 8px 12px;
    }

    .shost-product-buttons .shost-buy-now-button{
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    .shost-variation-popup {
        max-width: 95%;
        max-height: 95vh;
    }

    .shost-popup-content {
        flex-direction: column;
        padding: 20px;
        gap: 20px;
    }

    .shost-popup-image {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .shost-popup-details {
        min-width: auto;
    }

    .shost-popup-title {
        font-size: 20px;
    }

    .shost-popup-price {
        font-size: 18px;
    }

    .shost-popup-buttons {
        flex-direction: column;
    }

    .shost-popup-buttons .button {
        width: 100%;
    }
}

/* Very small mobile devices */
@media (max-width: 480px) {
    .shost-variation-popup-overlay {
        padding: 10px;
    }

    .shost-popup-content {
        padding: 15px;
    }

    .shost-popup-title {
        font-size: 18px;
    }

    .shost-popup-price {
        font-size: 16px;
    }

    .shost-popup-close {
        width: 30px;
        height: 30px;
        font-size: 20px;
    }
}
