body { font-family:'Poppins', sans-serif; background: linear-gradient(180deg, #F5F0E8 0%, #E8E0D5 50%, #D4CEC3 100%); background-attachment: fixed; min-height: 100vh; margin:0; color:#333; }
.navbar { background:#fff; padding:24px 0; box-shadow:0 2px 8px rgba(0,0,0,0.08); position:sticky; top:0; z-index:1000; }
.navbar .container { max-width:1600px; margin:0 auto; display:flex; justify-content:space-between; align-items:center; padding:0 20px; }
.navbar .logo a { font-size:26px; font-weight:700; color:#222; text-decoration:none; letter-spacing:1px; }
.nav-links { list-style:none; display:flex; gap:25px; align-items:center; }
.nav-links a { text-decoration:none; color:#444; font-weight:600; position:relative; padding:5px 0; }
.nav-links a::after { content:''; position:absolute; left:0; bottom:-5px; width:0; height:3px; background:#f0c040; transition:width 0.3s ease; border-radius:2px; }
.nav-links a.active::after { width:100%; }
main.container { max-width:1400px !important; width: 100%; margin:80px auto 60px auto; background:#fff; padding:50px 30px 30px 30px; border-radius:12px; box-shadow:0 4px 12px rgba(0,0,0,0.1); position: relative; }
.product-wrapper { display:flex; gap:10px; flex-wrap: wrap; }
.product-image-container {
    flex: 0 0 50%;
    min-width: 240px;
    background: #f5f5f5;
    border-radius: 8px;
    display: flex; /* Ensure it's a flex container */
    align-items: center; /* Center content vertically */
    justify-content: center; /* Center content horizontally */
    padding: 0; /* Removed padding to ensure button positions relative to the container edges */
    height: 380px;
    position: relative; /* Needed for absolute positioning of the button */
    overflow: hidden; /* Hide anything that overflows, just in case */
}

#three-viewer-container {
    flex: 0 0 50%;
    min-width: 240px;
    background: #f5f5f5;
    border-radius: 8px;
    height: 380px; /* Default height for larger screens */
    display: flex; /* Ensure it's a flex container for centering */
    align-items: center; /* Center content vertically */
    justify-content: center; /* Center content horizontally */
    padding: 0; /* Align with product-image-container */
    position: relative; /* Needed for absolute positioning of the button */
    overflow: hidden; /* Hide anything that overflows */
}

/* Ensure image container stays properly sized when 3D is hidden */
.product-image-container {
    width: 100%;
}

.product-image { max-width:100%; max-height:100%; object-fit:contain; border-radius:4px; }

.view-3d-btn {
    position: absolute; /* Position relative to product-image-container */
    top: 15px; /* Position at top */
    right: 15px; /* Position at right */
    z-index: 15; /* Increased z-index to ensure it overlays other elements */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px; 
    background: #fff; /* White background */
    color: #4b2b2b; /* Brown text */
    border: 1px solid #ddd;
    border-radius: 25px; /* Pill-shaped */
    font-size: 13px; 
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.view-3d-btn:hover {
    background: #f5f5f5; /* Light gray on hover */
    border-color: #ccc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.view-3d-btn img {
    width: 16px;
    height: 16px;
}

.view-3d-btn i {
    font-size: 16px; /* Adjusted icon size */
}

.product-details { flex:1; display:flex; flex-direction:column; padding: 0; align-items: flex-start; margin-top: 20px; }
.product-title { font-size: 28px; font-weight: 700; margin-bottom: 15px; color: #4b2b2b; } /* Accent color */
.product-category { display:inline-block; background:#e8dcc8; padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: 600; margin-bottom: 20px; color: #5a3e3e; width: fit-content; } /* Accent color */
.product-description { margin-bottom:25px; color:#333; line-height:1.8; }
.see-more-btn { background:none; border:none; color:#4b2b2b; cursor:pointer; font-size:14px; padding:5px 0; text-decoration:underline; margin-top:5px; }
.see-more-btn:hover { color:#331f1f; }
.product-price { font-size:24px; font-weight:700; margin-bottom:15px; color:#000; }
.product-stock { display:flex; align-items:center; gap:10px; margin-bottom:25px; font-size:15px; }
.stock-indicator { height:12px; width:12px; border-radius:50%; background-color: #22c55e; } /* Default green, PHP will override */

.product-dimensions-table {
    margin-top: 20px;
    margin-bottom: 25px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden; /* Ensures border-radius applies to table content */
    overflow-x: auto; /* Allow horizontal scroll on small screens */
}

.product-dimensions-table table {
    width: 100%;
    min-width: 280px; /* Minimum width to prevent squishing */
    border-collapse: collapse;
}

.product-dimensions-table th,
.product-dimensions-table td {
    padding: 12px 15px;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
    white-space: nowrap; /* Prevent text wrapping */
}

.product-dimensions-table th {
    background-color: #f5f5f5;
    font-weight: 600;
    color: #4b2b2b;
    text-transform: uppercase;
    font-size: 13px;
}

.product-dimensions-table td {
    background-color: #fff;
    color: #333;
    font-size: 15px;
}

.product-dimensions-table tr:last-child td {
    border-bottom: none;
}

/* Mobile responsive styles for dimensions table */
@media (max-width: 600px) {
    .product-dimensions-table {
        margin-top: 15px;
        margin-bottom: 20px;
        border-radius: 6px;
        font-size: 12px;
    }
    
    .product-dimensions-table th,
    .product-dimensions-table td {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    .product-dimensions-table th {
        font-size: 10px;
    }
    
    .product-dimensions-table td {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .product-dimensions-table {
        margin-top: 12px;
        margin-bottom: 15px;
        border-radius: 4px;
    }
    
    .product-dimensions-table th,
    .product-dimensions-table td {
        padding: 6px 8px;
        font-size: 11px;
    }
    
    .product-dimensions-table th {
        font-size: 9px;
    }
    
    .product-dimensions-table td {
        font-size: 11px;
    }
}

.add-to-cart-form { display:flex; gap:10px; align-items:center; margin-bottom:10px; }
.quantity-input { width:60px; padding:8px 10px; border:1px solid #e0e0e0; border-radius:6px; font-size:14px; background:#f5f5f5; }
.add-to-cart-btn { 
    padding: 12px 25px; 
    background:#4b2b2b; 
    color:#fff; 
    border: 2px solid #4b2b2b;
    border-radius: 50px; /* Circular border */
    font-weight:600; 
    cursor:pointer; 
    transition:all 0.3s; 
    display:flex; 
    align-items:center; 
    gap:8px; 
    font-size:14px; 
}
.add-to-cart-btn:hover { 
    background:#fff; 
    color:#4b2b2b; 
    transform:translateY(-2px); 
    box-shadow:0 4px 8px rgba(0,0,0,0.15); 
}

#success-message { display:none; color:#22c55e; font-weight:bold; margin-top:10px; }
#verify-warning { display:none; color:#ef4444; font-weight:600; margin-top:10px; }

@media(max-width:900px) {
    .product-wrapper{ flex-direction:column; gap:10px; }
    .product-image-container{ height:350px; flex: 0 0 auto; width: 100%; }
    #three-viewer-container{ height:350px; flex: 0 0 auto; width: 100%; } /* Match product-image-container */
    .add-to-cart-form{ flex-direction:row; align-items:center; gap:10px; }
    .quantity-input{ width:80px; }
    .add-to-cart-btn{ padding:10px 18px; font-size:13px; }
}
@media(max-width:600px){
    .container{ margin:20px auto; border-radius:8px; }
    .product-wrapper{ padding:20px; }
    .product-image-container{ height:280px; padding:15px; flex: 0 0 auto; width: 100%; }
    #three-viewer-container{ height:280px; padding:15px; flex: 0 0 auto; width: 100%; } /* Match product-image-container */
    .product-title{ font-size:24px; }
    .view-3d-btn {
        padding: 7px 12px;
        font-size: 11px;
    }
    .view-3d-btn img {
        width: 12px;
        height: 12px;
    }
    .view-3d-btn i {
        font-size: 12px;
    }
}

.back-button {
    position: absolute;
    top: 10px;
    left: 15px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: none;
    color: #4b2b2b;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    z-index: 10;
}

.back-button:hover {
    background: none;
    color: #331f1f; /* Darker shade on hover */
    transform: translateY(-2px);
    /* Removed box-shadow as there's no background */
}

.back-button i {
    font-size: 18px;
}

@media(max-width:480px) {
    .container {
        margin: 65px auto 15px auto; /* Adjusted top margin to lessen space, just above navbar height */
        padding: 20px;
    }

    .product-wrapper {
        gap: 8px;
    }

    .product-image-container,
    #three-viewer-container {
        height: 200px !important;
        min-height: 200px !important;
        padding: 10px;
        flex: 0 0 auto;
        width: 100%;
    }

    .product-title {
        font-size: 22px;
        margin-bottom: 10px;
    }

    .product-category {
        font-size: 12px; /* Adjusted from 1px to a readable size for mobile */
        padding: 5px 10px;
        margin-bottom: 15px;
    }

    .product-description {
        margin-bottom: 20px;
        font-size: 14px;
    }

    .product-price {
        font-size: 22px;
        margin-bottom: 15px;
    }

    .product-stock {
        margin-bottom: 20px;
        font-size: 14px;
    }

    .add-to-cart-form {
        gap: 10px;
        margin-bottom: 10px;
    }

    .quantity-input {
        padding: 8px 10px;
        font-size: 14px;
        width: 70px;
    }

    .add-to-cart-btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    .view-3d-btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    .view-3d-btn i {
        font-size: 12px;
    }

    .view-3d-btn img {
        width: 10px;
        height: 10px;
    }

    #success-message, #verify-warning {
        font-size: 14px;
    }

    .back-button {
        /* Ensure visibility and correct positioning on small screens */
        position: absolute;
        top: 10px;
        left: 10px;
        display: inline-flex;
        padding: 6px 12px;
        z-index: 10;
    }
}

/* You Might Also Like Section */
.you-might-like-section {
    margin-top: 60px;
    margin-bottom: 40px;
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid #e5e5e5;
}

.you-might-like-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.you-might-like-section h2 {
    font-size: 26px;
    font-weight: 600;
    color: #333;
    margin: 0;
    padding-bottom: 10px;
    border-bottom: 4px solid #4b2b2b;
    display: inline-block;
}

.you-might-like-section .see-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 15px;
    background: transparent;
    color: #4b2b2b;
    border: none;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: color 0.3s ease;
}

.you-might-like-section .see-all-btn::after {
    content: '>';
    font-weight: 700;
}

.you-might-like-section .see-all-btn:hover {
    color: #331f1f;
}

.also-like-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-top: 30px;
}

.also-like-item {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 12px;
    overflow: hidden;
}

.also-like-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.also-like-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.also-like-item-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.also-like-item-info h4 {
    font-size: 0.85rem;
    font-weight: 500;
    margin: 0 0 6px 0;
    min-height: 36px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-align: left;
}

.also-like-item-info .price {
    font-weight: 600;
    font-size: 0.9rem;
    color: #4A2C2A;
    text-align: left;
    margin-top: auto;
}

/* Responsive adjustments for "You Might Also Like" section */
@media (max-width: 1400px) {
    .also-like-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1200px) {
    .also-like-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .also-like-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .also-like-item img {
        height: 150px;
    }
}

@media (max-width: 600px) {
    .you-might-like-section h2 {
        font-size: 20px;
    }
    .also-like-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .also-like-item img {
        height: 120px;
    }
    .also-like-item-info {
        padding: 8px;
    }
    .also-like-item-info h4 {
        font-size: 0.75rem;
    }
    .also-like-item-info .price {
        font-size: 0.85rem;
    }
}
