/* 
   Safa Organic - Mobile App UI Implementation
*/

/* Global Mobile Component Hider */
.mobile-app-header, 
.bottom-nav, 
.mobile-only, 
.mobile-drawer {
    display: none;
}

@media (max-width: 768px) {
    :root {
        --app-primary: #1B4332;
        --app-accent: #22c55e;
        --app-bg: #FFFFFF;
        --app-card-bg: #FFFFFF;
        --app-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
        --app-radius: 16px;
    }

    body {
        background-color: #f9fafb;
        padding-bottom: 80px; /* Space for Bottom Nav */
        overflow-x: hidden;
        width: 100%;
        position: relative;
    }
    
    html {
        overflow-x: hidden;
        width: 100%;
    }

    .mobile-logo {
        font-family: 'Playfair Display', serif;
        font-weight: 800;
        font-size: 20px;
        color: var(--app-primary);
        flex: 1;
        text-align: center;
        letter-spacing: -0.5px;
    }

    .mobile-burger {
        font-size: 20px;
        color: #374151;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        cursor: pointer;
    }

    /* --- MOBILE APP HEADER --- */
    .mobile-app-header {
        display: flex !important;
        position: sticky;
        top: 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        z-index: 1000;
        padding: 12px 20px;
        align-items: center;
        justify-content: space-between;
        box-shadow: 0 4px 15px rgba(0,0,0,0.03);
        border-bottom: 1px solid #f3f4f6;
    }

    /* --- MOBILE SIDE DRAWER --- */
    .mobile-drawer {
        display: flex !important;
        position: fixed;
        top: 0;
        left: -320px;
        width: 300px;
        height: 100%;
        background: white;
        z-index: 2000;
        transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
        flex-direction: column;
        box-shadow: 20px 0 50px rgba(0,0,0,0.1);
    }

    .mobile-drawer.active {
        left: 0;
    }

    .mobile-drawer-header {
        padding: 25px 20px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: var(--app-primary);
        color: white;
    }

    .drawer-logo {
        font-family: 'Playfair Display', serif;
        font-weight: 800;
        font-size: 22px;
        color: white;
    }

    .close-drawer {
        font-size: 24px;
        color: rgba(255,255,255,0.7);
        cursor: pointer;
    }

    .mobile-drawer-content {
        flex: 1;
        overflow-y: auto;
        padding: 20px;
    }

    .drawer-section {
        margin-bottom: 30px;
    }

    .drawer-section h4 {
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 1.5px;
        color: #9ca3af;
        margin-bottom: 15px;
        font-weight: 700;
    }

    .drawer-links {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .drawer-links li a {
        display: flex;
        align-items: center;
        gap: 15px;
        font-size: 15px;
        font-weight: 500;
        color: #374151;
        transition: 0.3s;
    }

    .drawer-links li a i {
        width: 20px;
        color: var(--app-accent);
        font-size: 16px;
    }

    .mobile-drawer-footer {
        padding: 20px;
        border-top: 1px solid #f3f4f6;
        font-size: 12px;
        color: #9ca3af;
        text-align: center;
    }

    .mobile-only-header {
        position: sticky;
        top: 0;
        background: white;
        z-index: 1000;
        padding: 15px 20px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-bottom: 1px solid #f3f4f6;
    }

    .mobile-header-btn {
        width: 36px;
        height: 36px;
        background: #f3f4f6;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #1f2937;
        font-size: 16px;
        text-decoration: none;
    }

    .mobile-header-actions {
        display: flex;
        gap: 15px;
        align-items: center;
    }

    .mobile-action-btn {
        font-size: 20px;
        color: #374151;
        position: relative;
    }

    .mobile-badge {
        position: absolute;
        top: -5px;
        right: -5px;
        background: var(--app-accent);
        color: white;
        font-size: 9px;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
    }

    /* --- BOTTOM NAVIGATION --- */
    .bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: white;
        display: flex;
        justify-content: space-around;
        align-items: center;
        padding: 12px 5px;
        box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.05);
        z-index: 1001;
        border-top: 1px solid #f3f4f6;
    }

    .nav-item-mobile {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        color: #9ca3af;
        text-decoration: none;
        transition: 0.3s;
        flex: 1;
    }

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

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

    .nav-item-mobile.active {
        color: var(--app-accent);
    }

    /* --- CATEGORY BUBBLES --- */
    .mobile-categories {
        display: flex;
        gap: 20px;
        overflow-x: auto;
        padding: 20px;
        scrollbar-width: none; /* Hide scrollbar */
    }

    .mobile-categories::-webkit-scrollbar {
        display: none;
    }

    .mobile-cat-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        min-width: 70px;
    }

    .cat-icon-wrap {
        width: 60px;
        height: 60px;
        background: #f3f4f6;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        border: 2px solid transparent;
        transition: 0.3s;
    }

    .cat-icon-wrap img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .mobile-cat-item span {
        font-size: 11px;
        font-weight: 600;
        color: #4b5563;
    }

    .mobile-cat-item.active .cat-icon-wrap {
        border-color: var(--app-accent);
        background: #ecfdf5;
    }

    /* --- MOBILE HERO SLIDER --- */
    .hero-slider-mobile {
        margin: 0 20px;
        border-radius: 16px;
        overflow: hidden;
        height: 160px;
        position: relative;
    }

    .hero-slide-mobile {
        display: flex;
        align-items: center;
        padding: 25px;
        background: linear-gradient(135deg, #1B4332 0%, #2D6A4F 100%);
        color: white;
        height: 100%;
    }

    .hero-slide-mobile h2 {
        font-size: 18px;
        color: white;
        margin-bottom: 5px;
    }

    .hero-slide-mobile p {
        font-size: 11px;
        opacity: 0.8;
    }

    .mobile-hero-img {
        position: absolute;
        right: 10px;
        bottom: 10px;
        width: 100px;
        height: auto;
    }

    /* --- PRODUCT CARDS (2 COLUMNS) --- */
    .mobile-product-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 20px;
    }

    .product-card-mobile {
        background: white;
        border-radius: 18px;
        padding: 12px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.04);
        position: relative;
        display: flex;
        flex-direction: column;
    }

    .wishlist-btn-mobile {
        position: absolute;
        top: 10px;
        right: 10px;
        width: 30px;
        height: 30px;
        background: rgba(255,255,255,0.8);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 5;
        color: #ef4444;
        font-size: 14px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }


    .card-img-mobile {
        width: 100%;
        height: 160px;
        object-fit: cover;
        border-radius: 12px;
        margin-bottom: 12px;
        background: #f9fafb;
    }

    .card-cat-mobile {
        font-size: 10px;
        color: #9ca3af;
        margin-bottom: 4px;
        text-transform: uppercase;
        text-align: left;
        margin-left: 0;
        padding-left: 0;
    }

    .card-title-mobile {
        font-size: 13px;
        font-weight: 600;
        color: #1f2937;
        margin-bottom: 8px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-align: left;
        margin-left: 0;
        padding-left: 0;
    }

    .card-price-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-top: auto;
        padding-top: 5px;
    }

    .card-price-mobile {
        font-size: 16px;
        font-weight: 800;
        color: var(--app-accent);
    }

    .card-old-price-mobile {
        font-size: 11px;
        color: #9ca3af;
        text-decoration: line-through;
        margin-top: -2px;
    }


    .add-cart-btn-mobile {
        width: 32px;
        height: 32px;
        background: var(--app-primary);
        color: white;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        border: none;
    }

    .badge-mobile {
        position: absolute;
        top: 8px;
        left: 8px;
        background: #fee2e2;
        color: #ef4444;
        font-size: 9px;
        font-weight: 700;
        padding: 2px 6px;
        border-radius: 4px;
    }

    /* --- PRODUCT DETAIL PAGE (MOBILE) --- */
    .mobile-product-detail {
        background: white;
    }

    .mobile-gallery-wrap {
        position: relative;
        background: #fdfdfd;
        padding-top: 20px;
    }

    .mobile-back-btn {
        position: absolute;
        top: 20px;
        left: 20px;
        width: 36px;
        height: 36px;
        background: white;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 10px rgba(0,0,0,0.1);
        z-index: 10;
        color: #1f2937;
    }

    .mobile-main-img {
        width: 100%;
        height: 350px;
        object-fit: cover;
        padding: 0;
        background: #f9fafb;
    }

    .mobile-detail-info {
        padding: 25px 20px;
        border-radius: 24px 24px 0 0;
        background: white;
        padding: 20px;
        background: white;
        margin-top: 0;
        position: relative;
    }

    .detail-cat {
        font-size: 12px;
        font-weight: 700;
        color: var(--app-accent);
        text-transform: uppercase;
        letter-spacing: 1px;
        margin-bottom: 8px;
    }

    .detail-title {
        font-size: 22px;
        font-weight: 700;
        color: #1a1a1a;
        margin-bottom: 10px;
        line-height: 1.4;
        font-family: 'Poppins', sans-serif;
    }

    .detail-rating {
        display: flex;
        align-items: center;
        gap: 6px;
        margin-bottom: 20px;
    }

    .detail-rating i { color: #facc15; font-size: 14px; }
    .detail-rating span { font-size: 13px; color: #9ca3af; font-weight: 500; }

    .detail-price-row {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 25px;
    }

    .detail-price {
        font-size: 28px;
        font-weight: 900;
        color: var(--app-primary);
    }

    .detail-old-price {
        font-size: 16px;
        color: #9ca3af;
        text-decoration: line-through;
    }

    .detail-discount {
        background: #fee2e2;
        color: #ef4444;
        font-size: 11px;
        font-weight: 700;
        padding: 4px 10px;
        border-radius: 20px;
    }

    .qty-selector-mobile {
        display: flex;
        align-items: center;
        background: #f3f4f6;
        border-radius: 12px;
        padding: 5px;
        width: 120px;
        justify-content: space-between;
    }

    .qty-selector-mobile button {
        width: 36px;
        height: 36px;
        background: white;
        border: none;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        color: #1f2937;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }

    .qty-selector-mobile input {
        width: 30px;
        text-align: center;
        background: transparent;
        border: none;
        font-weight: 700;
        font-size: 16px;
    }

    .variant-pills-mobile {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        padding-bottom: 10px;
        scrollbar-width: none;
    }

    .variant-pill-item {
        padding: 10px 20px;
        background: #f9fafb;
        border: 1.5px solid #f3f4f6;
        border-radius: 12px;
        font-size: 13px;
        font-weight: 600;
        white-space: nowrap;
        color: #374151;
        transition: 0.3s;
    }

    .variant-pill-item.active {
        background: #ecfdf5;
        border-color: var(--app-accent);
        color: var(--app-primary);
    }

    .sticky-action-bar {
        display: none !important;
    }

    .mobile-buy-btn {
        width: 100%;
        background: var(--app-accent);
        color: white;
        border: none;
        border-radius: 14px;
        font-weight: 700;
        font-size: 16px;
        height: 56px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-top: 20px;
    }

    .mobile-add-cart-row {
        display: grid;
        grid-template-columns: 1fr 1.5fr;
        gap: 15px;
        margin-top: 20px;
        align-items: center;
    }

    .mobile-qty-pill {
        display: flex;
        align-items: center;
        background: #f3f4f6;
        border-radius: 40px;
        padding: 5px;
        justify-content: space-between;
        border: 1px solid #e5e7eb;
    }

    .mobile-qty-pill button {
        width: 34px;
        height: 34px;
        border-radius: 50%;
        border: none;
        background: white;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    }

    .mobile-qty-pill input {
        width: 30px;
        text-align: center;
        border: none;
        background: transparent;
        font-weight: 700;
        font-size: 16px;
    }

    .mobile-add-cart-btn {
        height: 46px;
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 30px;
        font-size: 13px;
        font-weight: 600;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        color: #374151;
    }

    .mobile-detail-price-row {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 5px;
    }

    .mobile-price-main {
        font-size: 24px;
        font-weight: 800;
        color: var(--app-accent);
    }

    .mobile-price-old {
        font-size: 14px;
        color: #9ca3af;
        text-decoration: line-through;
    }

    /* --- HIDE DESKTOP ELEMENTS ON MOBILE --- */
    .hero-slider, 
    header, 
    footer, 
    section:not(.mobile-only) {
        display: none !important;
    }

    .mobile-only {
        display: block !important;
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }
}

/* Ensure mobile elements are hidden on desktop */
@media (min-width: 769px) {
    .mobile-app-header, 
    .bottom-nav, 
    .mobile-only,
    .mobile-drawer,
    #overlay.drawer-overlay {
        display: none !important;
    }
}
