/*
 * Styles for Hanika Click to Cart plugin
 *
 * This file defines the appearance of selected items in the loop and the
 * modal overlay/pop‑up used for variable products.
 */

/* Highlight the selected image container. The container gets a relative position and overlay, and the image inside it is outlined. */
.hanika-selected {
    position: relative;
}
.hanika-selected img {
    outline: 3px solid #10b981;
    outline-offset: 0;
}
/* دایره خالی در گوشه تصویر برای همه محصولات */
.hanika-check-overlay {
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s ease;
}
/* تیک هنگام انتخاب */
.hanika-selected .hanika-check-overlay {
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
}
/* باکس متغیرهای انتخاب شده روی عکس */
.hanika-product-summary {
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    margin-top: 0;
    padding: 8px 10px;
    border-radius: 0 0 8px 8px;
    font-size: 12px;
    line-height: 1.4;
    color: #ffffff;
    max-height: 80px;
    overflow-y: auto;
    z-index: 5;
    backdrop-filter: blur(4px);
}

/* عنوان بالای باکس انتخاب‌ها */
.hanika-product-summary-title {
    text-align: center;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 13px;
    color: #ffffff;
}

/* Modal overlay */
.hanika-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
}

/* Modal window */
.hanika-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: #ffffff;
    padding: 0;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    font-family: inherit;
    box-sizing: border-box;
}

/* Close button */
.hanika-modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    cursor: pointer;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

/* Ensure variation table fits inside modal */
.hanika-modal table.variations {
    width: 100%;
}

/* Adjust add to cart button inside modal */
.hanika-modal .single_add_to_cart_button {
    margin-top: 15px;
}

/* Styling for the custom variations table */
/* Styling for the custom variations table */
.hanika-variations-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}
.hanika-variations-table th,
.hanika-variations-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eeeeee;
    text-align: right;
    font-size: 15px;
}
.hanika-variations-table th {
    background: #f5f5f5;
    font-weight: 600;
    color: #3b3b3b;
}
.hanika-var-price {
    white-space: nowrap;
}

/* Heading in modal */
.hanika-modal-heading {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    text-align: right;
}

/* Wrapper for variations table */
.hanika-variations-wrapper {
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    padding: 0;
    background: #ffffff;
}

/* Style for the multi-variation add button inside the modal */
.hanika-add-selected-button {
    display: block;
    width: 100%;
    background: #10b981;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    margin-top: 16px;
    cursor: pointer;
    font-size: 16px;
    text-align: center;
    transition: background 0.3s ease;
}
.hanika-add-selected-button:hover {
    background: #0e9e66;
}

/* Style the quantity select dropdown */
.hanika-var-qty-cell select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #cccccc;
    border-radius: 4px;
    background-color: #ffffff;
    font-size: 15px;
    direction: rtl;
}

/* Additional styling for table rows on hover */
.hanika-variations-table tbody tr:hover {
    background-color: #f9f9f9;
}

/* Responsive adjustments for small screens */
@media screen and (max-width: 480px) {
    .hanika-modal {
        width: 95%;
        padding: 16px;
    }
    .hanika-variations-table th,
    .hanika-variations-table td {
        font-size: 14px;
        padding: 8px 10px;
    }
    .hanika-add-selected-button {
        font-size: 14px;
        padding: 8px 14px;
    }
}

/* Message shown when no variation is selected */
.hanika-no-selection-message {
    color: #d32f2f;
    margin-top: 10px;
    text-align: right;
    font-size: 14px;
    display: none;
}

/* Floating order button shown when the user has added selections to their order summary */
.hanika-order-button {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translate(-50%, 0);
    background-color: #10b981;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 9999px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    font-size: 16px;
    z-index: 10050;
    display: none;
    transition: background 0.2s ease, transform 0.2s ease;
}
.hanika-order-button:hover {
    background-color: #0e9e66;
    transform: translate(-50%, -2px);
}

/* Icon and text inside the floating order button */
.hanika-order-button-icon {
    margin-left: 8px;
    font-size: 14px;
}

.hanika-order-button-text {
    font-size: 15px;
}

/* استایل برای متن داخل باکس متغیرها */
.hanika-product-summary-variation {
    opacity: 1;
    color: #ffffff;
}

.hanika-product-summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
}

.hanika-product-summary-row:last-child {
    margin-bottom: 0;
}


.hanika-product-summary-qty {
    font-weight: 600;
}

/* استایل برای باکس قابل اسکرول در پاپ‌آپ */
.hanika-cart-scrollable {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
}

.hanika-cart-scrollable::-webkit-scrollbar {
    width: 8px;
}

.hanika-cart-scrollable::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.hanika-cart-scrollable::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.hanika-cart-scrollable::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Cart summary table inside the cart modal */
.hanika-cart-summary-wrapper {
    margin-top: 12px;
}

.hanika-cart-summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.hanika-cart-summary-table th,
.hanika-cart-summary-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #eeeeee;
    text-align: right;
    font-size: 14px;
}

.hanika-cart-summary-table th {
    background: #f5f5f5;
    font-weight: 600;
    color: #3b3b3b;
}

.hanika-cart-empty-message {
    margin-top: 8px;
    margin-bottom: 0;
    font-size: 14px;
    text-align: right;
    color: #555555;
}

.hanika-cart-submit-button {
    margin: 0;
    padding: 14px 20px;
    border-radius: 0 0 12px 12px;
    border: none;
    background-color: #10b981;
    color: #ffffff;
    cursor: pointer;
    font-size: 16px;
    width: 100%;
    text-align: center;
    box-shadow: none;
    font-weight: 600;
}

.hanika-cart-submit-button:hover {
    background-color: #0e9e66;
}

/* اطمینان از اینکه محتوای پاپ‌آپ فضای کافی برای دکمه دارد */
.hanika-modal-content {
    padding: 24px;
    padding-bottom: 10px;
    overflow-y: auto;
    flex: 1;
}


/* Loading overlay on product image */
.hanika-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    backdrop-filter: blur(2px);
    border-radius: inherit;
}

.hanika-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #10b981;
    border-bottom-color: transparent;
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: hanika-rotation 1s linear infinite;
}

@keyframes hanika-rotation {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}
