/* Optimized Product Page CSS */

.product.type-product {
    display: flex;
    flex-wrap: wrap;
}

.product-images {
    flex: 0 0 50%;
    max-width: 50%;
    padding-right: 15px;
}

.woocommerce .normal-product-gallery .woocommerce-product-gallery {
    width: 100% !important;
}

.summary.entry-summary {
    padding-left: 15px;
}

.single-product div.product form.cart {
    display: block !important;
}

.wallpaper-product-customizer,
.wallpaper-customization {
    margin-bottom: 30px;
}

/* Image Container */
.wallpaper-image-container {
    position: relative;
    margin-bottom: 30px;
}

.wallpaper-gallery-section .wallpaper-cropper>img.wallpaper-image.cropper-hidden {
    display: none !important;
}

img.wallpaper-image.cropper-hidden {
    display: none !important;
}

.wallpaper-cropper {
    max-width: 100%;
    overflow: hidden;
    /*background: #f7f7f7;*/
    border: 1px solid #ddd;
    border-radius: 4px;
}

.wallpaper-image {
    max-width: 100%;
    display: block;
}

.cropper-container {
    touch-action: none !important;
}

.wallpaper-image-container {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Cart Button */
.single_add_to_cart_button {
    margin-top: 20px;
    width: 100%;
}

/* Measurement Container */
.wallpaper-measurements {
    margin: 0;
    border-radius: 4px;
}

.wallpaper-measurements h3 {
    margin: 0 0 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
    font-size: 18px;
    color: #333;
    font-weight: 600;
}

/* Measurement System */
.measurement-system {
    margin-bottom: 20px;
}

.measurement-system > label,
.system-label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
    color: #333;
}

.measurement-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.measurement-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.measurement-options input[type="radio"] {
    margin: 0;
}

/* Measurement Fields */
.measurement-fields {
    margin-top: 10px;
}

.field-group {
    margin-bottom: 15px;
}

.field-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #444;
}

