/**
 * Rasmika Fancy - Mobile App & PWA Comprehensive Stylesheet
 */

:root {
    --mobile-nav-height: 65px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
    --gold-gradient: linear-gradient(135deg, #FFF0A5 0%, #D4AF37 50%, #AA820A 100%);
}

/* Touch & Feel Optimizations */
html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    overscroll-behavior-y: contain;
}

/* Ensure inputs never auto-zoom on iOS Safari (min font size 16px) */
@media (max-width: 767.98px) {
    input, select, textarea {
        font-size: 16px !important;
    }
    
    /* Give space at the bottom for the fixed mobile app dock */
    body {
        padding-bottom: calc(var(--mobile-nav-height) + var(--safe-bottom) + 20px) !important;
    }

    /* Product card mobile polish */
    .product-card {
        border-radius: 14px;
        background: #1a0b0b;
    }
    .product-card .p-3 {
        padding: 0.75rem !important;
    }
    .price-tag {
        font-size: 0.95rem;
    }
}

/* Micro-press button feedback for mobile */
button, .btn, .nav-dock-item, .category-chip {
    touch-action: manipulation;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

button:active, .btn:active, .category-chip:active {
    transform: scale(0.96);
}

/* ==========================================================================
   1. FIXED MOBILE BOTTOM NAVIGATION DOCK (APP BAR)
   ========================================================================== */
.mobile-bottom-dock {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--mobile-nav-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: rgba(18, 7, 7, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(212, 175, 55, 0.2);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1040;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
}

.dock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 6px 10px;
    border-radius: 12px;
    position: relative;
    flex: 1;
    max-width: 80px;
    transition: 0.2s;
}

.dock-item i {
    font-size: 1.25rem;
    margin-bottom: 3px;
    transition: 0.2s;
}

.dock-item:hover, .dock-item:focus {
    color: var(--gold-light);
}

.dock-item.active {
    color: var(--gold);
}

.dock-item.active i {
    transform: translateY(-2px);
    color: var(--gold);
    filter: drop-shadow(0 2px 8px rgba(212, 175, 55, 0.5));
}

.dock-item.active::after {
    content: '';
    position: absolute;
    bottom: 3px;
    width: 16px;
    height: 3px;
    background: var(--gold);
    border-radius: 10px;
}

.dock-badge {
    position: absolute;
    top: 2px;
    right: 18px;
    background: #ff2a1a;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 20px;
    border: 2px solid #140808;
    line-height: 1;
    min-width: 18px;
    text-align: center;
}

/* Center Highlight Button in Dock (Cart or WhatsApp) */
.dock-item-highlight {
    color: #000 !important;
}

.dock-item-highlight .dock-icon-circle {
    width: 44px;
    height: 44px;
    background: var(--gold-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
    margin-top: -15px;
    border: 3px solid #140808;
}

.dock-item-highlight .dock-icon-circle i {
    font-size: 1.2rem;
    margin-bottom: 0;
    color: #000;
}

/* ==========================================================================
   2. MOBILE HORIZONTAL CATEGORY CHIP PILLS
   ========================================================================== */
.mobile-categories-wrapper {
    background: var(--bg-card);
    border-bottom: 1px solid rgba(212, 175, 55, 0.15);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 1020;
    backdrop-filter: blur(10px);
}

.category-chips-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 15px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.category-chips-scroll::-webkit-scrollbar {
    display: none;
}

.category-chip {
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(212, 175, 55, 0.2);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.category-chip:hover {
    background: rgba(212, 175, 55, 0.15);
    color: var(--gold-light);
    border-color: var(--gold);
}

.category-chip.active {
    background: var(--gold-gradient);
    color: #000;
    border-color: var(--gold);
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.35);
}

/* ==========================================================================
   3. MOBILE CART BOTTOM SHEET
   ========================================================================== */
@media (max-width: 767.98px) {
    #cartModal .modal-dialog {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0;
        max-width: 100%;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.1, 0.9, 0.2, 1);
    }

    #cartModal.show .modal-dialog {
        transform: translateY(0);
    }

    #cartModal .modal-content {
        border-radius: 26px 26px 0 0 !important;
        max-height: 85vh;
        display: flex;
        flex-direction: column;
        padding-bottom: var(--safe-bottom);
        border: 1px solid rgba(212, 175, 55, 0.3) !important;
        border-bottom: none !important;
    }

    /* Modal drag handle */
    #cartModal .modal-header {
        position: relative;
        padding-top: 25px;
    }

    #cartModal .modal-header::before {
        content: '';
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: 44px;
        height: 5px;
        background: #ccc;
        border-radius: 10px;
    }

    #cartModal .modal-body {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 20px;
    }
}

