/* --- Global Box Sizing Fix --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Product Details Container */
.product-details {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    text-align: left;
    max-width: 900px;
    margin: 50px auto;
    background: #fff;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

/* Product Image */
.product-details img {
    width: 50%;
    max-width: 100%;
    height: auto;
    object-fit: cover;
    overflow: auto;
    border-right: 1px solid #ddd;
}

/* Product Nav */
.product-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin: 5px 0;
}

/* Prev + Next Buttons */
.prev-btn,
.next-btn {
    background: white;
    color: black;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 5px;
    border: 1px solid gray;
    flex-shrink: 0; /* prevent shrinking but allow wrapping */
}

.prev-btn {
    padding-left: 20px;   /* reduced extra padding */
}

.next-btn {
    padding-right: 20px;  /* reduced extra padding */
}

/* Mobile responsive */
@media (max-width: 600px) {
    .product-nav {
        flex-direction: column;
        align-items: stretch;
    }

    .product-nav a {
        width: 100%;
        text-align: center;
    }
}

/* Mobile View */
@media (max-width: 768px) {
    .product-details {
        flex-direction: column;
        text-align: center;
    }

    .product-details img {
        width: 100%;
        border-right: none;
    }
}

/* Product Information */
.details {
    padding: 20px;
    flex: 1;
    min-width: 0; /* allow text to shrink inside flex */
}

.details h1 {
    font-size: 28px;
    margin-bottom: 10px;
    color: #222;
}

.details p {
    font-size: 16px;
    margin-bottom: 10px;
    color: #666;
}

/* Quantity Selection */
.quantity {
    display: flex;
    align-items: center;
    margin: 15px 0;
    justify-content: center;
    text-align: center;
    flex-wrap: wrap; /* prevent overflow on small screens */
}

.quantity button {
    background: #007BFF;
    border: none;
    color: white;
    font-size: 18px;
    padding: 10px;
    width: 40px;
    cursor: pointer;
    border-radius: 5px;
    transition: 0.3s;
}

.quantity button:hover {
    background: #0056b3;
}

.quantity input {
    width: 50px;
    text-align: center;
    font-size: 18px;
    padding: 5px;
    margin: 0 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* Common Button Styles */
.add-to-cart,
.checkout-btn,
.read-preview-btn,
.download-pdf-btn {
    color: white;
    border: none;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    cursor: pointer;
    border-radius: 5px;
    transition: 0.3s;
    margin: 10px 2px;
    flex-shrink: 0;
}

/* Individual Button Variants */
.add-to-cart {
    background: #28a745;
    padding: 12px 20px;
}
.add-to-cart:hover {
    background: #218838;
}

.checkout-btn {
    background: blueviolet;
    padding: 10px 20px;
}
.checkout-btn:hover {
    background-color: #218838;
}

.read-preview-btn {
    background: linear-gradient(135deg, #FFA500, #FFD700);
    padding: 12px 24px;
    font-weight: bold;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(255, 165, 0, 0.3);
}
.read-preview-btn:hover {
    background: linear-gradient(135deg, #FF8C00, #FFC400);
    box-shadow: 0 6px 12px rgba(255, 165, 0, 0.4);
    transform: translateY(-2px);
}

.download-pdf-btn {
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    padding: 12px 24px;
    font-weight: bold;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}
.download-pdf-btn:hover {
    background: linear-gradient(135deg, #45a049, #1B5E20);
    box-shadow: 0 6px 12px rgba(76, 175, 80, 0.4);
    transform: translateY(-2px);
}

/* Back Button */
.back-btn {
    display: inline-block;
    text-align: center;
    margin-top: 10px;
    color: #007BFF;
    text-decoration: none;
    font-size: 16px;
}
.back-btn:hover {
    text-decoration: underline;
}

/* Responsive Adjustments */
@media (max-width: 600px) {
    .details h1 {
        font-size: 24px;
    }
    .details p {
        font-size: 14px;
    }
    .quantity button {
        width: 35px;
        font-size: 16px;
    }
    .add-to-cart {
        font-size: 14px;
        padding: 10px 15px;
    }
}

/* Modal */
.preview-modal {
    display: none;
    position: fixed;
    z-index: 1004;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.95);
    pointer-events: auto;
}

body.modal-open {
    overflow: hidden;
}

.preview-modal-content {
    position: relative;
    background-color: #fefefe;
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    box-shadow: none;
    overflow-x: hidden; /* prevent horizontal scroll */
}

/* Preview Close Button */
.preview-close {
    position: absolute;
    top: 20px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle at 30% 30%, #ff4b5c, #ff6f91);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1004;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4), 0 0 10px rgba(255, 75, 92, 0.5);
    transition: all 0.3s ease;
}

.preview-close::before,
.preview-close::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 28px;
    background-color: #fff;
    border-radius: 2px;
}
.preview-close::before { transform: rotate(45deg); }
.preview-close::after  { transform: rotate(-45deg); }

.preview-close:hover,
.preview-close:focus {
    transform: scale(1.3) rotate(90deg);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5), 0 0 15px rgba(255, 75, 92, 0.7);
    background: radial-gradient(circle at 30% 30%, #ff6b7d, #ff9aa2);
}

#previewFrame {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0;
}



.details-info {
    max-width: 750px;
    margin: 40px auto;
    background: #ffffff;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    padding: 30px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    transition: transform 0.3s, box-shadow 0.3s;
}

/* Hover Effect */
.details-info:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.15);
}

/* Title */
.details-info h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: #222;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

/* Description */
.details-info .description {
    font-size: 16px;
    color: #555;
    margin-bottom: 20px;
}

/* Price Section */
.details-info .price {
    font-size: 18px;
    font-weight: 700;
    color: #007bff;
    margin-bottom: 15px;
}

/* PDF Section */
.details-info .pdf {
    font-size: 16px;
    color: #d9534f;
    font-weight: 600;
    margin-bottom: 15px;
}

/* Stock Section */
.details-info .stock {
    font-size: 16px;
    margin-bottom: 15px;
}

.details-info .stock.out-of-stock {
    color: #d9534f;
    font-weight: 600;
}

/* User Note */
.details-info .user-id {
    font-size: 13px;
    font-style: italic;
    color: red;
    border-top: 1px dashed #ddd;
    padding-top: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .details-info {
        padding: 20px;
        margin: 20px 15px;
    }
    .details-info h1 {
        font-size: 1.8rem;
    }
    .details-info .price, 
    .details-info .pdf,
    .details-info .stock {
        font-size: 16px;
    }
}