/* =========================================
   WARAP MOBILE GLOBAL STYLES
   Centralisation de tous les styles mobiles
   ========================================= */

/* --- MOBILE BOTTOM NAVIGATION --- */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    padding: 8px 0;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.mobile-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.75rem;
    padding: 8px;
    transition: all 0.2s ease;
    position: relative;
}

.mobile-bottom-nav .nav-item i {
    font-size: 1.25rem;
    transition: transform 0.2s ease;
}

.mobile-bottom-nav .nav-item.active {
    color: #6366f1;
    font-weight: 600;
}

.mobile-bottom-nav .nav-item.active i {
    transform: scale(1.1);
}

/* Sell button special styling */
.mobile-bottom-nav .sell-btn {
    position: relative;
}

.mobile-bottom-nav .sell-icon-circle {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    margin-bottom: -20px;
}

/* --- TOUCH OPTIMIZATIONS --- */
@media (max-width: 768px) {

    /* Prevent iOS zoom on input focus */
    input,
    select,
    textarea,
    button {
        font-size: 16px !important;
    }

    /* Larger touch targets (min 48x48px) */
    .btn,
    button,
    .nav-link,
    .mobile-nav-link,
    input[type="submit"],
    input[type="button"],
    input[type="reset"],
    a.btn {
        min-height: 48px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Remove default OS styling */
    button,
    .btn,
    input[type="submit"],
    input[type="button"] {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        outline: none !important;
    }

    /* Touch feedback */
    button:active,
    .btn:active,
    .nav-item:active,
    a:active {
        opacity: 0.7;
        transform: scale(0.98);
    }

    /* Tap highlight color */
    * {
        -webkit-tap-highlight-color: rgba(99, 102, 241, 0.1);
        -webkit-touch-callout: none;
    }

    /* Touch action for better scrolling */
    .btn,
    button,
    a {
        touch-action: manipulation;
    }

    /* Smooth scrolling */
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }

    /* --- MOBILE BOTTOM NAV DISPLAY --- */
    .mobile-bottom-nav {
        display: flex !important;
        justify-content: space-around;
        align-items: center;
    }

    /* Add padding to body to prevent content hiding behind nav */
    body {
        padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    }

    /* Hide desktop navbar elements */
    .navbar-nav,
    .navbar-actions {
        display: none !important;
    }

    /* Show mobile toggle if exists */
    .navbar-toggle,
    .menu-hamburger {
        display: block !important;
    }

    /* --- RESPONSIVE LAYOUTS --- */
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    /* Grid adjustments */
    .product-grid,
    .listings-grid,
    .services-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
    }

    /* Single column for complex cards */
    .card-complex,
    .dashboard-card,
    .stats-card {
        grid-column: span 1;
    }

    /* Full width forms */
    .form-container,
    .checkout-form {
        width: 100%;
        padding: 16px;
    }

    /* --- TYPOGRAPHY --- */
    h1 {
        font-size: 1.75rem !important;
    }

    h2 {
        font-size: 1.5rem !important;
    }

    h3 {
        font-size: 1.25rem !important;
    }

    /* --- MODALS --- */
    .modal,
    .auth-modal {
        padding: 16px;
    }

    .modal-content {
        max-width: 100%;
        margin: 0;
        border-radius: 16px 16px 0 0;
    }

    /* --- TABLES TO CARDS --- */
    .responsive-table thead {
        display: none;
    }

    .responsive-table,
    .responsive-table tbody,
    .responsive-table tr,
    .responsive-table td {
        display: block;
    }

    .responsive-table tr {
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        margin-bottom: 12px;
        padding: 16px;
    }

    .responsive-table td {
        padding: 8px 0;
        border: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .responsive-table td::before {
        content: attr(data-label);
        font-size: 0.8rem;
        font-weight: 500;
        color: #6b7280;
    }

    /* --- SAFE AREA (iOS NOTCH) --- */
    .header,
    .navbar {
        padding-top: env(safe-area-inset-top, 0px);
    }

    .mobile-bottom-nav {
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    }

    /* Fullscreen modals */
    .modal-fullscreen {
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    /* --- SPACING ADJUSTMENTS --- */
    .section {
        padding: 32px 0;
    }

    .card {
        padding: 16px;
    }

    /* Reduce excessive margins */
    .mb-5 {
        margin-bottom: 24px !important;
    }

    .mt-5 {
        margin-top: 24px !important;
    }

    /* --- IMAGES --- */
    img {
        max-width: 100%;
        height: auto;
    }

    .product-image,
    .listing-image {
        width: 100%;
        aspect-ratio: 1;
        object-fit: cover;
    }

    /* --- BUTTONS --- */
    .btn-group {
        flex-direction: column;
        gap: 8px;
    }

    .btn-group .btn {
        width: 100%;
    }

    /* --- FILTERS & SEARCH --- */
    .filter-bar {
        flex-direction: column;
        gap: 12px;
    }

    .filter-group {
        width: 100%;
    }

    .search-bar {
        width: 100%;
    }

    /* --- HIDE ON MOBILE --- */
    .desktop-only {
        display: none !important;
    }

    /* --- SHOW ON MOBILE --- */
    .mobile-only {
        display: block !important;
    }

    /* --- PERFORMANCE --- */
    /* Reduce animations on mobile for better performance */
    @media (prefers-reduced-motion: reduce) {

        *,
        *::before,
        *::after {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }
}

/* --- TABLET (768px - 1024px) --- */
@media (min-width: 768px) and (max-width: 1024px) {

    .product-grid,
    .listings-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .container {
        max-width: 720px;
    }
}

/* --- LANDSCAPE MOBILE --- */
@media (max-width: 768px) and (orientation: landscape) {
    .mobile-bottom-nav {
        padding: 4px 0;
        padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px));
    }

    .mobile-bottom-nav .nav-item {
        font-size: 0.7rem;
        padding: 4px;
    }

    .mobile-bottom-nav .nav-item i {
        font-size: 1.1rem;
    }

    /* Reduce header height */
    .header,
    .navbar {
        padding-top: 8px;
        padding-bottom: 8px;
    }
}

/* --- DARK MODE MOBILE --- */
@media (max-width: 768px) and (prefers-color-scheme: dark) {
    .mobile-bottom-nav {
        background: rgba(19, 19, 31, 0.98);
        border-top-color: rgba(255, 255, 255, 0.08);
    }

    .mobile-bottom-nav .nav-item {
        color: #9ca3af;
    }

    .mobile-bottom-nav .nav-item.active {
        color: #818cf8;
    }
}