/* ------------------------------------------------------------------
   WSS SWATCH DESIGN - Base Styles & Swatch Selectors
--------------------------------------------------------------------- */

/* Hide WooCommerce default "added to cart" message/link for our widget */
.wss-simple-product-add-to-cart ~ .added_to_cart,
.wss-simple-product-add-to-cart ~ .woocommerce-message,
.wss-simple-product-add-to-cart ~ a.added_to_cart,
.wss-product-swatch-container ~ .added_to_cart,
.wss-product-swatch-container ~ .woocommerce-message,
.wss-product-swatch-container ~ a.added_to_cart,
.wss-cart-actions ~ .added_to_cart,
.wss-cart-actions ~ a.added_to_cart,
.wss-cart-actions ~ .woocommerce-message,
/* Also hide if it appears inside our containers */
.wss-simple-product-add-to-cart .added_to_cart,
.wss-simple-product-add-to-cart a.added_to_cart,
.wss-simple-product-add-to-cart .woocommerce-message,
.wss-product-swatch-container .added_to_cart,
.wss-product-swatch-container a.added_to_cart,
.wss-product-swatch-container .woocommerce-message {
    display: none !important;
}

/* Hide growl notifications when our widget is present */
.wss-product-swatch-container ~ .growl,
.wss-simple-product-add-to-cart ~ .growl,
.wss-cart-actions ~ .growl,
body:has(.wss-product-swatch-container) .growl,
body:has(.wss-simple-product-add-to-cart) .growl {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

.wss-product-swatch-container {
    font-family: Arial, sans-serif;
    margin: 20px auto 0;
    padding: 15px;
}

.wss-product-swatch-container h3 {
    font-size: 14px;
    font-weight: normal;
    color: #333;
    margin: 0 0 8px 0;
}

/* Color Selector (Trigger) */
.wss-swatch-color-block {
    margin-bottom: 25px;
}

.wss-swatch-color-selector {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: border-color 0.2s;
    background-color: #fff;
    user-select: none; 
}

.wss-swatch-color-selector:hover,
.wss-swatch-color-selector:focus-within {
    border-color: #5b9bd5; 
    box-shadow: 0 0 0 1px #5b9bd5;
}

/* Wrapper for the main swatch image/dot (CIRCLE) */
.wss-swatch-dot-wrapper {
    width: 30px; 
    height: 30px;
    border-radius: 50%;
    overflow: hidden; 
    border: 1px solid rgba(0, 0, 0, 0.1);
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wss-swatch-image {
    width: 100%;
    height: 100% !important;
    object-fit: cover; 
}

.wss-swatch-color-text {
    flex-grow: 1;
    font-size: 16px;
    color: #333;
}

.wss-color-selector-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 10px;
}

.wss-clear-color-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    transition: all 0.2s;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.wss-clear-color-btn:hover {
    color: #d32f2f;
    background-color: #f5f5f5;
}

.wss-clear-color-btn svg {
    width: 16px;
    height: 16px;
}

.wss-dropdown-arrow-wrapper {
    flex-shrink: 0;
}

.wss-dropdown-arrow {
    position: relative;
    top: 2px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #333;
    opacity: 0.7;
}

/* Quantity Buttons (All other attributes) */
.wss-swatch-quantity-buttons {
    /*display: flex;*/
    gap: 10px;

}

.wss-quantity-button {
    flex: 1 1 auto;
    padding: 10px 15px;
    border: 1px solid #ddd;
    background-color: #fff;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    text-align: center;
    transition: all 0.2s;
    min-width: 80px;
    margin-bottom: 10px;
}

/* Active State */
.wss-quantity-button.wss-active {
    border-color: #d32f2f;
    background-color: #d32f2f;
    font-weight: bold;
    color: #ffffff;
}

.wss-quantity-button:hover {
    border-color: #d32f2f;
    background-color: #d32f2f;
    font-weight: bold;
    color: #ffffff;
}

.wss-quantity-button.wss-unavailable {
    display: none !important;
    visibility: hidden !important;
}

.wss-color-list-item.wss-unavailable {
    display: none !important;
    visibility: hidden !important;
}

/* ------------------------------------------------------------------
   QUANTITY INPUT & ADD TO CART BUTTON STYLES
--------------------------------------------------------------------- */

.wss-cart-actions {
    font-family: Arial, sans-serif;
    padding: 15px;
    margin: 0 auto 20px;
    position: relative;
}

.wss-cart-actions-inner {
    display: flex;
    gap: 15px;
}

.wss-add-to-cart-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}