/* ==========================================================================
   4. STICKY MOBILE BUY BAR FOR SINGLE PRODUCT PAGE
   ========================================================================== */
.product-sticky-bar {
    position: fixed;
    bottom: calc(var(--mobile-nav-height) + var(--safe-bottom));
    left: 0;
    right: 0;
    background: rgba(20, 8, 8, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(212, 175, 55, 0.2);
    padding: 10px 15px;
    z-index: 1030;
    box-shadow: 0 -5px 25px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.product-sticky-price {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--gold);
    line-height: 1.1;
}

.product-sticky-actions {
    display: flex;
    gap: 8px;
    flex-grow: 1;
    justify-content: flex-end;
}

/* ==========================================================================
   5. PWA FLOATING INSTALL BANNER
   ========================================================================== */
.pwa-install-banner {
    position: fixed;
    bottom: calc(var(--mobile-nav-height) + var(--safe-bottom) + 15px);
    left: 15px;
    right: 15px;
    max-width: 460px;
    margin: 0 auto;
    background: rgba(31, 13, 13, 0.96);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--gold);
    border-radius: 20px;
    padding: 14px 18px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7), 0 0 20px rgba(212, 175, 55, 0.2);
    z-index: 1050;
    display: none;
    align-items: center;
    gap: 14px;
    animation: pwaSlideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@media (min-width: 992px) {
    .pwa-install-banner {
        bottom: 25px;
        right: 25px;
        left: auto;
    }
}

.pwa-install-banner.show {
    display: flex;
}

@keyframes pwaSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.pwa-banner-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    flex-shrink: 0;
}

.pwa-banner-content {
    flex-grow: 1;
    min-width: 0;
}

.pwa-banner-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--gold);
    margin: 0 0 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pwa-banner-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0;
}

.pwa-banner-btn {
    background: var(--gold-gradient);
    color: #000;
    font-weight: 700;
    font-size: 0.82rem;
    padding: 8px 16px;
    border-radius: 10px;
    border: none;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.pwa-banner-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    padding: 4px;
    margin-left: -5px;
}

.pwa-banner-close:hover {
    color: #fff;
}

/* ==========================================================================
   6. PWA TOAST NOTIFICATIONS
   ========================================================================== */
.pwa-toast {
    position: fixed;
    top: calc(15px + var(--safe-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 1090;
    max-width: 90%;
    width: 420px;
}

.pwa-toast-inner {
    background: rgba(20, 8, 8, 0.95);
    border: 1px solid var(--gold);
    border-radius: 16px;
    padding: 12px 18px;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

/* ==========================================================================
   7. iOS SAFARI INSTALL INSTRUCTIONS MODAL
   ========================================================================== */
.ios-guide-step {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    margin-bottom: 12px;
    border: 1px solid rgba(212, 175, 55, 0.1);
}

.ios-step-num {
    width: 32px;
    height: 32px;
    background: var(--gold);
    color: #000;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ==========================================================================
   8. STANDALONE APP COMPENSATIONS
   ========================================================================== */
body.is-pwa-standalone {
    user-select: none;
    -webkit-user-select: none;
}

body.is-pwa-standalone header.header-main {
    padding-top: calc(15px + var(--safe-top));
}

/* Badge bounce animation */
@keyframes badgePop {
    0% { transform: scale(0.6); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.badge-pop {
    animation: badgePop 0.35s ease-out;
}
