/**
 * Mobile-responsive enhancements for webview & website
 * Does NOT change theme colors or fonts - only layout, spacing, touch targets
 */

/* Safe area for notched devices (mobile webview) */
@media (max-width: 991px) {
    body {
        padding-left: env(safe-area-inset-left, 0);
        padding-right: env(safe-area-inset-right, 0);
    }
}

@supports (padding: env(safe-area-inset-bottom)) or (padding: constant(safe-area-inset-bottom)) {
    .short_curt_icons {
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
        padding-bottom: calc(8px + constant(safe-area-inset-bottom, 0px));
    }
    #main-wrapper {
        padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
        padding-bottom: calc(80px + constant(safe-area-inset-bottom, 0px));
    }
    .cart-sidebar .cart-content,
    .cart-amount-btn-div {
        padding-bottom: env(safe-area-inset-bottom, 0px);
        padding-bottom: constant(safe-area-inset-bottom, 0px);
    }
    .checkout .container {
        padding-bottom: env(safe-area-inset-bottom, 0px);
        padding-bottom: constant(safe-area-inset-bottom, 0px);
    }
}

/* Minimum touch target size (44px) for interactive elements */
@media (max-width: 991px) {
    .btn,
    .btn-primary,
    .nav-link,
    .header-cart,
    .header-account-btn,
    .cart-amount-btn,
    .btn-checkout,
    .product-card-add,
    .rest-book-btn,
    .rest-info-btn,
    .filter-group .swiper-slide button,
    .sidebar-toggle-btn {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 10px 16px;
    }
    .cart-counter-minus,
    .cart-counter-plus,
    .cart-delete,
    .cart-close,
    .quantity-change-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .cart-counter-value {
        min-width: 44px;
        min-height: 44px;
        font-size: 16px; /* prevents zoom on focus in iOS */
        text-align: center;
    }
    input.form-control,
    input.form-select,
    select.form-select,
    .search-input,
    .custom-search-box input {
        min-height: 44px;
        font-size: 16px;
    }
}

/* ========== HOMEPAGE (landing + app home) ========== */
@media (max-width: 991px) {
    .banner.section-gap-90 {
        padding-top: 24px;
        padding-bottom: 24px;
    }
    .banner .row.align-items-center {
        gap: 16px;
    }
    .banner-image-slider .carousel-item img {
        height: 200px !important;
        min-height: 160px;
    }
    .custom-search-box-container {
        max-width: 100%;
    }
    .custom-search-box {
        min-height: 48px;
        padding: 10px 14px;
    }
    .search-results {
        max-height: 60vh;
        left: 0;
        right: 0;
        width: 100%;
    }
    .section-gap-66 {
        padding: 40px 0;
    }
    .section-gap-90 {
        padding: 40px 0;
    }
    .category-card,
    .bestSellingCusineImage {
        border-radius: 12px;
    }
    .cuisines-section .container {
        padding-left: 12px;
        padding-right: 12px;
    }
    .feature .section-title,
    .app .app-content h2 {
        font-size: 1.5rem;
    }
    .feature .swiper-slide h3 {
        font-size: 1.1rem;
    }
    .feature .swiper-slide p {
        font-size: 0.9rem;
    }
}

@media (max-width: 767px) {
    .hero-section {
        padding: 36px 16px;
    }
    .hero-title {
        font-size: 1.75rem;
    }
    .hero-text {
        font-size: 1rem;
    }
    .section-title {
        font-size: 1.5rem;
        margin-bottom: 24px;
    }
    .food-card .food-body,
    .restaurant-body {
        padding: 14px;
    }
    .payment-methods {
        gap: 10px;
    }
    .payment-method {
        width: calc(50% - 8px);
        min-width: 120px;
    }
}

/* ========== RESTAURANT LIST (search) ========== */
@media (max-width: 991px) {
    .restaurant.section-gap-66 {
        padding: 24px 0 100px;
    }
    .restaurant .container {
        padding-left: 12px;
        padding-right: 12px;
    }
    .filter-group .filter-swiper .swiper-wrapper {
        flex-wrap: wrap;
        gap: 8px;
    }
    .filter-group .swiper-slide button {
        padding: 10px 14px;
        font-size: 14px;
        white-space: nowrap;
    }
    .filter-header h3 {
        font-size: 1rem;
    }
    #restaurants-container .col-12 {
        padding-left: 8px;
        padding-right: 8px;
    }
    .restaurant-card {
        border-radius: 12px;
        overflow: hidden;
    }
    .restaurant-card .figure {
        aspect-ratio: 16/10;
    }
    .bestSellingRestaurantsImage {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    .restaurant-card .content {
        padding: 12px;
    }
    .restaurant-name-left {
        font-size: 0.95rem;
    }
    .rating-badge,
    .restaurant-location {
        font-size: 0.8rem;
    }
    #load-more {
        min-height: 48px;
        padding: 12px 24px;
        width: 100%;
        max-width: 280px;
    }
}

@media (max-width: 575px) {
    .sidebar-menu {
        width: 85%;
        max-width: 320px;
    }
    .sidebar-toggle-btn {
        top: 70px;
    }
    .sidebar-toggle-btn.active {
        left: calc(85% - 24px);
    }
}

