/*
 * ChefBites Mobile CSS
 * Version: 4.1 - Capacitor Ready (Balanced)
 */

@media (max-width: 768px) {

    /* === CAPACITOR/NATIVE APP ESSENTIALS === */

    /* Prevent text selection only on interactive UI elements (not text content) */
    .btn, .mobile-nav-item, .mobile-nav-cart, .cat-item,
    .banner-card, .quick-pick-card, .mobile-back-btn,
    .sidebar-tab-link, .action-btn, .rating-badge,
    .nav-link, .dropdown-item {
        -webkit-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
    }

    /* Remove tap highlight only on interactive elements */
    button, a, .btn, .mobile-nav-item, .mobile-nav-cart,
    .cat-item, .card, input, select, textarea {
        -webkit-tap-highlight-color: transparent;
    }

    /* Smooth momentum scrolling for scrollable areas */
    .scrollable, .modal-modifiers-area, .tab-content,
    .featured-slider, .osahan-profile {
        -webkit-overflow-scrolling: touch;
    }

    /* Prevent font boosting on Android */
    html {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    /* Remove 300ms click delay on all interactive elements */
    button, a, .btn, label, input, select, textarea,
    .cat-item, .card, .mobile-nav-item, [role="button"] {
        touch-action: manipulation;
    }

    /* === BASE === */
    html {
        /* clip doesn't create a new BFC — avoids the Android WebView bug where
           overflow-x:hidden on html/body blocks vertical touch-scrolling */
        overflow-x: clip;
    }

    body {
        overflow-x: hidden;
        /* NOTE: overscroll-behavior-y:contain is intentionally removed —
           older Android WebView versions (pre-Chrome 90) have a bug where it
           blocks ALL vertical scrolling, not just pull-to-refresh overscroll */
        touch-action: pan-y; /* explicitly allow vertical panning in Android WebView */
    }

    .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    /* === HEADER === */
    .modern-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1030;
        background: #fff;
        box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    }

    /* Safe area padding only for standalone/fullscreen mode (Capacitor/PWA) */
    @supports (padding-top: env(safe-area-inset-top)) {
        @media (display-mode: standalone), (display-mode: fullscreen) {
            .modern-header {
                padding-top: env(safe-area-inset-top, 0px);
            }
        }
    }

    .navbar-modern {
        padding: 12px 16px;
        min-height: 56px;
    }

    .navbar-inner {
        justify-content: center;
    }

    .navbar-logo {
        height: 28px;
    }

    /* Hide desktop elements */
    .navbar-search-section,
    .navbar-actions-section,
    .address-selector-wrapper,
    .offers-btn,
    .user-dropdown,
    .m-none {
        display: none !important;
    }

    /* Body spacing */
    body.fixed-bottom-bar {
        padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    }

    /* Global: all main content pages clear the fixed bottom nav */
    .osahan-main-body {
        padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* === BOTTOM NAVIGATION === */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: #fff;
        border-top: 1px solid #f0f0f0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
        z-index: 1040;
        justify-content: space-around;
        align-items: flex-end;
        padding: 0 8px 8px;
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-end;
        flex: 1;
        padding: 6px 4px;
        color: #666; /* darkened from #aaa for WCAG AA contrast (5.7:1 on white) */
        text-decoration: none;
        font-size: 10px;
        font-weight: 500;
        transition: color 0.2s ease;
    }

    .mobile-nav-item i {
        font-size: 22px;
        margin-bottom: 3px;
    }

    .mobile-nav-item span {
        font-size: 10px;
    }

    .mobile-nav-item.active {
        color: #667eea;
    }

    .mobile-nav-item.active i {
        transform: scale(1.05);
    }

    .mobile-nav-item:hover {
        color: #667eea;
    }

    .mobile-nav-item:hover i {
        transform: scale(1.1);
    }

    .mobile-nav-item i {
        transition: transform 0.2s ease;
    }

    .mobile-nav-item:active i {
        transform: scale(0.9);
    }

    /* Cart Button - Modern Floating Style */
    .mobile-nav-cart {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-end;
        flex: 1;
        padding: 6px 4px;
        text-decoration: none;
        background: transparent !important;
        border: none !important;
        outline: none !important;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-nav-cart:focus {
        outline: none !important;
        box-shadow: none !important;
    }

    .mobile-nav-cart .cart-btn-circle {
        position: relative;
        width: 52px;
        height: 52px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-top: -12px;
        margin-bottom: 3px;
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
        transition: all 0.2s ease;
        border: none;
    }

    .mobile-nav-cart:hover .cart-btn-circle {
        transform: scale(1.08);
        box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
    }

    .mobile-nav-cart:active .cart-btn-circle {
        transform: scale(0.95);
    }

    .mobile-nav-cart .cart-btn-circle i {
        color: #fff;
        font-size: 22px;
        margin: 0;
    }

    .mobile-nav-cart > span {
        font-size: 10px;
        font-weight: 500;
        color: #667eea;
    }

    .mobile-nav-badge {
        position: absolute;
        top: -4px;
        right: -4px;
        min-width: 18px;
        height: 18px;
        padding: 0 5px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: #fff;
        font-size: 10px;
        font-weight: 600;
        border-radius: 9px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 2px solid #fff;
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    }

    /* === SLICK MOBILE ADJUSTMENTS === */
    .slick-arrow {
        display: none !important;
    }

    .slick-dots {
        bottom: -25px;
    }

    .slick-dots li button:before {
        font-size: 8px;
    }

    /* === CATEGORY SLIDER === */
    .cat-slider {
        margin: 0;
        padding: 12px 0;
    }

    .cat-slider .slick-slide {
        padding: 0 6px;
    }

    .cat-item {
        padding: 0 !important;
        margin: 0 !important;
    }

    .cat-item .category-card {
        padding: 16px 14px !important;
        min-width: 76px;
        border-radius: 18px !important;
        background: #fff !important;
        border: 1px solid #eee !important;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06) !important;
        transition: all 0.2s ease;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
    }

    .cat-item .category-card:active {
        transform: scale(0.95);
    }

    /* All category - gradient purple */
    .cat-item .category-card.category-card-all {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        border: none !important;
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important;
    }

    .cat-item .category-card.category-card-all p,
    .cat-item .category-card.category-card-all .text-dark {
        color: #fff !important;
    }

    .cat-item .category-card.category-card-all .category-icon-wrapper,
    .cat-item .category-card.category-card-all .category-icon-all {
        background: rgba(255, 255, 255, 0.25) !important;
    }

    .cat-item .category-card.category-card-all .category-icon-wrapper i,
    .cat-item .category-card.category-card-all .category-icon-all i {
        color: #fff !important;
    }

    /* Icon wrapper */
    .cat-item .category-icon-wrapper {
        width: 52px !important;
        height: 52px !important;
        margin: 0 auto 10px !important;
        border-radius: 16px !important;
        font-size: 24px;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    }

    .cat-item .category-icon-img {
        width: 36px !important;
        height: 36px !important;
        object-fit: contain;
    }

    .cat-item .category-card p {
        font-size: 12px !important;
        font-weight: 600 !important;
        color: #333 !important;
        margin: 0 !important;
        white-space: nowrap;
    }

    /* === BANNER SLIDER === */
    .offer-slider {
        margin: 0;
    }

    .offer-slider .slick-list {
        overflow: visible;
    }

    .offer-slider .slick-slide {
        padding: 0;
    }

    .offer-slider .banner-item {
        padding: 0 4px;
    }

    .banner-card {
        height: 160px;
        border-radius: 16px;
        overflow: hidden;
    }

    .banner-img {
        border-radius: 16px;
    }

    .banner-title {
        font-size: 1.2rem;
        font-weight: 700;
    }

    .banner-subtitle {
        font-size: 0.85rem;
    }

    .banner-content {
        padding: 16px;
    }

    /* Slick dots for banner */
    .offer-slider .slick-dots {
        bottom: 10px;
    }

    .offer-slider .slick-dots li button:before {
        color: #fff;
        opacity: 0.5;
    }

    .offer-slider .slick-dots li.slick-active button:before {
        color: #fff;
        opacity: 1;
    }

    /* === SECTION HEADERS === */
    .section-header {
        padding: 16px 0 12px;
    }

    .section-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
        border-radius: 12px;
    }

    .section-title h5 {
        font-size: 16px;
    }

    .section-title p {
        font-size: 12px;
    }

    /* === TRENDING SLIDER === */
    .trending-slider {
        margin: 0;
        position: relative;
    }

    .trending-slider .slick-slide {
        padding: 0 4px;
    }

    .trending-slider .slick-list {
        overflow: visible;
    }

    .osahan-slider-item {
        width: 100%;
    }

    /* Modern arrow buttons for trending slider */
    .trending-slider .slick-arrow {
        display: flex !important;
        position: absolute;
        top: 80px;
        z-index: 10;
        width: 32px;
        height: 32px;
        background: rgba(255, 255, 255, 0.95);
        border-radius: 50%;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        align-items: center;
        justify-content: center;
        cursor: pointer;
        border: none;
        transition: all 0.2s ease;
    }

    .trending-slider .slick-arrow:hover {
        background: #fff;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    .trending-slider .slick-prev {
        left: 12px;
    }

    .trending-slider .slick-next {
        right: 12px;
    }

    .trending-slider .slick-prev:before,
    .trending-slider .slick-next:before {
        font-family: 'slick';
        font-size: 12px;
        color: #333;
        opacity: 1;
    }

    .trending-slider .slick-prev:before {
        content: '←';
        font-family: inherit;
    }

    .trending-slider .slick-next:before {
        content: '→';
        font-family: inherit;
    }

    /* === RESTAURANT CARDS === */
    .modern-restaurant-card {
        border-radius: 16px;
        box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    }

    .card-image-wrapper {
        height: 160px;
    }

    .card-body {
        padding: 12px;
    }

    .restaurant-name {
        font-size: 14px;
    }

    .restaurant-category {
        font-size: 12px;
        margin-bottom: 8px;
    }

    .card-footer-row {
        padding-top: 8px;
        font-size: 12px;
    }

    .rating-badge {
        font-size: 11px;
        padding: 3px 8px;
    }

    .delivery-time,
    .delivery-fee {
        font-size: 11px;
    }

    /* === GRID LAYOUTS - Full width cards on mobile === */
    .row.g-4 {
        margin: 0;
    }

    .row.g-4 > [class*="col"] {
        padding: 8px 0;
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    /* === QUICK PICKS === */
    .quick-picks-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .quick-pick-card {
        border-radius: 12px;
    }

    .quick-pick-image {
        height: 70px;
    }

    .quick-pick-info {
        padding: 8px;
    }

    .quick-pick-info h6 {
        font-size: 11px;
    }

    .quick-time {
        font-size: 10px;
    }

    /* === POPULAR SLIDER === */
    .popular-slider {
        margin: 0 -8px;
    }

    .popular-slider .slick-slide {
        padding: 0 8px;
    }

    /* === ALL RESTAURANTS === */
    .all-restaurants-section {
        margin-top: 8px;
        padding-top: 16px;
    }

    .see-more-btn {
        padding: 12px 24px;
        font-size: 14px;
    }

    /* === UTILITIES === */
    .py-2 {
        padding-top: 8px !important;
        padding-bottom: 8px !important;
    }

    /* === RESTAURANT DETAIL PAGE === */
    .restaurant-hero {
        min-height: auto !important;
        margin-bottom: 1rem !important;
    }

    .hero-banner-bg {
        height: 160px !important;
    }

    .hero-content {
        padding-top: 90px !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        gap: 0.5rem !important;
    }

    .restaurant-logo-wrapper {
        width: 80px !important;
        height: 80px !important;
        border-radius: 16px !important;
        border: 3px solid white !important;
        margin-top: -40px !important;
        position: relative;
        z-index: 10;
    }

    .restaurant-info-hero {
        padding-bottom: 0.5rem !important;
        width: 100%;
    }

    .restaurant-title {
        font-size: 1.3rem !important;
        margin-bottom: 0.1rem !important;
    }

    .restaurant-type {
        font-size: 0.8rem !important;
        margin-bottom: 0.4rem !important;
        color: rgba(255,255,255,0.9) !important;
    }

    .restaurant-rating-hero {
        display: flex !important;
        flex-direction: row !important;
        justify-content: center !important;
        align-items: center !important;
        margin-bottom: 0.5rem !important;
        gap: 6px !important;
    }

    .rating-stars-hero {
        gap: 2px !important;
        display: inline-flex !important;
        align-items: center !important;
    }

    .rating-stars-hero i {
        font-size: 14px !important;
    }

    .rating-stars-hero .star-empty {
        color: rgba(0, 0, 0, 0.2) !important;
    }

    .rating-stars-hero .star-filled {
        color: #ffc107 !important;
    }

    .rating-text {
        font-size: 0.75rem !important;
        color: #fff !important;
        font-weight: 500;
        background: rgba(0, 0, 0, 0.4);
        padding: 3px 8px;
        border-radius: 20px;
        margin: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
    }

    .restaurant-pills {
        justify-content: center !important;
        gap: 6px !important;
    }

    .info-pill {
        padding: 6px 12px !important;
        font-size: 0.75rem !important;
        background: rgba(0, 0, 0, 0.5) !important;
        backdrop-filter: blur(10px);
        border-radius: 20px !important;
        font-weight: 500;
    }

    .info-pill i {
        font-size: 12px !important;
    }

    /* Action Bar Mobile */
    .restaurant-actions-bar {
        margin-top: 1rem !important;
        padding: 0.75rem 1rem !important;
        border-radius: 14px !important;
        margin-left: 16px;
        margin-right: 16px;
    }

    .action-btn {
        width: 40px !important;
        height: 40px !important;
    }

    .action-btn i {
        font-size: 16px !important;
    }

    .contact-btn {
        padding: 0.6rem 1.2rem !important;
        font-size: 0.85rem !important;
    }

    /* Featured Section Mobile */
    .featured-section {
        padding: 1rem 0 !important;
        overflow: hidden;
    }

    .featured-slider-wrapper {
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
    }

    .featured-slider {
        display: flex !important;
        gap: 12px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        padding: 8px 16px 16px !important;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .featured-slider::-webkit-scrollbar {
        display: none;
    }

    .slider-arrow {
        display: none !important;
    }

    .featured-item-slide {
        flex: 0 0 150px !important;
        min-width: 150px !important;
        max-width: 150px !important;
        scroll-snap-align: start;
    }

    .featured-item-card {
        height: 100%;
    }

    .featured-item-image {
        height: 110px !important;
        min-height: 110px !important;
        max-height: 110px !important;
    }

    .featured-item-info {
        padding: 10px !important;
    }

    .featured-item-info .item-name {
        font-size: 0.8rem !important;
        margin-bottom: 4px !important;
    }

    .featured-item-info .item-description {
        font-size: 0.7rem !important;
        line-height: 1.3;
        margin-bottom: 6px !important;
    }

    .featured-item-info .item-price {
        font-size: 0.85rem !important;
    }

    .featured-item-info .item-footer {
        margin-top: auto;
    }

    /* === ITEM DETAIL MODAL === */
    #extras.modal {
        padding: 0 !important;
    }

    #extras .modal-dialog {
        margin: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        height: 100% !important;
        min-height: 100% !important;
    }

    .item-modal-enhanced {
        max-width: 100% !important;
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
    }

    .item-modal-enhanced .modal-content {
        border-radius: 0 !important;
        height: 100% !important;
        max-height: 100% !important;
        min-height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        box-shadow: none !important;
        border: none !important;
    }

    .item-modal-enhanced .modal-body {
        padding: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        flex: 1 !important;
        min-height: 0 !important;
        height: 100% !important;
    }

    .item-modal-enhanced .modal-grid {
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
        flex: 1 !important;
    }

    .item-modal-enhanced .modal-hero {
        width: 100% !important;
        height: 240px !important;
        min-height: 240px !important;
        max-height: 240px !important;
        flex-shrink: 0 !important;
        position: relative !important;
        overflow: hidden !important;
    }

    .item-modal-enhanced .modal-hero-image {
        height: 100% !important;
        width: 100% !important;
    }

    .item-modal-enhanced .modal-hero-image img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }

    .item-modal-enhanced .modal-close-floating {
        position: absolute !important;
        top: 12px !important;
        right: 12px !important;
        width: 32px !important;
        height: 32px !important;
        background: rgba(255, 255, 255, 0.95) !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15) !important;
        border-radius: 50% !important;
        z-index: 10 !important;
    }

    .item-modal-enhanced .modal-content-side {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        background: #fff !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }

    .item-modal-enhanced .modal-content-header {
        padding: 16px 20px 12px !important;
        flex-shrink: 0 !important;
        border-bottom: 1px solid #f0f0f0 !important;
    }

    .item-modal-enhanced .modal-title-large {
        font-size: 1.25rem !important;
        font-weight: 700 !important;
        color: #1a1a2e !important;
        margin-bottom: 6px !important;
        line-height: 1.3 !important;
    }

    .item-modal-enhanced .modal-description {
        font-size: 0.85rem !important;
        color: #666 !important;
        line-height: 1.4 !important;
        margin: 0 !important;
    }

    .item-modal-enhanced .modal-modifiers-area {
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        padding: 0 20px !important;
        padding-bottom: 100px !important;
        -webkit-overflow-scrolling: touch !important;
        min-height: 0 !important;
    }

    /* Empty modifiers area - minimal height */
    .item-modal-enhanced .modal-modifiers-area:empty,
    .item-modal-enhanced .modal-modifiers-area #modifier-groups-container:empty {
        min-height: 0 !important;
        padding: 0 !important;
    }

    .item-modal-enhanced .modifier-group {
        padding: 14px 0 !important;
        border-bottom: 1px solid #f0f0f0 !important;
    }

    .item-modal-enhanced .modifier-group:last-child {
        border-bottom: none !important;
    }

    .item-modal-enhanced .modifier-group h6 {
        font-size: 0.95rem !important;
        font-weight: 600 !important;
        color: #1a1a2e !important;
        margin-bottom: 2px !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
    }

    .item-modal-enhanced .modifier-group .badge {
        font-size: 0.6rem !important;
        padding: 2px 6px !important;
        background: #f0f0f0 !important;
        color: #666 !important;
        border-radius: 4px !important;
        font-weight: 500 !important;
    }

    .item-modal-enhanced .modifier-group p.text-muted {
        font-size: 0.75rem !important;
        margin-bottom: 10px !important;
        color: #999 !important;
    }

    .item-modal-enhanced .modifier-group .form-check {
        padding: 10px 0 !important;
        margin: 0 !important;
        border-bottom: 1px solid #f8f8f8 !important;
        display: flex !important;
        align-items: center !important;
    }

    .item-modal-enhanced .modifier-group .form-check:last-child {
        border-bottom: none !important;
    }

    .item-modal-enhanced .modifier-group .form-check-label {
        font-size: 0.9rem !important;
        color: #333 !important;
        flex: 1 !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding-left: 10px !important;
        cursor: pointer !important;
    }

    .item-modal-enhanced .modifier-group .form-check-input {
        width: 20px !important;
        height: 20px !important;
        border: 2px solid #ddd !important;
        margin: 0 !important;
        flex-shrink: 0 !important;
        cursor: pointer !important;
    }

    .item-modal-enhanced .modifier-group .form-check-input:checked {
        background-color: #667eea !important;
        border-color: #667eea !important;
    }

    /* Footer - Fixed at bottom */
    .item-modal-enhanced .modal-sticky-footer {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        padding: 14px 20px !important;
        padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)) !important;
        background: #fff !important;
        border-top: 1px solid #eee !important;
        display: flex !important;
        gap: 12px !important;
        align-items: center !important;
        flex-shrink: 0 !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08) !important;
        z-index: 1060 !important;
    }

    .item-modal-enhanced .modal-quantity-control {
        display: flex !important;
        align-items: center !important;
        border: 1px solid #e0e0e0 !important;
        border-radius: 10px !important;
        background: #f8f8f8 !important;
        overflow: hidden !important;
    }

    .item-modal-enhanced .qty-control-btn {
        width: 40px !important;
        height: 40px !important;
        border: none !important;
        background: transparent !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .item-modal-enhanced .qty-control-btn:active {
        background: #e8e8e8 !important;
    }

    .item-modal-enhanced .qty-control-btn i {
        font-size: 14px !important;
        color: #333 !important;
    }

    .item-modal-enhanced .qty-control-value {
        width: 32px !important;
        text-align: center !important;
        font-size: 1rem !important;
        font-weight: 600 !important;
        color: #1a1a2e !important;
    }

    .item-modal-enhanced .modal-add-btn {
        flex: 1 !important;
        height: 48px !important;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        color: #fff !important;
        border: none !important;
        border-radius: 12px !important;
        font-size: 0.95rem !important;
        font-weight: 600 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important;
        transition: all 0.2s ease !important;
    }

    .item-modal-enhanced .modal-add-btn:active {
        transform: scale(0.98) !important;
    }

    .item-modal-enhanced .add-btn-text {
        font-weight: 600 !important;
    }

    .item-modal-enhanced .add-btn-price {
        padding: 3px 10px !important;
        background: rgba(255, 255, 255, 0.2) !important;
        border-radius: 6px !important;
        font-size: 0.9rem !important;
        font-weight: 600 !important;
    }

    /* === PROFILE PAGE MOBILE === */
    .osahan-profile .row {
        flex-direction: column !important;
    }

    .osahan-profile .col-md-4,
    .osahan-profile .col-md-8 {
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
    }

    /* When a tab is active on mobile, hide sidebar */
    .osahan-profile.mobile-tab-active .col-md-4 {
        display: none !important;
    }

    .osahan-profile.mobile-tab-active .col-md-8 {
        display: block !important;
    }

    /* When no tab is active (menu view), hide content on mobile */
    .osahan-profile.mobile-menu-view .col-md-8 {
        display: none !important;
    }

    /* Mobile Back Button for profile tabs */
    .mobile-back-btn {
        display: flex !important;
        align-items: center;
        gap: 8px;
        padding: 12px 16px;
        background: #f8f9fa;
        border: none;
        border-radius: 12px;
        font-size: 0.9rem;
        font-weight: 600;
        color: #667eea;
        margin-bottom: 16px;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .mobile-back-btn:active {
        background: #e9ecef;
        transform: scale(0.98);
    }

    .mobile-back-btn i {
        font-size: 18px;
    }

    /* Profile sidebar styling for mobile */
    .osahan-profile .sticky_sidebar {
        border-radius: 16px !important;
        overflow: hidden;
    }

    .osahan-profile .profile-details a,
    .osahan-profile .profile-details button {
        padding: 16px !important;
    }

    .osahan-profile .profile-details h6 {
        font-size: 0.95rem !important;
    }

    .osahan-profile .profile-details i.feather-chevron-right {
        color: #ccc;
    }

    /* Tab content styling */
    .osahan-profile .tab-content {
        padding: 0 !important;
    }

    .osahan-profile .tab-pane .rounded.shadow-sm {
        border-radius: 16px !important;
        margin-bottom: 16px !important;
    }

    /* Order cards mobile styling */
    .osahan-profile .order-card,
    .osahan-profile .bg-white.rounded.shadow-sm {
        border-radius: 16px !important;
    }

    /* === FORM INPUTS - Keyboard Handling === */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"],
    input[type="search"],
    textarea,
    select {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
        border-radius: 12px !important;
        padding: 14px 16px !important;
        border: 1px solid #e0e0e0 !important;
        background: #fff !important;
        transition: border-color 0.2s ease, box-shadow 0.2s ease;
    }

    input:focus,
    textarea:focus,
    select:focus {
        border-color: #667eea !important;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
        outline: none !important;
    }

    /* Form labels */
    .form-label, label {
        font-size: 0.9rem;
        font-weight: 600;
        color: #333;
        margin-bottom: 6px;
    }

    /* === BUTTONS - Touch Friendly === */
    .btn {
        min-height: 48px; /* Touch target size */
        border-radius: 12px !important;
        font-weight: 600;
        transition: all 0.2s ease;
    }

    .btn:active {
        transform: scale(0.98);
    }

    .btn-primary {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        border: none !important;
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    }

    /* === CARDS - Consistent Styling === */
    .card, .rounded.shadow-sm {
        border-radius: 16px !important;
        border: none !important;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08) !important;
    }

    /* === ALERTS & TOASTS === */
    .alert {
        border-radius: 12px !important;
        border: none !important;
        padding: 14px 16px !important;
    }

    .toast {
        border-radius: 12px !important;
    }

    /* === CHECKOUT PAGE === */
    .checkout-section {
        background: #fff;
        border-radius: 16px;
        padding: 16px;
        margin-bottom: 16px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    }

    .checkout-section h5 {
        font-size: 1rem;
        font-weight: 700;
        margin-bottom: 12px;
    }

    /* === CART DRAWER/PAGE === */
    .cart-item {
        padding: 12px;
        border-radius: 12px;
        background: #f8f9fa;
        margin-bottom: 8px;
    }

    .cart-item-image {
        width: 60px;
        height: 60px;
        border-radius: 10px;
        object-fit: cover;
    }

    /* === LOADING STATES === */
    .skeleton {
        background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
        background-size: 200% 100%;
        animation: skeleton-loading 1.5s infinite;
        border-radius: 8px;
    }

    @keyframes skeleton-loading {
        0% { background-position: 200% 0; }
        100% { background-position: -200% 0; }
    }

    /* === EMPTY STATES === */
    .empty-state {
        text-align: center;
        padding: 40px 20px;
    }

    .empty-state i {
        font-size: 48px;
        color: #ddd;
        margin-bottom: 16px;
    }

    .empty-state h5 {
        font-size: 1.1rem;
        font-weight: 600;
        color: #333;
        margin-bottom: 8px;
    }

    .empty-state p {
        font-size: 0.9rem;
        color: #888;
    }

    /* === BADGES === */
    .badge {
        border-radius: 20px;
        padding: 4px 10px;
        font-weight: 600;
        font-size: 0.75rem;
    }

    /* === SAFE AREAS FOR FIXED ELEMENTS === */
    .fixed-bottom-bar,
    .checkout-footer,
    .cart-footer {
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* === TRANSITIONS - GPU Accelerated === */
    .animate-fade {
        animation: fadeIn 0.3s ease;
    }

    @keyframes fadeIn {
        from { opacity: 0; transform: translateY(10px); }
        to { opacity: 1; transform: translateY(0); }
    }

    /* GPU acceleration only for animated/sticky elements */
    .mobile-bottom-nav,
    .modern-header {
        will-change: transform;
    }

    /* === KEYBOARD HANDLING (Capacitor) ===
     * capacitor-bridge.js adds/removes .keyboard-open on body
     * and sets --keyboard-height CSS variable via the Keyboard plugin.
     * Hide the bottom nav so it doesn't sit on top of the keyboard.
     * Shrink main content so the focused input stays visible.
     */
    body.keyboard-open .mobile-bottom-nav {
        display: none !important;
    }

    body.keyboard-open .osahan-main-body {
        padding-bottom: calc(var(--keyboard-height, 0px) + 16px) !important;
    }

    /* Item detail modal: shrink scrollable area when keyboard is open
       so the quantity/add button footer stays above keyboard */
    body.keyboard-open .item-modal-enhanced .modal-modifiers-area {
        padding-bottom: calc(var(--keyboard-height, 0px) + 80px) !important;
    }

    body.keyboard-open .item-modal-enhanced .modal-sticky-footer {
        bottom: var(--keyboard-height, 0px) !important;
        padding-bottom: 14px !important;
    }

    /* Checkout / cart pages: keep place-order button above keyboard */
    body.keyboard-open .checkout-footer,
    body.keyboard-open .cart-footer {
        bottom: var(--keyboard-height, 0px) !important;
        padding-bottom: 16px !important;
    }
}


/* Hide bottom nav on desktop */
@media (min-width: 769px) {
    .mobile-bottom-nav {
        display: none !important;
    }

    .mobile-back-btn {
        display: none !important;
    }

    .osahan-profile.mobile-tab-active .col-md-4,
    .osahan-profile.mobile-menu-view .col-md-8 {
        display: block !important;
    }
}
