/* ============================================
   MOBILE-FIRST STYLES - TIC DONE
   ============================================ */

/* Variables Mobile */
:root {
    --mobile-nav-height: 64px;
    --mobile-header-height: 56px;
    --mobile-padding: 16px;
    --mobile-gap: 12px;
    --touch-target-min: 44px;
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* Reset & Base Mobile */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

body.is-mobile {
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}

/* Touch-Friendly Buttons */
.btn-mobile,
button,
a.button {
    min-height: var(--touch-target-min);
    min-width: var(--touch-target-min);
    padding: 12px 20px;
    font-size: 16px;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

/* Ripple Effect */
.btn-mobile::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-mobile:active::before {
    width: 300px;
    height: 300px;
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--mobile-nav-height) + var(--safe-area-bottom));
    background: white;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    padding-bottom: var(--safe-area-bottom);
}

.mobile-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: var(--touch-target-min);
    color: #6b7280;
    transition: all 0.2s ease;
    position: relative;
}

.mobile-bottom-nav .nav-item.active {
    color: #2563eb;
}

.mobile-bottom-nav .nav-item:active {
    transform: scale(0.95);
}

.mobile-bottom-nav .nav-item .badge {
    position: absolute;
    top: 8px;
    right: 20%;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Mobile Header */
.mobile-header {
    position: sticky;
    top: 0;
    height: var(--mobile-header-height);
    background: white;
    border-bottom: 1px solid #e5e7eb;
    z-index: 999;
    display: flex;
    align-items: center;
    padding: 0 var(--mobile-padding);
    gap: var(--mobile-gap);
}

/* Mobile Search Bar */
.mobile-search {
    flex: 1;
    position: relative;
}

.mobile-search input {
    width: 100%;
    height: 40px;
    padding: 0 40px 0 40px;
    border-radius: 20px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    font-size: 14px;
}

.mobile-search .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

.mobile-search .voice-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #2563eb;
    cursor: pointer;
}

/* Mobile Cards */
.mobile-card {
    background: white;
    border-radius: 16px;
    padding: var(--mobile-padding);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: var(--mobile-gap);
}

/* Mobile Product Card */
.mobile-product-card {
    display: flex;
    gap: 12px;
    background: white;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 12px;
}

.mobile-product-card .image {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.mobile-product-card .content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mobile-product-card .title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mobile-product-card .price {
    font-size: 16px;
    font-weight: 700;
    color: #2563eb;
}

.mobile-product-card .seller {
    font-size: 12px;
    color: #6b7280;
}

/* Mobile Filters */
.mobile-filters {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: var(--mobile-padding);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

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

.mobile-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-filter-chip.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.mobile-filter-chip:active {
    transform: scale(0.95);
}

/* Mobile Bottom Sheet */
.mobile-bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    max-height: 80vh;
    overflow-y: auto;
}

.mobile-bottom-sheet.open {
    transform: translateY(0);
}

.mobile-bottom-sheet .handle {
    width: 40px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
    margin: 12px auto;
}

/* Mobile Swipe Actions */
.swipeable {
    position: relative;
    overflow: hidden;
}

.swipe-actions {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.swipeable.swiped .swipe-actions {
    transform: translateX(0);
}

.swipe-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    color: white;
    font-weight: 600;
    cursor: pointer;
}

.swipe-action.delete {
    background: #ef4444;
}

.swipe-action.favorite {
    background: #f59e0b;
}

/* Mobile Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 8px;
}

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

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 24px;
    width: 70%;
    margin-bottom: 12px;
}

.skeleton-image {
    height: 200px;
    width: 100%;
}

/* Mobile Pull to Refresh */
.pull-to-refresh {
    position: absolute;
    top: -60px;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.pull-to-refresh.pulling {
    transform: translateY(60px);
}

.pull-to-refresh .spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mobile Toast */
.mobile-toast {
    position: fixed;
    bottom: calc(var(--mobile-nav-height) + 16px + var(--safe-area-bottom));
    left: 50%;
    transform: translateX(-50%);
    background: #111827;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    animation: slideUp 0.3s ease;
    max-width: calc(100% - 32px);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* Mobile Sticky Action Bar */
.mobile-sticky-bar {
    position: fixed;
    bottom: calc(var(--mobile-nav-height) + var(--safe-area-bottom));
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    padding: 12px var(--mobile-padding);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    z-index: 998;
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Mobile Gestures */
.gesture-swipe-left {
    animation: swipeLeft 0.3s ease;
}

.gesture-swipe-right {
    animation: swipeRight 0.3s ease;
}

@keyframes swipeLeft {
    from { transform: translateX(0); }
    to { transform: translateX(-100%); }
}

@keyframes swipeRight {
    from { transform: translateX(0); }
    to { transform: translateX(100%); }
}

/* Mobile Spacing */
.mobile-container {
    padding: var(--mobile-padding);
    padding-bottom: calc(var(--mobile-nav-height) + var(--mobile-padding) + var(--safe-area-bottom));
}

.mobile-section {
    margin-bottom: 24px;
}

.mobile-section-title {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 12px;
    padding: 0 var(--mobile-padding);
}

/* Mobile Grid */
.mobile-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0 var(--mobile-padding);
}

/* iOS Safe Area */
@supports (padding: max(0px)) {
    .mobile-bottom-nav,
    .mobile-sticky-bar {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}

/* Android Navigation Bar */
body.is-android {
    padding-bottom: 0;
}

/* Landscape Mode */
@media (orientation: landscape) and (max-height: 500px) {
    .mobile-bottom-nav {
        height: 48px;
    }
    
    .mobile-header {
        height: 48px;
    }
}

/* Small Phones (< 375px) */
@media (max-width: 374px) {
    :root {
        --mobile-padding: 12px;
        --mobile-gap: 8px;
    }
    
    .mobile-product-card .image {
        width: 80px;
        height: 80px;
    }
}

/* Large Phones (> 428px) */
@media (min-width: 428px) {
    .mobile-grid-2 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Tablet Portrait */
@media (min-width: 768px) {
    .mobile-bottom-nav,
    .mobile-header,
    .mobile-sticky-bar {
        display: none;
    }
    
    .mobile-container {
        padding-bottom: var(--mobile-padding);
    }
}

/* PWA Install Button */
#pwa-install-button {
    position: fixed;
    bottom: calc(var(--mobile-nav-height) + 16px + var(--safe-area-bottom));
    right: 16px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    padding: 12px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    z-index: 999;
    display: none;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #f59e0b;
    color: white;
    text-align: center;
    padding: 8px;
    font-size: 14px;
    font-weight: 600;
    z-index: 9999;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.offline-indicator.show {
    transform: translateY(0);
}