.wss-view-cart-button {
    display: block;
    width: 100%;
    color: #000;
    text-align: center;
    text-decoration: none;
    font-size: 18px;
    padding: 8px 0;
    margin-top: 5px;
    transition: color 0.2s;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
}

.wss-view-cart-button:hover {
    color: #d32f2f;
    text-decoration: none;
}

.wss-quantity-input-wrapper {
    display: flex;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    height: 50px; 
    width: fit-content;
}

.wss-quantity-field {
    width: 60px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    color: #333;
    background-color: #fff;
    padding: 0 5px;
}

.wss-quantity-controls {
    display: flex;
    flex-direction: column;
    width: 30px;
    height: 100%;
    border-left: 1px solid #eee;
    background-color: #f3f3f3;
}

.wss-quantity-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.1s;
}

.wss-quantity-btn:hover {
    background-color: #e7e7e7;
}

.wss-quantity-btn.plus {
    border-bottom: 1px solid #eee;
}

.wss-add-to-cart-button {
    flex-grow: 1;
    background-color: #d32f2f;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s;
    height: 50px;
}

.wss-add-to-cart-button:hover {
    background-color: #b71c1c;
}

.wss-add-to-cart-button i {
    font-size: 20px;
}

/* ------------------------------------------------------------------
   SIDE DRAWER / MODAL STYLES
--------------------------------------------------------------------- */

.wss-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999999999999999999999999999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.wss-modal-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%; 
    max-width: 450px; 
    height: 100%;
    background: #fff;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    z-index: 100000;
    transform: translateX(100%);
    transition: transform 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

/* VISIBLE STATE (Set by JavaScript) */
.wss-modal-overlay.wss-open {
    opacity: 1;
    visibility: visible;
}

.wss-modal-overlay.wss-open .wss-modal-drawer {
    transform: translateX(0);
}

.wss-modal-header {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.wss-modal-title {
    flex-grow: 1;
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin: 0;
}

.wss-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #555;
    line-height: 1;
}

.wss-modal-content {
    padding: 15px;
    overflow-y: auto;
    flex-grow: 1;
}

/* SEARCH BAR STYLES */
.wss-search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.wss-search-input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.wss-search-button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
}

/* COLOR LIST ITEM STYLES */
.wss-color-list-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.wss-color-list-item:hover {
    background-color: #f9f9f9;
}

/* Wrapper for the list swatch image (SQUARE) */
.wss-list-dot-wrapper {
    width: 40px; 
    height: 40px;
    border-radius: 4px; 
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
    margin-right: 15px;
}

.wss-list-image {
    width: 100%;
    height: 100% !important;
    object-fit: cover;
}

.wss-list-text {
    flex-grow: 1;
}

.wss-list-status {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 15px;
    font-weight: bold;
}

.wss-status-available {
    color: #388e3c;
    background-color: #e8f5e9;
}

.wss-status-backorder {
    color: #f57c00;
    background-color: #fff3e0;
    white-space: nowrap;
}

/* Allow text wrapping on mobile for backorder status */
@media (max-width: 768px) {
    .wss-stock-status-message.wss-status-backorder {
        white-space: normal;
        word-wrap: break-word;
    }
}

.wss-status-unavailable {
    color: #d32f2f;
    background-color: #fbecec;
}