.field-group input[type="number"] {
    width: 100px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Feet & Inches Layout */
.feet_inches-inputs {
    display: flex;
    gap: 15px;
    align-items: center;
}

.feet-input,
.inches-input {
    display: flex;
    align-items: center;
    gap: 5px;
}

.feet-input input,
.inches-input input {
    width: 80px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.unit {
    color: #666;
    font-size: 0.9em;
}

/* Mirror Effect */
.mirror-effect {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
}

.mirror-effect label {
    display: flex;
    align-items: center;
    gap: 8px;
    /*cursor: pointer;*/
}

.mirror-effect input[type="checkbox"] {
    margin: 0;
}

/* Cropper Controls */
.cropper-container {
    max-width: 100%;
    margin: 0 auto;
    /*background: #f5f5f5;*/
}

.cropper-controls {
    margin: 10px 0;
    text-align: center;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.cropper-controls button {
    padding: 8px 12px;
    /*background: #f0f0f0;*/
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cropper-controls button:hover {
    background: #e0e0e0;
}

.cropper-view-box {
    outline: 2px solid #fff;
    outline-color: rgba(255, 255, 255, 0.75);
}

.cropper-line {
    background-color: rgba(255, 255, 255, 0.75);
}

.cropper-point {
    background-color: #fff;
    width: 8px;
    height: 8px;
}

/* Error States */
.measurement-field input.error,
.field-group input.error {
    border-color: #dc3545;
    background-color: #fff8f8;
}

.error-message {
    color: #dc3545;
    font-size: 14px;
    margin-top: 4px;
}

/* Loading States */
.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.wallpaper-measurements.loading {
    position: relative;
    opacity: 0.7;
}

.wallpaper-measurements.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.5);
    cursor: wait;
}

/* Preview Button */
.wallpaper-preview-button {
    background: #f7f7f7;
    border: 1px solid #ddd;
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.wallpaper-preview-button:hover {
    background: #eee;
    border-color: #ccc;
}

/* Modal */
.wallpaper-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 999999;
    display: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.wallpaper-modal.show {
    background-color: rgba(0,0,0,0.75);
    opacity: 1;
    visibility: visible;
    overflow: hidden;
}

.wallpaper-modal-content {
    position: relative;
    /*background: #fff;*/
    margin: 5% auto;
    padding: 24px;
    width: 90%;
    max-width: 800px;
    border-radius: 8px;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    max-height: 90vh;
    height: 100%;
    overflow: auto;
}

.wallpaper-modal .wallpaper-modal-content {
    transform: translateY(0);
}


/* Cart Item Styles */
.woocommerce-cart-form .product-name dl.variation {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.woocommerce-cart-form .product-name dl.variation dt {
    float: left;
    clear: left;
    margin-right: 8px;
    font-weight: 600;
    color: #333;
}

.woocommerce-cart-form .product-name dl.variation dd {
    margin-bottom: 8px;
    color: #666;
}

/* Animations */
@keyframes spin {
    to { transform: rotate(360deg); }
}


/* Print Styles */
@media print {
    .wallpaper-measurements {
        border: none;
        padding: 0;
        box-shadow: none;
    }

    .wallpaper-preview-button,
    .wallpaper-modal,
    .single_add_to_cart_button,
    .cropper-controls {
        display: none !important;
    }
}

/* Price and Material Display */
.price-value, .total-price-value, .area-value {
    transition: all 0.2s ease-in-out;
}

.material-price-display {
    margin-bottom: 15px;
}

.hide-larger-price .pricing-info .price {
    visibility: visible;
    word-spacing: normal;
}
.pricing-info, .pricing-info .area-display {
    font-size: 1.25rem;
}
.pricing-info .price-per-unit {
    font-weight: bold;
    font-size: 1.2em;
}
.pricing-info .total-price-display {
    margin: 0;
}

.total-price-display {
    font-size: 1.2rem;
    font-weight: bold;
    /*margin-top: 15px;*/
}

.material-info-button {
    background: none;
    border: none;
    padding: 0;
    margin-left: 8px;
    cursor: pointer;
    vertical-align: middle;
    color: #666;
}

.material-info-button:hover {
    color: #333;
}

.material-types-popup {
    padding: 20px;
}

.material-types-popup .popup-header {
    margin-bottom: 10px;
    text-align: center;
}

.material-types-popup .popup-header h2 {
    font-size: 2rem;
    line-height: 1.7;
    font-weight: 600;
    margin: 0;
    padding: 0;
}

.materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    /* margin-top: 20px; */
}

.wallpaper-modal.show .material-card {
    opacity: 1;
    transform: translateY(0);
}

.material-card:nth-child(1) { transition-delay: 0.1s; }
.material-card:nth-child(2) { transition-delay: 0.2s; }
.material-card:nth-child(3) { transition-delay: 0.3s; }
.material-card:nth-child(4) { transition-delay: 0.4s; }



.wallpaper-modal-content::-webkit-scrollbar {
    width: 8px;
}
.wallpaper-modal-content::-webkit-scrollbar-track {
    box-shadow: inset 0 0 5px grey; 
    border-radius: 5px;
}
.wallpaper-modal-content::-webkit-scrollbar-thumb {
    background: #333; 
    border-radius: 5px;
}
.wallpaper-modal-content::-webkit-scrollbar-thumb:hover {
    background: #b30000; 
}

/* Add these styles */
.materials-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    gap: 20px;
    /* padding: 20px 0; */
    scroll-behavior: smooth;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.materials-grid::-webkit-scrollbar {
    display: none;
}


.material-card .material-title {
    font-size: 18px;
    margin-bottom: 15px;
    justify-content: center;
}

.material-card .material-image {
    aspect-ratio: 1/1;
    overflow: hidden;
    margin-bottom: 15px;
}

.material-card .material-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.material-card .material-description {
    font-size: 1rem;
    line-height: 1.5;
    color: #444;
    min-height: 170px;
}

/* Add navigation buttons */
.materials-navigation {
    display: flex;
    justify-content: space-between;
    position: absolute;
    top: 50%;
    left: -15px;
    right: -15px;
    transform: translateY(-50%);
    pointer-events: none;
}

.nav-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    /*background: white;*/
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-button:hover {
    background: #f5f5f5;
}


/* Update the modal and grid styles */
.wallpaper-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999999;
}

.wallpaper-modal-content {
    position: relative;
    width: 90%;
    max-width: 1200px; /* Increased to show 4 cards properly */
    margin: 40px auto;
    /*background: white;*/
    border-radius: 8px;
    padding: 30px;
}

.material-types-popup {
    position: relative;
}

.popup-header {
    text-align: center;
    margin-bottom: 30px;
}

.popup-header h2 {
    font-size: 24px;
    margin: 0;
}

/* Close button */
.wallpaper-modal button.wallpaper-modal-close {
    position: absolute;
    right: 10px;
    top: 10px;
    border: none;
    font-size: 24px;
    cursor: pointer;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    background-color: transparent;
    color: #FFF;
}

.wallpaper-modal button.wallpaper-modal-close:hover {
    /*background-color: #ccc;*/
    color: #cf1717;
    color: #606060;
}

/* Materials grid with draggable scroll */
.materials-wrapper {
    position: relative;
    overflow: hidden;
    padding: 0 20px;
}

.materials-grid {
    display: flex;
    gap: 20px;
    user-select: none;
    cursor: grab;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.materials-grid::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

.materials-grid.dragging {
    cursor: grabbing;
    scroll-behavior: auto;
}

.material-card .material-title {
    font-size: 18px;
    margin-bottom: 15px;
}

.material-card .material-image {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 4px;
    margin-bottom: 15px;
}

.materials-grid {
    display: flex;
    gap: 20px;
    user-select: none;
    cursor: grab;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 20px 0;
    transition: all 0.2s ease;
}

.materials-grid.dragging {
    cursor: grabbing;
    scale: 0.98;
}

.material-card {
    flex: 0 0 calc(25% - 15px);
    /*min-width: 280px;*/
    /*background: white;*/
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px;
    transition: transform 0.2s ease;
    user-select: none;
    -webkit-user-drag: none;
    scroll-snap-align: start;
}

.dragging .material-card {
    transform: scale(1.02);
}

.materials-wrapper {
    position: relative;
    overflow: hidden;
    padding: 0 20px;
}

.materials-grid {
    display: flex;
    gap: 20px;
    touch-action: pan-y pinch-zoom;
    cursor: grab;
    will-change: transform;
}

.materials-grid:active {
    cursor: grabbing;
}

/* Smooth transition for cards */
.material-card {
    transition: transform 0.2s ease;
}

.material-card:hover {
    transform: translateY(-2px);
}

/* Hide scrollbar */
.materials-wrapper {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.materials-wrapper::-webkit-scrollbar {
    display: none;
}
.woocommerce-mini-cart .wallpaper-preview-button-wrap {
    display: none;
}

/* Preview Link Styles */
.wallpaper-preview-link-wrap {
    margin: 15px 0;
}

.wallpaper-preview-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid #e4e4e4;
    border-radius: 4px;
    color: #666;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s ease;
    background: transparent;
}

.wallpaper-preview-link:hover {
    /*background-color: #f9f9f9;*/
    text-decoration: none;
    color: #666;
}

.wallpaper-preview-link .preview-icon {
    width: 16px;
    height: 16px;
    color: currentColor;
}

.wallpaper-preview-link .button-text {
    font-weight: 400;
    letter-spacing: 0.2px;
}

/* Adjust position in cart layout */
.cart_item .product-name {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Position right after product details */
.cart_item .variation {
    margin-bottom: 8px;
}

.croper_main_image-txt {
    padding: 5px 0px;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.croper_main_image-txt .icon {
    margin-right: 8px;
}






/* Responsive Design */
@media (max-width: 768px) {
    .wallpaper-preview-link {
        width: 100%;
        justify-content: center;
    }

    .product-images,
    .summary.entry-summary {
        flex: 0 0 100%;
        max-width: 100%;
        padding: 0;
    }

    .feet_inches-inputs {
        /* flex-direction: column; */
        gap: 12px;
    }

    .feet-input input,
    .inches-input input {
        width: 100%;
        max-width: 120px;
    }

    .wallpaper-modal-content {
        width: 95%;
        margin: 15px auto;
        padding: 10px;
        height: auto;
    }

    .wallpaper-preview-button,
    .single_add_to_cart_button {
        width: 100%;
        justify-content: center;
    }

    .cropper-controls {
        flex-wrap: wrap;
    }

    .cropper-controls button {
        flex: 1 1 auto;
        min-width: 120px;
    }

    .material-types-popup {
        padding: 0px;
    }

    .material-types-popup .popup-header{
        margin: 0;
    }

    .materials-wrapper {
        padding: 0 35px;
    }

    .wallpaper-modal button.wallpaper-modal-close {
        width: 35px;
        height: 35px;
    }

    .material-card .material-description {
        min-height: auto;
    }
}
