* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

#all {
    display: flex;
    flex-direction: column;
    background-color: #f4f4ec;
    max-width: 1500px;
    margin: 0 auto;
    padding-bottom: 30px;
}

.header {
    font-size: 2rem;
    margin-top: 60px;
    padding-left: 30px;
    width: 100%;
}

.cont {
    display: grid;
    margin: 20px auto;
    width: 100%;
    box-shadow: 0 4px 16px rgb(0, 0, 0, 0.02);
    grid-template-columns: 2fr 1.1fr;
    padding: 30px;
    gap: 25px;
}

.pro3dview {
    position: relative;
    box-shadow: 0 4px 16px rgb(0, 0, 0, 0.02);
}

#d3view {
    width: 100%;
    height: 100%;
    display: block;
    background-color: #cfcfcf;
    border: 2px solid #810fd8;
    border-radius: 15px;
}

#viewer-container {
    position: relative;
    width: 100%;
    height: 500px;   /* your viewer height */
}

#viewer-loading {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);   /* fade overlay */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
    border-radius: 15px;
    width: 99.5%;
    height: 99.3%;
}

#viewer-loading img {
    width: 80px;
    height: 80px;
}

.controls {
    display: flex;
    flex-direction: row;
    justify-content: center;
}

.controls button {
    padding: 10px 15px;
    background-color: rgb(134, 189, 209);
    border: none;
    border-radius: 8px;
    margin-top: 10px;
    margin-left: 10px;
}

#infobox {
    position: absolute;
    top: 15px;    /* Distance from top edge */
    right: 15px;  /* Distance from right edge */
    height: fit-content;
    z-index: 10;  /* High Z-index to ensure it sits on top of the canvas */
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* Ensures the dropdown aligns to the right */
}

#infobtn {
    display: block;
    position: relative; /* Changed from absolute */
    cursor: pointer;
    /* Removed bottom/right properties as the parent #infobox handles position */
}

#infobtn img {
    width: 40px; /* Adjusted slightly for better proportion */
    padding: 0;  /* Removed padding to make sizing predictable */
    display: block;
}

#info {
    display: none;
    flex-direction: column;
    list-style-type: none;
    padding: 15px;
    width: 280px; /* Give it a fixed width so it doesn't squash */
    
    /* Position relative to #infobox */
    position: absolute;
    top: 100%;    /* Pushes it directly below the button */
    right: 0;     /* Aligns it to the right edge of the button */
    margin-top: 10px; /* Small gap between button and box */
    
    background-color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 14px;
    transition: 0.3s display ease;
    z-index: 11;
}

#info li {
    margin-bottom: 8px;
    font-size: 1rem;
    font-weight: 500;
    color: #444;
}

#infobtn:hover + #info {
  display: flex; /* Changed from block to flex to match your flex-direction settings */
}

.right {
    display: flex;
    justify-content: center;
    width: 100%;
}

.product-card-ri {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    height: fit-content;
    width: 100%;
}

.product-card-ri h2 {
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
}

.purple {
    color: #810fd8;
}

.edition {
    color: #777;
    font-size: 0.9rem;
    margin-bottom: 1.2rem;
}

.price {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.desc {
    color: #444;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.colors {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 1.5rem;
}

.color-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #000000;
}

.color-dot.selected {
    border-color: #6b46ff;
    box-shadow: 0 0 6px rgba(107, 70, 255, 0.4);
    transform: scale(1.1);
}

.mesh-name {
    font-size: 18px;
    font-weight: 500;
}