/* ========== RESTAURANT DETAILS (show) + MENU ITEMS ========== */
@media (max-width: 991px) {
    .restaurant .row {
        margin-left: 0;
        margin-right: 0;
    }
    .rest-col {
        padding-left: 12px;
        padding-right: 12px;
        padding-bottom: 100px;
    }
    .rest-media img {
        max-height: 220px;
        object-fit: cover;
    }
    .rest-profile {
        padding: 16px 0;
    }
    .rest-name {
        font-size: 1.35rem;
    }
    .rest-menu-wrapper {
        padding: 12px 0;
        -webkit-overflow-scrolling: touch;
    }
    .rest-menu-group .swiper-slide {
        padding: 10px 14px;
        font-size: 14px;
        white-space: nowrap;
    }
    .rest-swiper-prev,
    .rest-swiper-next {
        min-width: 36px;
        min-height: 36px;
    }
    .product-category-title {
        font-size: 1.2rem;
        margin-bottom: 12px;
    }
    .product-card-groupp .row {
        margin-left: -6px;
        margin-right: -6px;
    }
    .product-card-groupp .col-md-6 {
        padding: 6px;
    }
    .product-card {
        border-radius: 12px;
        overflow: hidden;
    }
    .product-card-media {
        min-height: 140px;
    }
    .product-card-content {
        padding: 12px;
    }
    .product-card-title {
        font-size: 0.95rem;
    }
    .product-card-text {
        font-size: 0.8rem;
        line-height: 1.35;
    }
    .product-card-add {
        min-height: 40px;
        padding: 8px 14px;
        font-size: 14px;
    }
}

/* ========== CART (sidebar + order-cart) ========== */
@media (max-width: 991px) {
    .cart-sidebar {
        width: 100%;
        max-width: 100%;
        right: 0;
        left: 0;
        border-radius: 16px 16px 0 0;
        max-height: 85vh;
        display: flex;
        flex-direction: column;
    }
    .cart-sidebar .cart-content {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        padding: 16px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }
    .cart-title {
        font-size: 1.15rem;
        margin-bottom: 12px;
    }
    .cart-scroll-group {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .cart-item {
        padding: 14px 0;
        gap: 12px;
        align-items: flex-start;
    }
    .cart-meta-group {
        flex: 1;
        min-width: 0;
    }
    .cart-name {
        font-size: 0.95rem;
    }
    .cart-action-group {
        flex-shrink: 0;
        align-items: center;
        gap: 10px;
    }
    .cart-amount-list {
        padding: 12px 0;
    }
    .cart-amount-btn-div {
        padding: 12px 0;
    }
    .cart-amount-btn {
        min-height: 52px;
        font-size: 1rem;
        border-radius: 12px;
        width: 100%;
    }
    .cart-coupon input {
        min-height: 44px;
        font-size: 16px;
    }
    .cart-coupon button {
        min-height: 44px;
        padding: 0 16px;
    }
    .deliver_type .d_delivery,
    .deliver_type .d_pickup {
        padding: 8px 12px;
        font-size: 14px;
    }
    .cart-close {
        position: absolute;
        top: 12px;
        right: 12px;
        min-width: 44px;
        min-height: 44px;
    }
}

/* Cart table (restaurant-cart.blade partial) */
@media (max-width: 991px) {
    .cart-table {
        font-size: 14px;
    }
    .cart-table td {
        padding: 10px 6px;
    }
    .product-style,
    .variation-option-style {
        font-size: 13px;
    }
    .btn-checkout {
        min-height: 48px;
        width: 100%;
        font-size: 1rem;
    }
}

/* ========== CHECKOUT ========== */
@media (max-width: 991px) {
    .checkout {
        padding: 16px 0 100px;
    }
    .checkout .container {
        padding-left: 12px;
        padding-right: 12px;
    }
    .booking-paginate {
        min-height: 44px;
        padding: 10px 0;
        font-size: 15px;
        display: inline-flex;
        align-items: center;
        gap: 8px;
    }
    .checkout-group {
        flex-direction: column;
        gap: 24px;
    }
    .checkout-delivery {
        order: 1;
    }
    .checkout-summary {
        order: 2;
        border-radius: 12px;
        overflow: hidden;
    }
    .checkout-card-head h3 {
        font-size: 1.1rem;
    }
    .checkout-label dl dd {
        font-size: 14px;
    }
    .form-label {
        font-size: 14px;
    }
    .form-btn.booking-confirmation-btn {
        min-height: 52px;
        width: 100%;
        font-size: 1rem;
        border-radius: 12px;
    }
    .checkout-summary-head h3 {
        font-size: 1.1rem;
    }
    .checkout-summary-item h3,
    .checkout-summary-item h4 {
        font-size: 14px;
    }
    .checkout-summary-price-list li {
        padding: 10px 0;
        font-size: 14px;
    }
}

@media (max-width: 575px) {
    .address-modal .modal-dialog,
    .shop-modal .modal-dialog,
    .booking-modal .modal-dialog {
        margin: 8px;
        max-width: calc(100% - 16px);
    }
    .modal-content {
        border-radius: 16px;
    }
    .modal-body {
        max-height: 70vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Location selector tap area (app home) */
@media (max-width: 991px) {
    #location-display-wrapper {
        min-height: 48px;
        padding: 12px 14px;
    }
}

/* ========== HEADER & NAV (mobile) ========== */
@media (max-width: 991px) {
    .header.fixed.sticky {
        padding-left: env(safe-area-inset-left, 0);
        padding-right: env(safe-area-inset-right, 0);
    }
    .header-content {
        min-height: 52px;
    }
    .header-logo img {
        max-height: 40px;
    }
    .header-logo span {
        font-size: 1.1rem;
    }
}

/* Sticky header offset for anchor scroll */
@media (max-width: 991px) {
    .restaurant .rest-menu-wrapper {
        position: sticky;
        top: 52px;
        z-index: 10;
        background: var(--slate, #F7F7FC);
    }
}

/* Prevent horizontal scroll on small screens */
@media (max-width: 991px) {
    body {
        overflow-x: hidden;
    }
    .container {
        max-width: 100%;
    }
}
