@media (max-width: 768px) {
    .gallery {
        align-items: flex-start;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 20px 0;
    }

    .product-modal {
        display: grid;
        grid-template-columns: 1fr;
        width: 92%;
        max-width: 92%;
        padding: 18px;
        gap: 18px;
        margin: 70px auto 30px;
        max-height: none;
        overflow: visible;
        border-radius: 20px;
        flex-direction: column;
        position: relative;
    }

    .modal-left {
        width: 100%;
    }

    .modal-left .slider {
        width: 100%;
        max-width: 100%;
        aspect-ratio: 1 / 1.05;
        border-radius: 16px;
        overflow: hidden;
    }

    .slider-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
        max-height: 350px;
        border-radius: 12px;
    }

    .modal-right {
        width: 100%;
        gap: 12px;
        align-items: stretch;
        text-align: left;
    }

    .modal-right h2 {
        font-size: 24px;
        line-height: 1.15;
    }

    .price {
        font-size: 20px;
    }

    .description {
        font-size: 14px;
        line-height: 1.6;
        max-width: 100%;
    }

    .quantity {
        width: 100%;
        align-items: flex-start;
    }

    .quantity input {
        width: 90px;
    }

    .add-to-cart {
        width: 100%;
        min-width: unset;
        padding: 14px;
    }

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

    .recommendation-card {
        display: flex;
        flex-direction: column;
        align-items: center;
        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;
        width: 100%;
    }

    .recommendation-title {
        min-height: 56px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .recommendation-price {
        margin-top: auto;
    }

    .recommendation-card img {
        width: 100%;
        aspect-ratio: 1 / 1;
        object-fit: cover;
        border-radius: 8px;
        display: block;
    }

    .close {
        width: 48px;
        height: 48px;
        font-size: 32px;
        top: 10px;
        right: 10px;
    }

    .prev,
    .next {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .prev {
        left: 2px;
    }

    .next {
        right: 2px;
    }

    .product-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
        width: 100%;
        display: grid !important;
    }

    .product-card {
        width: 100%;
        max-width: 100%;
        padding: 15px;
    }

    .product-card img {
        height: 200px;
    }

    .product-card h3 {
        font-size: 18px;
    }

    .product-card p {
        font-size: 13px;
    }

    .view-btn {
        max-width: 100%;
    }

    .cart-item {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .cart-item-actions {
        align-items: flex-start;
        gap: 12px;
    }

    .cart-summary {
        flex-direction: column;
        align-items: stretch;
    }

    .nav-inner {
        flex-direction: column;
        gap: 14px;
        align-items: center;
    }

    .nav-left,
    .nav-right {
        width: 100%;
        justify-content: center;
        gap: 12px;
        position: static;
        transform: none;
    }

    .nav-left a,
    .nav-right a {
        padding: 10px 12px;
        font-size: 15px;
        width: auto;
    }

    .navbar {
        padding: 10px 0;
    }

    .admin-products {
        grid-template-columns: 1fr !important;
        gap: 20px;
        display: grid !important;
    }

    .admin-card {
        display: flex;
        flex-direction: column;
        background: #fff;
        border: 1px solid #ececec;
        border-radius: 18px;
        overflow: hidden;
        transition: .2s;
        width: 100%;
        max-width: 100%;
    }

    .product-form {
        gap: 10px;
    }

    .product-form input,
    .product-form textarea {
        font-size: 16px;
    }

    .edit-images {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .form-container {
        width: 95%;
        padding: 20px;
    }

    .cart-page {
        padding: 20px 12px 40px;
    }

    .cart-page .page-title {
        font-size: 30px;
    }

    .checkout-btn,
    .submit-btn {
        width: 100%;
    }

    .confirmation-container {
        padding: 40px 20px;
    }

    .confirmation-actions {
        flex-direction: column;
    }

    main {
        max-width: 100%;
        padding: 20px 10px;
    }

    .product-image-container {
        width: 100%;
        height: 300px;
    }

    .cart-item img {
        max-width: 100%;
        width: 100%;
    }

    .cart-item-info,
    .cart-item-actions {
        width: 100%;
    }

    .cart-item-actions input {
        width: 100%;
        max-width: 100%;
    }

    .remove-item {
        width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 860px) {
    .product-modal {
        grid-template-columns: 1fr;
        padding: 24px;
    }

    .modal-right {
        gap: 14px;
    }

    .modal-right h2 {
        font-size: 30px;
    }

    .price {
        font-size: 22px;
    }
}

@media (max-width: 560px) {
    .product-modal {
        padding: 20px;
        gap: 24px;
        max-height: 100vh;
        overflow-y: auto;
    }

    .gallery {
        padding-top: 24px;
        align-items: flex-start;
    }

    .slider {
        aspect-ratio: auto;
        max-width: 100%;
        width: 100%;
        height: auto;
        max-height: calc(100vh - 260px);
        overflow: visible;
        margin: 0 auto;
    }

    .slider-image {
        width: 100%;
        height: auto;
        max-height: 50vh;
        object-fit: contain;
        border-radius: 18px;
    }

    .close {
        position: absolute;
        top: 12px;
        right: 12px;

        width: 44px;
        height: 44px;

        display: flex;
        align-items: center;
        justify-content: center;

        border: none;
        border-radius: 50%;

        background: rgba(255, 255, 255, .9);
        color: #222;

        font-size: 28px;
        font-weight: bold;
        line-height: 1;

        cursor: pointer;
        z-index: 1000;

        box-shadow: 0 2px 10px rgba(0, 0, 0, .2);
    }

    .close:hover {
        color: #000;
    }

    .close:active {
        transform: scale(.95);
    }

    .prev,
    .next {
        top: auto;
        bottom: 18px;
        width: 38px;
        height: 38px;
    }

    .prev {
        left: 12px;
    }

    .next {
        right: 12px;
    }

    .main-image,
    .image-wrapper img {
        width: 100%;
        height: auto;
        object-fit: contain;
    }

    .add-to-cart {
        width: 100%;
    }

    .cart-item {
        display: grid;
        grid-template-columns: 1fr !important;
        gap: 14px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .cart-item img {
        max-width: 100%;
        width: 100%;
        min-width: 0;
    }

    .cart-item-info,
    .cart-item-actions {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .cart-item-actions {
        align-items: stretch;
        gap: 12px;
    }

    .cart-item-actions input {
        width: 100%;
        max-width: 100%;
    }

    .remove-item {
        width: 100%;
        max-width: 100%;
    }

    .cart-page,
    .cart-content,
    .checkout-section {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
        padding-left: 16px;
        padding-right: 16px;
    }
}