.image-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

.image-grid img {
    width: 100%;
    height: 260px;
    object-fit: cover;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.product-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: #fff;
    border: 1px solid #eee;
    padding: 15px;
    border-radius: 10px;
}

.product-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 10px;
}

.product-card h3 {
    margin-top: 10px;
}

.product-card p {
    font-size: 14px;
    color: #555;
}

.product-card strong {
    margin-top: 5px;
}

.remove-item {
    padding: 12px 18px;
    border: none;
    border-radius: 10px;
    background: #111;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.remove-item:hover {
    background: #333;
    transform: translateY(-1px);
}

.main-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 10px;
}

.gallery-image {
    max-width: 90%;
    max-height: 70vh;
    border-radius: 10px;
}

.close {
    position: absolute;
    top: 20px;
    right: 25px;
    width: 48px;
    height: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 28px;
    color: white;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    z-index: 10001;
}

.close:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.gallery {
    display: none;
    position: fixed;
    inset: 0;
    min-height: 100vh;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.gallery.active {
    display: flex;
}

.view-btn {
    margin-top: 10px;
    padding: 10px;
    width: 100%;
    max-width: 200px;
    cursor: pointer;
}

.view-btn:hover {
    background: #333;
}

.product-card,
.image-wrapper,
.main-image {
    cursor: pointer;
}

.gallery * {
    pointer-events: none;
}

.gallery.active * {
    pointer-events: auto;
}

.slider {
    position: relative;
    display: block;
    width: 100%;
    max-width: 420px;
    aspect-ratio: 4 / 5;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 18px;
    background: #fff;
}

.slider-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.prev,
.next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    border: none;
    font-size: 22px;
    color: white;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    z-index: 10;
}

.prev {
    left: 12px;
}

.next {
    right: 12px;
}

.prev:hover,
.next:hover {
    background: rgba(255, 255, 255, 0.4);
}

.image-wrapper {
    position: relative;
    width: 100%;
}

.image-count {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 6px;
}

.image-wrapper img {
    transition: transform 0.2s ease;
}

.image-wrapper:hover img {
    transform: scale(1.03);
}

.loader {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 4px solid #ccc;
    border-top: 4px solid black;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    z-index: 10;
}

.product-modal {
    display: grid;
    grid-template-columns: minmax(280px, 420px) 1fr;
    gap: 40px;
    background: #fafafa;
    padding: 36px;
    border-radius: 24px;
    max-width: 980px;
    width: min(95%, 980px);
    align-items: start;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.18);
}

.modal-left {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-left .slider {
    width: 100%;
    max-width: 420px;
    position: relative;
}

.modal-right {
    display: flex;
    flex-direction: column;
    gap: 18px;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
}

.modal-right h2 {
    font-size: 34px;
    font-weight: 700;
    line-height: 1.1;
    margin: 0;
}

.price {
    font-size: 24px;
    font-weight: 700;
    color: #111;
    margin-bottom: 6px;
}

.description {
    color: #555;
    line-height: 1.8;
    font-size: 16px;
    margin: 0;
    max-width: 420px;
}

.quantity {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 140px;
    align-items: center;
    margin: 0 auto;
}

.quantity label {
    font-size: 14px;
    color: #444;
}

.quantity input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 16px;
    text-align: center;
}

.modal-recommendations {
    margin-top: 28px;
}

.modal-recommendations h3 {
    margin-bottom: 16px;
    font-size: 18px;
    color: #111;
}

.recommendation-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.recommendation-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 16px;
    padding: 10px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.recommendation-title {
    font-size: 14px;
    font-weight: 700;
}

.recommendation-price {
    color: #555;
    font-size: 13px;
}

.add-to-cart {
    width: fit-content;
    min-width: 150px;
    background: #111;
    color: #fff;
    padding: 12px 18px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    line-height: 1.3;
}

.add-to-cart.added {
    animation: cartJump 0.25s ease;
}

.add-to-cart:hover {
    background: #333;
    transform: translateY(-1px);
}

.sold-out-overlay {
    position: absolute;
    top: 62%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, .92);
    color: #111;
    padding: 5px 14px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, .15);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .12);
    z-index: 100;
    pointer-events: none;
    white-space: nowrap;
}

.sold-out-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 220px;
    margin: 0 auto;
    padding: 14px 24px;
    background: #fff;
    color: #111;
    border: 2px solid #111;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    cursor: not-allowed;
    opacity: 1;
}

.sold-out-btn:hover {
    background: #fff;
    color: #111;
    transform: none;
    box-shadow: none;
}

.sold-out-btn:disabled {
    pointer-events: none;
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

@keyframes cartJump {
    0% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-6px);
    }

    60% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(0);
    }
}