.colors div {
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.category-info {
    margin-bottom: 10px;
}

.sizes {
    display: flex;
    gap: 10px;
    margin-bottom: 1.5rem;
}

.size-btn {
    flex: 1;
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid #ccc;
    cursor: pointer;
    background: #fff;
    font-weight: 500;
}

.size-btn.active {
    background: #6b46ff;
    color: white;
    border-color: #6b46ff;
}

ul.features {
    margin: 1rem 0;
    padding-left: 1.2rem;
}

ul.features li {
    margin-bottom: 0.5rem;
}

.viewed {
    color: #777;
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.inlineicons {
    width: 20px;
}

.add-cart {
    display: block;
    width: 100%;
    padding: 0.8rem;
    background: #6b46ff;
    color: white;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
}

.add-cart:hover {
    background: #5938d1;
}

h2 {
    font-weight: 500;
    letter-spacing: 2px;
    font-size: 2rem;
    color: #555;
    margin-bottom: 1.5rem;
}

.section {
    margin: 20px 30px 30px 30px;
}

/* --- UPDATED GRID SECTION --- */

.product-grid {
    display: grid;
    /* CHANGE 1: Use auto-fill so items don't stretch to infinity */
    /* CHANGE 2: Reduced min-width to 260px for a standard, sharp card look */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px; /* Increased gap for better breathing room */
    width: 100%;
}

.product-card {
    background: #fff; /* Ensure it has a background */
    text-align: left;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid transparent; /* Prevents layout jump on hover */
}

.product-card:hover {
    transform: translateY(-5px); /* Lift effect */
    box-shadow: 0 10px 20px rgba(0,0,0,0.08); /* Soft shadow */
    background-color: #fff; /* Keep white on hover */
    border-color: #eee;
}

.product-card a {
    text-decoration: none;
    color: #555;
    display: flex;        /* Makes the link fill the card */
    flex-direction: column;
    height: 100%;
}

/* IMAGE HANDLING */
img.product-image {
    width: 100%;
    height: 280px;
    object-fit: cover; /* CRITICAL: Prevents image distortion/stretching */
    background: #f4f4f4;
    display: block;
    margin-bottom: 0; /* Remove gap between image and text */
}

/* Fallback for div.product-image (when no image exists) */
div.product-image {
    width: 100%;
    height: 280px;
    background: #f4f4f4;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* TEXT STYLING */
.product-name {
    font-size: 1rem;
    margin: 15px 15px 5px 15px; /* Add padding inside the card */
    font-weight: 600;
    color: #333;
    line-height: 1.4;
}

.product-price {
    color: #810fd8;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 15px 15px 15px; /* Add padding inside the card */
}
#trustlux {
    display: flex;
    flex-direction: column;
    background-color: #F9F3F7;
    padding: 30px 0px;
    align-items: center;
}

#trustlux h2 {
    margin: 20px 0;
    font-size: 3rem;
}

#trustlux p {
    font-size: 1.3rem;
    margin-bottom: 70px;
    text-align: center;
}

#services {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    width: 80%;
    justify-items: center;
    align-items: center;
}

.indservice {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.serviceicons {
    width: 60px;
    border-radius: 50%;
    padding: 10px;
    background-color: #EFD8EE;
    margin-bottom: 20px;
}

.indservice p {
    font-size: 1.15rem;
    margin-bottom: 40px;
    text-align: center;
}


/* --- MOBILE RESPONSIVENESS --- */
@media only screen and (max-width: 900px) {
    
    /* 1. HEADER FIX */
    .header {
        margin-top: 20px;
        padding-left: 20px;
        text-align: center;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }

    /* 2. MAIN CONTAINER STACK */
    .cont {
        display: flex;
        flex-direction: column;
        padding: 15px;
        gap: 20px;
    }

    /* 3. 3D VIEWER (4:3 Ratio approx) */
    .pro3dview {
        width: 100%;
        padding: 0;
        border: none;
        box-shadow: none;
        background: transparent;
    }

    #viewer-container {
        height: 350px; /* Adjusted for mobile */
        border-radius: 15px;
        overflow: hidden;
    }

    #d3view {
        border-width: 1px;
    }

    /* Controls: Compact & Wrapped */
    .controls {
        gap: 8px;
        overflow: scroll;
    }

    .controls button {
        padding: 8px 12px;
        font-size: 12px;
        flex: 1 1 auto; /* Grow to fill space */
    }

    /* Info Box */
    #infobox {
        top: 10px;
        right: 10px;
    }
    
    #infobtn img {
        width: 30px;
    }

    /* 4. RIGHT PANEL (Details) */
    .product-card-ri {
        padding: 20px;
        width: 100%;
        margin-top: 10px;
    }
    
    .product-card-ri h2 {
        font-size: 1.5rem;
    }

    /* 5. PERFECT PARTNER / KEEP EXPLORING (2 Columns) */
    .section {
        margin: 20px 15px 40px 15px;
    }
    
    .section h2 {
        font-size: 1.5rem;
        text-align: center;
    }

    .product-grid {
        grid-template-columns: 1fr 1fr; /* Force 2 columns */
        gap: 15px;
    }

    .product-card {
        height: 250px;
        min-width: 0;
    }

    .product-image {
        height: 140px; /* Smaller image height */
    }

    .product-name {
        font-size: 0.9rem;
        margin: 8px 10px;
    }
    
    .product-price {
        font-size: 1rem;
        margin: 0 10px 10px;
    }

    /* 6. TRUST LUXA STACK */
    #services {
        grid-template-columns: 1fr;
        gap: 30px;
        width: 100%;
        padding: 0 20px;
    }

    #trustlux h2 {
        font-size: 2rem;
    }
    
    #trustlux p {
        font-size: 1rem;
        padding: 0 20px;
    }
}