/* ------------------------------------------------------------------
   AVAILABILITY STYLES
--------------------------------------------------------------------- */

/* Style for UNAVAILABLE color list items in the modal */
.wss-color-list-item[data-available="false"],
.wss-color-list-item.wss-out-of-stock-item {
    opacity: 0.7; /* Slightly fade out but keep visible */
    cursor: pointer; /* Allow clicking to see the disabled button state */
}

/* Ensure hover effect works for out of stock items (they're still selectable) */
.wss-color-list-item[data-available="false"]:hover,
.wss-color-list-item.wss-out-of-stock-item:hover {
    background-color: rgba(0, 0, 0, 0.02); 
}

/* Price Wrapper - Contains price holder and stock status message */
.wss-price-wrapper {
    margin: 20px auto;
    max-width: 500px;
}

/* Price Holder - Consistent styling for all product types */
.wss-price-holder {
    font-size: 24px;
    text-align: left;
    padding-left: 15px;
}

.wss-price-holder .woocommerce-Price-amount {
    font-weight: 700;
    font-size: 24px;
}

.wss-price-holder .price {
    font-size: 24px;
}

/* Stock Status Message */
.wss-stock-status-message {
    margin-top: 14px;
    font-size: 16px;
    text-align: left;
    padding: 3px 8px;
    padding-left: 15px;
    border-radius: 15px;
    font-weight: bold;
    display: inline-block;
}

/* ------------------------------------------------------------------
   ATTACH ME! WIDGET STYLES
--------------------------------------------------------------------- */

/* Attach Me! Widget Styling */
.wss-attachme-container {
    margin: 20px 0;
}

.wss-attachme-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 15px;
    color: #333;
}

.wss-attachme-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.wss-attachme-item {
    margin: 12px 0;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.wss-attachme-item:hover {
    background: #e9ecef;
}

.wss-attachme-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.wss-attachme-link:hover {
    color: #005177;
    text-decoration: underline;
}

.wss-attachme-link svg {
    flex-shrink: 0;
}

.wss-attachme-description {
    margin: 8px 0 0 24px;
    font-size: 14px;
    color: #666;
    font-style: italic;
}

.wss-attachme-empty {
    margin: 10px 0;
    padding: 12px;
    color: #666;
    font-style: italic;
}

/* Grouped Products Styling */
.wss-grouped-products-wrapper {
    max-width: 500px;
    margin: 0 auto;
}

.wss-grouped-products-wrapper .group_table {
    width: 100%;
    margin-bottom: 20px;
}

.wss-grouped-products-wrapper .group_table td {
    padding: 10px;
    vertical-align: middle;
}

.wss-grouped-products-wrapper .quantity {
    margin: 0;
}

.wss-grouped-products-wrapper .quantity input[type="number"] {
    width: 80px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
}

.wss-grouped-products-wrapper button.single_add_to_cart_button {
    width: 100%;
    background-color: #d32f2f;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 15px 20px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s;
    height: 50px;
    margin-top: 15px;
}

.wss-grouped-products-wrapper button.single_add_to_cart_button:hover {
    background-color: #b71c1c;
}

/* External/Affiliate Product Link Button */
.wss-cart-actions .wss-add-to-cart-button[href] {
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hide shipping destination address display */
.woocommerce-shipping-destination {
    display: none !important;
}

/* Make "Zadarmo" text semi-bold in shipping labels */
.wss-free-shipping-text {
    font-weight: 600 !important;
}

/* RESPONSIVENESS */
@media (max-width: 450px) {
    .wss-cart-actions-inner {
        flex-direction: column;
        gap: 10px;
    }
    .wss-add-to-cart-wrapper {
        width: 100%;
    }
    .wss-add-to-cart-button {
        width: 100%;
    }
    .wss-view-cart-button {
        width: 100%;
    }
}

@media (max-width: 300px) {
    .wss-swatch-quantity-buttons {
        flex-direction: column; 
    }
}