/* Build Your Own Sample Box - Swatch Style Frontend */

/* Main Container Styles */
.byosb-container {
    max-width: 100%;
    margin: 20px auto;
   /* background-color: #e6e4e0;  */
    border-radius: 8px;
}

.byosb-title {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 24px;
}

.byosb-tiles-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 32px 32px;
    max-width: 100%;
}

.byosb-tile {
    background-color: #fff;
    height: auto;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-height: 250px;
}

.byosb-tile:hover {
    box-shadow: 0 0 4px 2px #95C6E4;
    transition: box-shadow 0.3s ease;
}

.byosb-tile-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 15px;
}

.byosb-tile-placeholder {
    text-align: center;
    color: #999;
    font-size: 14px;
}

.byosb-tile-product {
    text-align: center;
    width: 100%;
}

.byosb-product-image {
    width: 50%;
    height: auto;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 10px;
}

.byosb-product-name {
    display: block;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 10px;
    line-height: 1.3;
}

.byosb-change-product {
    background: #007cba;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    transition: background 0.3s ease;
}

.byosb-change-product:hover {
    background: #005a87;
}

.byosb-actions {
    text-align: center;
    margin: 30px 0 0 0;
}

#byosb-add-to-cart {
    color: white;
    padding: 15px 30px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background 0.3s ease;
}

/* Modal Overlay */
.byosb-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 9999999;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: Montserrat, sans-serif;
    font-size: 14px;
    color: #3a3935;
}

/* Swatch Modal Styles */
.swatch-pop-up-modal {
    width: 100%;
    background-color: #f8f8f8;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px;
    box-sizing: border-box;
    position: relative;
    gap: 10px;
    max-width: 900px;
    border-radius: 8px;
}

.swatch-column-container {
    width: 100%;
    height: auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 32px;
}

/* Product Grid Styles */
.swatch-grid {
    width: auto;
    height: auto;
    max-height: 60svh;
    min-height: 300px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    grid-auto-rows: auto;
    gap: 8px;
    overflow-y: scroll;
}

/* Ensure loading state takes full space and centers properly */
.byosb-loading {
    grid-column: 1 / -1; /* Span all grid columns */
}

.swatch-list {
    width: auto;
    height: auto;
    background-color: #fff;
    padding: 12px;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s;
}

.swatch-list.selected .ellipse {
    background-color: #86bede;
}

.swatch-content {
    width: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    overflow: hidden;
}

.swatch-image {
    width: 100%;
    max-width: 180px;
    height: auto;
    aspect-ratio: 1 / 1;
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
}

.ellipse {
    width: 15px;
    height: 15px;
    justify-self: end;
    border-radius: 50%;
    margin: 8px;
    background-color: transparent;
    border: 1px solid #000;
    transition: background-color 0.3s ease;
}

.swatch-title {
    margin: 0px;
    font-size: 16px;
    font-weight: 400;
    color: #3a3935;
    font-family: Montserrat, sans-serif;
    text-align: center;
    align-self: stretch;
    position: relative;
}

.swatch-price {
    margin: 0;
    font-size: 14px;
    font-family: Montserrat, sans-serif;
    text-align: center;
    align-self: stretch;
    position: relative;
    line-height: 1.2;
    transition: color 0.3s ease;
}

/* Button Styles */
.swatch-btn {
    width: 100%;
    max-width: 50%;
    min-width: 250px;
    background-color: #86bede;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 12px 0px;
    text-align: center;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    outline: none;
}

.swatch-btn:hover:not(.disabled) {
    background-color: #6fa8cc;
}

.swatch-btn.disabled {
    background-color: #ccc !important;
    color: #888 !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}

.swatch-btn.disabled:hover {
    background-color: #ccc !important;
}

.btn-text {
    font-size: 16px;
    font-weight: 400;
}

/* Close Button */
.close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close::before,
.close::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 2px;
    background-color: #3a3935;
    transform-origin: center;
    transition: background-color 0.3s ease;
}

.close::before {
    transform: rotate(45deg);
}

.close::after {
    transform: rotate(-45deg);
}

.close:hover::before,
.close:hover::after {
    background-color: #000;
}

/* Category Tabs */
.byosb-categories {
    margin-bottom: 20px;
    width: 100%;
}

.byosb-category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.byosb-category-tab {
    padding: 10px 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: Montserrat, sans-serif;
    font-size: 14px;
    color: #3a3935;
}

.byosb-category-tab:hover,
.byosb-category-tab.active {
    background: #86bede;
    color: white;
    border-color: #86bede;
}

/* Loading and Error States */
.byosb-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 300px;
    padding: 60px 20px;
    color: #666;
    font-family: Montserrat, sans-serif;
    font-size: 16px;
    font-weight: 500;
    gap: 20px;
    text-align: center;
    grid-column: 1 / -1; /* Span all grid columns when inside grid */
    place-self: center; /* Center within grid area */
}

/* Modern CSS Spinner */
.byosb-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2e7d32;
    border-radius: 50%;
    animation: byosb-spin 1s linear infinite;
}

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

/* Elegant loading dots animation */
.byosb-loading-dots {
    display: inline-block;
}

.byosb-loading-dots::after {
    content: '';
    animation: byosb-dots 1.5s infinite;
}

@keyframes byosb-dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Removed skeleton loading - using simple spinner instead */

/* Button Loading States */
.swatch-btn.loading,
#byosb-add-to-cart.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.swatch-btn.loading::after,
#byosb-add-to-cart.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin: -10px 0 0 -10px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: byosb-spin 0.8s linear infinite;
}

/* Loading overlay for modal */
.byosb-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.byosb-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    margin: 10px 0;
    font-family: Montserrat, sans-serif;
}

.byosb-success {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 4px;
    margin: 10px 0;
    font-family: Montserrat, sans-serif;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .swatch-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
    
    .byosb-tiles-container {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .byosb-container {
        margin: 10px;
        padding: 15px;
    }

    .byosb-tiles-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .byosb-tile {
        min-height: 150px;
        height: auto;
    }

    .swatch-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .swatch-pop-up-modal {
        padding: 32px !important;
    }

    .byosb-category-tabs {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .byosb-tiles-container {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .byosb-tile {
        height: auto;
        min-height: 180px;
    }
    
    .swatch-grid {
        grid-template-columns: 1fr;
        width: 100%;
        gap: 16px;
    }
    
    .swatch-price {
        font-size: 13px;
        margin: 6px 0 0 0;
    }
    
    .swatch-list {
        padding: 32px;
    }
    
    /* Mobile Responsive */
    
    .byosb-spinner {
        width: 32px;
        height: 32px;
        border-width: 3px;
    }
    
    .byosb-loading {
        padding: 40px 16px;
        font-size: 14px;
        min-height: 250px;
    }
    
    .swatch-pop-up-modal {
        padding: 16px !important;
    }
}

.d-none {
    display: none;
}