/* ========================================
   MOBILE OPTIMIZATIONS
   ======================================== */

/* Hide mobile bottom navigation on desktop */
.bottom-nav {
    display: none;
}

@media (max-width: 768px) {

    /* Show bottom navigation on mobile */
    .bottom-nav {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid #e5e5e5;
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
        z-index: 1050;
        padding: 6px 0 8px 0;
        height: 65px;
    }

    .bottom-nav-items {
        display: flex;
        justify-content: space-around;
        align-items: center;
        height: 100%;
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 6px 12px;
        color: #717171;
        text-decoration: none;
        transition: all 0.2s ease;
        position: relative;
        flex: 1;
        max-width: 80px;
    }

    .bottom-nav-item i {
        font-size: 1.4rem;
        transition: all 0.2s ease;
    }

    .bottom-nav-item span {
        font-size: 0.7rem;
        font-weight: 500;
        transition: all 0.2s ease;
    }

    .bottom-nav-item.active {
        color: #ea1d2c;
    }

    .bottom-nav-item.active i {
        transform: scale(1.1);
    }

    .bottom-nav-item:active {
        transform: scale(0.95);
    }

    .bottom-nav-item .badge {
        position: absolute;
        top: 2px;
        right: 8px;
        font-size: 0.6rem;
        padding: 2px 5px;
        min-width: 18px;
        height: 18px;
        border-radius: 9px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Fixed navbar at top - COMPACT */
    .navbar {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1050;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        padding: 8px 12px !important;
        min-height: 56px;
    }

    .navbar-brand {
        font-size: 1.1rem !important;
    }

    .navbar .btn {
        padding: 6px 12px !important;
        font-size: 0.75rem !important;
    }

    .navbar .dropdown-toggle {
        display: none !important;
    }

    body {
        padding-top: 56px;
        padding-bottom: 65px;
        /* Space for bottom nav */
    }

    .category-scroll {
        padding: 8px 0;
        gap: 6px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .category-item {
        padding: 8px 12px;
        gap: 4px;
        min-width: 80px;
        flex-shrink: 0;
    }

    .category-icon {
        font-size: 1.2rem;
    }

    .category-name {
        font-size: 0.7rem;
        font-weight: 600;
    }

    .category-count {
        font-size: 0.6rem;
        padding: 2px 5px;
    }

    /* Compact banner */
    .banner-carousel {
        padding: 8px 0;
    }

    .banner-item {
        border-radius: 8px;
    }

    .banner-item img {
        aspect-ratio: 2 / 1;
    }

    /* Minimal padding with better margins */
    .container-fluid {
        padding: 12px !important;
    }

    /* STORE CARDS - 2 PER ROW WITH BETTER SPACING */
    #stores-grid {
        gap: 16px !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    #stores-grid .col-6 {
        padding: 0 !important;
        flex: 0 0 calc(50% - 8px) !important;
        max-width: calc(50% - 8px) !important;
        margin-bottom: 0 !important;
    }

    .store-card {
        border-radius: 12px;
        box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
        height: 100%;
        border: 2px solid #f5f5f5;
        transition: all 0.3s ease;
        overflow: hidden;
        background: white;
        position: relative;
    }

    .store-card:active {
        transform: scale(0.97);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
        border-color: #ea1d2c;
    }

    .store-image {
        height: 110px;
        border-radius: 0;
        background-size: cover;
        background-position: center;
        position: relative;
        border-bottom: 2px solid #f0f0f0;
    }

    .store-body {
        padding: 12px;
        background: white;
    }

    .store-name {
        font-size: 0.95rem;
        font-weight: 700;
        line-height: 1.3;
        margin-bottom: 6px;
        color: #1a1a1a;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .store-categories {
        margin-bottom: 8px;
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }

    .store-rating {
        margin-bottom: 8px;
        font-size: 0.8rem;
        font-weight: 600;
    }

    .store-rating .text-warning {
        font-size: 0.9rem;
    }

    .store-rating .fw-bold {
        color: #1a1a1a;
        font-size: 0.85rem;
    }

    .store-rating .text-muted {
        font-size: 0.75rem;
        color: #999 !important;
    }

    .store-info {
        font-size: 0.75rem;
        gap: 6px;
        flex-wrap: wrap;
        color: #666;
        display: flex;
        align-items: center;
    }

    .info-item {
        font-size: 0.75rem;
        display: inline-flex;
        align-items: center;
        gap: 4px;
        font-weight: 500;
        color: #555;
        background: #f8f9fa;
        padding: 4px 8px;
        border-radius: 6px;
    }

    .info-item i {
        font-size: 0.85rem;
        color: #ea1d2c;
    }

    .info-item.text-success {
        background: #e8f5e9;
        color: #2e7d32;
    }

    .info-item.text-success i {
        color: #2e7d32;
    }

    .category-badge-sm {
        font-size: 0.7rem;
        padding: 4px 8px;
        border-radius: 6px;
        background: #f0f0f0;
        color: #555;
        display: inline-block;
        font-weight: 600;
        border: 1px solid #e0e0e0;
    }

    .store-logo {
        width: 40px !important;
        height: 40px !important;
        border-radius: 8px;
        object-fit: cover;
        border: 2px solid #f0f0f0;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    /* Store badges improvements */
    .store-badges {
        position: absolute;
        top: 8px;
        left: 8px;
        display: flex;
        flex-direction: column;
        gap: 4px;
        z-index: 10;
    }

    .badge-new,
    .badge-featured,
    .badge-promotion {
        font-size: 0.65rem;
        padding: 4px 8px;
        border-radius: 6px;
        font-weight: 700;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }

    .badge-new {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
    }

    .badge-featured {
        background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
        color: white;
    }

    .badge-promotion {
        background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
        color: white;
    }

    .store-closed-badge {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.75);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 0.85rem;
        font-weight: 700;
        z-index: 5;
    }

    .store-closed-badge small {
        font-size: 0.7rem;
        font-weight: 500;
        margin-top: 4px;
    }

    /* Load more button */
    #load-more-btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 1rem;
        border-radius: 12px;
    }

    /* Modal fullscreen */
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100vh;
    }

    .modal-content {
        height: 100%;
        border-radius: 0;
    }

    /* Carousel arrows */
    .carousel-arrow {
        width: 36px;
        height: 36px;
    }

    .carousel-arrow i {
        font-size: 1.2rem;
    }

    .carousel-arrow-left {
        left: 8px;
    }

    .carousel-arrow-right {
        right: 8px;
    }

    .category-arrow {
        width: 32px;
        height: 32px;
        margin: 0 4px;
    }

    .category-arrow i {
        font-size: 1rem;
    }

    /* PWA features */
    .category-scroll::-webkit-scrollbar,
    .banner-scroll-auto::-webkit-scrollbar {
        display: none;
    }
}

/* Extra small devices */
@media (max-width: 576px) {
    .category-item {
        padding: 6px 10px;
        min-width: 70px;
    }

    .category-icon {
        font-size: 1.1rem;
    }

    .category-name {
        font-size: 0.65rem;
    }

    .store-image {
        height: 100px;
    }

    .store-name {
        font-size: 0.9rem;
    }

    .store-info {
        font-size: 0.7rem;
    }

    .info-item {
        font-size: 0.7rem;
        padding: 3px 6px;
    }
}