/* Mobile V2 - Premium UI Overrides */

@media (max-width: 768px) {

    /* Fixed Search Header - Mantener el gradiente azul del brand */
    .header {
        position: sticky !important;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        min-height: 60px;
        background: #2563eb !important;
        display: flex;
        align-items: center;
        padding: 8px 16px;
    }

    .header-content {
        width: 100%;
        padding: 0 !important;
    }

    .header-top {
        display: flex !important;
        align-items: center;
        width: 100%;
        gap: 12px;
        padding: 0;
        min-height: auto;
    }

    .logo {
        flex-shrink: 0;
    }

    /* Logo más grande y visible */
    .logo-image {
        height: 38px !important;
        width: auto !important;
        max-width: 140px !important;
        min-width: auto !important;
    }

    .search-container {
        flex: 1;
        display: block !important;
        /* Force visible on mobile */
        margin: 0 !important;
    }

    .search-container--hidden-on-home {
        display: block !important;
    }

    .search-form {
        background: none;
        border-radius: 0;
        padding: 0;
        display: flex;
        align-items: center;
        border: none;
    }

    .search-input-wrapper {
        width: 100%;
        display: flex;
        align-items: center;
    }

    .search-icon-left {
        color: #9ca3af;
        font-size: 14px;
    }

    .search-input {
        background: rgba(255, 255, 255, 0.95);
        border: none;
        padding: 10px 12px 10px 38px;
        font-size: 14px;
        color: #1f2937;
        width: 100%;
        border-radius: 8px;
        font-family: 'Inter', sans-serif;
        outline: none;
        box-shadow: none;
        -webkit-appearance: none;
        appearance: none;
    }

    .search-input::placeholder {
        color: #9ca3af;
    }

    .search-input:focus {
        outline: none;
        background: white;
        box-shadow: none;
    }

    /* Categories Icon instead of Hamburger */
    .mobile-menu-btn {
        background: rgba(255, 255, 255, 0.15) !important;
        color: white !important;
        width: 40px !important;
        height: 40px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 8px !important;
        border: none !important;
    }

    .mobile-menu-btn:hover {
        background: rgba(255, 255, 255, 0.25) !important;
    }

    .mobile-menu-btn i {
        font-size: 20px;
        color: white;
    }

    /* Change Bars icon to Th-large for categories look */
    .mobile-menu-btn .fa-bars:before {
        content: "\f009";
        /* fa-th-large */
        font-weight: 900;
    }

    /* Hide desktop actions */
    .header-actions.desktop-only {
        display: none !important;
    }

    /* Sticky Action Bar in Ad Detail - Refined Layout */
    .sticky-action-bar {
        position: fixed;
        bottom: calc(64px + env(safe-area-inset-bottom));
        left: 0;
        right: 0;
        background: #fff;
        padding: 10px 16px;
        display: flex;
        gap: 12px;
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
        z-index: 9997;
        /* Below mobile footer (99999) and chatbot (9998) */
        border-top: 1px solid #f1f5f9;
        transition: transform 0.3s ease;
    }

    .sticky-action-bar .btn-offer {
        flex: 1;
        background: #fff;
        border: 2px solid #FF6600;
        color: #FF6600;
        font-weight: 700;
        padding: 12px;
        border-radius: 12px;
        text-align: center;
        text-decoration: none;
        font-size: 15px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s;
    }

    .sticky-action-bar .btn-buy {
        flex: 1;
        background: #FF6600;
        border: 2px solid #FF6600;
        color: #fff;
        font-weight: 700;
        padding: 12px;
        border-radius: 12px;
        text-align: center;
        text-decoration: none;
        font-size: 15px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s;
        box-shadow: 0 4px 12px rgba(255, 102, 0, 0.2);
    }

    .sticky-action-bar .btn-offer:active,
    .sticky-action-bar .btn-buy:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    /* Mobile Breadcrumb in Footer - More subtle */
    .mobile-footer-breadcrumb {
        padding: 20px 16px;
        background: #f8fafc;
        border-top: 1px solid #e2e8f0;
        margin-top: 40px;
        margin-bottom: 20px;
    }

    .mobile-footer-breadcrumb .breadcrumb-items {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        font-size: 12px;
        align-items: center;
        justify-content: center;
    }

    .mobile-footer-breadcrumb .breadcrumb-item {
        color: #64748b;
        text-decoration: none;
        font-weight: 500;
    }

    .mobile-footer-breadcrumb .breadcrumb-separator {
        color: #cbd5e1;
        font-size: 10px;
    }

    /* NO sobrescribir estilos del mobile-footer - usar los de footer.php */

    /* Visibility helpers */
    .mobile-only {
        display: none;
    }
}

@media (max-width: 768px) {
    .mobile-only {
        display: flex !important;
    }

    div.mobile-only {
        display: block !important;
    }

    .sticky-action-bar.mobile-only {
        display: flex !important;
    }

    /* Adjust main content padding to accommodate sticky bar at bottom */
    body.is-ad-detail {
        padding-bottom: calc(140px + env(safe-area-inset-bottom)) !important;
    }
}

/* Móviles más pequeños */
@media (max-width: 480px) {
    .header {
        padding: 6px 12px;
        min-height: 56px;
    }

    .logo-image {
        height: 30px !important;
        max-width: 110px !important;
    }

    .search-form {
        padding: 0;
    }

    .search-input {
        font-size: 13px;
    }

    .mobile-menu-btn {
        width: 36px !important;
        height: 36px !important;
    }

    .mobile-menu-btn i {
        font-size: 18px;
    }
}

/* Móviles muy pequeños */
@media (max-width: 360px) {
    .header {
        padding: 4px 8px;
        min-height: 52px;
    }

    .logo-image {
        height: 26px !important;
        max-width: 90px !important;
    }

    .search-form {
        padding: 0;
    }

    .search-input {
        font-size: 12px;
    }

    .header-top {
        gap: 8px;
    }
}
