.product-detail {
    display: flex;
    max-width: 1000px;
    margin: 40px auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
    text-align: left;
}

.product-detail h1 {
    font-size: 28px;
    color: #333;
    margin-bottom: 15px;
}

.image-container {
    width: 400px;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.main-image {
    max-width: 100%;
    max-height: 100%;
    height: auto;
    width: auto;
    display: block;
    transition: transform 0.3s ease;
}

.main-image:hover {
    transform: scale(1.05);
}

.product-gallery {
    flex: 1;
    max-width: 45%;
    margin-right: 20px;
    position: relative;
}

.gallery {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.thumbnails-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    margin-top: 20px;
    overflow: hidden;
    max-width: 100%;
}

#prev-thumbs, #next-thumbs {
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 30px;
    padding: 10px;
    cursor: pointer;
    z-index: 1001;
    position: absolute;
    top: 60%;  /* Centrujemy strzałki w pionie */
    transform: translateY(-50%);  /* Dokładne centrowanie strzałek */
}


#prev-thumbs {
    left: 10px;
}


#next-thumbs {
    right: 10px;
}

.gallery-thumb {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 5px;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.gallery-thumb:hover {
    transform: scale(1.1);
}

.product-description {
    flex: 2;
    max-width: 55%;
}

.product-detail p {
    font-size: 18px;
    color: #000000;
    margin: 10px 0;
}

.product-detail .cart-quantity-input {
    width: 80px;
    height: 30px;
    padding: 5px 10px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 5px;
    outline: none;
    text-align: center;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.product-detail .cart-quantity-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
}

.product-detail .cart-quantity-input::-webkit-outer-spin-button,
.product-detail .cart-quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.product-detail button.addtocartbutton {
    background-color: #740000;
    color: white;
    font-size: 18px;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.product-detail button.addtocartbutton:hover {
    background-color: #b40000;
}

.product-detail button.backbutton {
    background-color: #e2ceb6;
    color: white;
    font-size: 18px;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.product-detail button.backbutton:hover {
    background-color: #ecd7be;
}

.product-detail a {
    display: inline-block;
    margin-top: 20px;
    font-size: 18px;
    color: #007bff;
    text-decoration: none;
    transition: color 0.3s;
}

.product-detail a:hover {
    color: #0056b3;
}

#lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
    z-index: 1002;
}

#lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    flex-direction: column;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: auto;
    height: auto;
    overflow: hidden;
}

#close-lightbox {
    position: fixed;
    top: 10%;
    right: 10px;
    font-size: 50px;
    color: white;
    cursor: pointer;
    z-index: 1002;
}

#close-lightbox:hover {
    color: red;
}

#lightbox-image {
    max-width: 90vw;
    max-height: 70vh;
    border-radius: 10px;
    box-shadow: 0px 4px 10px rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease;
}

#lightbox-image:hover {
    transform: scale(1.02);
}

#prev-image, #next-image {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    color: white;
    border: none;
    font-size: 40px;
    cursor: pointer;
    padding: 20px;
    transition: background 0.3s;
    z-index: 1002;
}

#prev-image {
    left: 0;
}

#next-image {
    right: 0;
}

#prev-image:hover, #next-image:hover {
    background: rgba(255, 255, 255, 0.6);
}

.lightbox-thumbnails {
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px;
    border-radius: 10px;
    width: 90%;
    overflow-x: auto;
    white-space: nowrap;
}

.lightbox-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border: 2px solid white;
    border-radius: 5px;
    cursor: pointer;
    transition: transform 0.3s ease, border 0.3s;
    margin: 5px;
    flex-shrink: 0;
}

.lightbox-thumb:hover {
    transform: scale(1.1);
    border-color: #ff9800;
}

.lightbox-thumb.active {
    border-color: #ff9800;
    transform: scale(1.15);
}

@media screen and (max-width: 860px) {
    .product-detail {
        flex-direction: column;
        width: 90%;
        padding: 15px;
    }

    .product-gallery {
        max-width: 100%;
        width: 100%;
        margin-right: 0;
    }

    .image-container {
        width: 100%;
        height: auto;
    }

    .main-image {
        max-width: 100%;
    }

    .product-description {
        max-width: 100%;
        width: 100%;
        margin-top: 20px;
    }

    .product-detail .cart-quantity-input{
        width: 100%;
    }

    .product-detail button.addtocartbutton {
        background-color: #740000;
        color: white;
        font-size: 18px;
        padding: 10px 20px;
        border: none;
        border-radius: 5px;
        cursor: pointer;
        transition: background-color 0.3s;
    }

    .product-detail button.addtocartbutton {
        width: 100%;
    }
    
    .product-detail button.backbutton {
        width: 100%;
    }
    
}
