/**
 * Mobile Bottom Navigation & Search Container Styles
 * =================================================
 * - 64px fixed bottom bar, hidden on desktop >=768px
 * - Dark theme: market pages (via [data-theme="dark"]) or .widget-theme-dark
 * - Light theme: .widget-theme-light
 * - FAB link and search modes
 * - Full-screen search overlay with slide-up animation
 */

/* ================================================
   Bottom Navigation Bar
   ================================================ */

.m-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9998;
    display: none; /* Hidden on desktop */
}

@media (max-width: 767px) {
    .m-bottom-nav {
        display: block;
    }
}

.m-bottom-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: 64px;
    padding: 0 4px;
    background: #111827;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
}

/* Dark theme (market pages via data-theme or fallback) */
[data-theme="dark"] .m-bottom-nav-inner,
.widget-theme-dark .m-bottom-nav-inner,
.m-bottom-nav.widget-theme-dark .m-bottom-nav-inner {
    background: #111827;
    border-top-color: rgba(255, 255, 255, 0.08);
}

/* Light theme */
.widget-theme-light .m-bottom-nav-inner,
.m-bottom-nav.widget-theme-light .m-bottom-nav-inner {
    background: #ffffff;
    border-top-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
}

/* Nav items */
.m-bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
    min-width: 0;
    padding: 9px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

[data-theme="dark"] .m-bottom-nav-item,
.widget-theme-dark .m-bottom-nav-item {
    color: rgba(255, 255, 255, 0.5);
}

.widget-theme-light .m-bottom-nav-item,
.m-bottom-nav.widget-theme-light .m-bottom-nav-item {
    color: rgba(0, 0, 0, 0.45);
}

.m-bottom-nav-item:hover,
.m-bottom-nav-item:focus-visible {
    color: rgba(255, 255, 255, 0.9);
    outline: none;
}

.widget-theme-light .m-bottom-nav-item:hover,
.widget-theme-light .m-bottom-nav-item:focus-visible {
    color: rgba(0, 0, 0, 0.8);
}

.m-bottom-nav-item.active {
    color: #3b82f6;
}

.widget-theme-light .m-bottom-nav-item.active {
    color: #2563eb;
}

.m-bottom-nav-item .iconify,
.m-bottom-nav-item i {
    font-size: 22px;
    line-height: 1;
    margin-bottom: 2px;
    display: block;
}

.m-bottom-nav-item img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 2px;
}

.m-bottom-nav-item span:not(.iconify) {
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ================================================
   FAB (Center floating button)
   ================================================ */

.m-bottom-nav-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #ffffff;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    transform: translateY(-16px);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

[data-theme="dark"] .m-bottom-nav-fab,
.widget-theme-dark .m-bottom-nav-fab {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
}

.widget-theme-light .m-bottom-nav-fab {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35), 0 2px 6px rgba(0, 0, 0, 0.12);
}

.m-bottom-nav-fab:hover,
.m-bottom-nav-fab:focus-visible {
    transform: scale(1.08);
    outline: none;
}

.m-bottom-nav-fab:active {
    transform: scale(0.95);
}

.m-bottom-nav-fab .iconify,
.m-bottom-nav-fab i {
    font-size: 26px;
    line-height: 1;
}

/* ================================================
   Search Overlay
   ================================================ */

.m-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.m-search-overlay--open {
    animation: m-search-fade-in 0.3s ease forwards;
}

@keyframes m-search-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.m-search-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 88vh;
    background: #1e1e2e;
    border-radius: 20px 20px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
}

.m-search-overlay--open .m-search-container {
    transform: translateY(0);
}

/* Light theme search */
.widget-theme-light .m-search-container {
    background: #ffffff;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
}

/* ================================================
   Search Header
   ================================================ */

.m-search-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.widget-theme-light .m-search-header {
    background: rgba(0, 0, 0, 0.02);
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

.m-search-exit {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.widget-theme-light .m-search-exit {
    background: rgba(0, 0, 0, 0.06);
    color: rgba(0, 0, 0, 0.6);
}

.m-search-exit:hover {
    background: rgba(255, 255, 255, 0.15);
}

.widget-theme-light .m-search-exit:hover {
    background: rgba(0, 0, 0, 0.1);
}

.m-search-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.m-search-icon {
    position: absolute;
    left: 12px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 14px;
    pointer-events: none;
}

.widget-theme-light .m-search-icon {
    color: rgba(0, 0, 0, 0.35);
}

.m-search-input {
    width: 100%;
    height: 40px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: #ffffff;
    font-size: 15px;
    padding: 0 36px 0 38px;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.widget-theme-light .m-search-input {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
    color: #1a1a1a;
}

.m-search-input:focus {
    border-color: rgba(59, 130, 246, 0.5);
    background: rgba(59, 130, 246, 0.05);
}

.m-search-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.widget-theme-light .m-search-input::placeholder {
    color: rgba(0, 0, 0, 0.3);
}

.m-search-clear {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.widget-theme-light .m-search-clear {
    color: rgba(0, 0, 0, 0.4);
}

/* ================================================
   Search Tabs
   ================================================ */

.m-search-tabs {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.02);
    flex-shrink: 0;
    scrollbar-width: none;
}

.m-search-tabs::-webkit-scrollbar { display: none; }

.widget-theme-light .m-search-tabs {
    background: rgba(0, 0, 0, 0.01);
}

.m-search-tab {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.widget-theme-light .m-search-tab {
    border-color: rgba(0, 0, 0, 0.1);
    color: rgba(0, 0, 0, 0.5);
}

.m-search-tab:hover {
    border-color: rgba(59, 130, 246, 0.4);
    color: rgba(255, 255, 255, 0.8);
}

.widget-theme-light .m-search-tab:hover {
    border-color: rgba(37, 99, 235, 0.4);
    color: rgba(0, 0, 0, 0.7);
}

.m-search-tab.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
}

.widget-theme-light .m-search-tab.active {
    background: #2563eb;
    border-color: #2563eb;
}

/* ================================================
   Search Body (results area)
   ================================================ */

.m-search-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 8px 0;
}

.m-search-empty,
.m-search-loading,
.m-search-no-results,
.m-search-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 24px;
    color: rgba(255, 255, 255, 0.35);
    font-size: 14px;
    text-align: center;
}

.widget-theme-light .m-search-empty,
.widget-theme-light .m-search-no-results,
.widget-theme-light .m-search-error {
    color: rgba(0, 0, 0, 0.3);
}

.m-search-empty i,
.m-search-no-results i,
.m-search-error i {
    font-size: 40px;
    opacity: 0.4;
}

.widget-theme-light .m-search-empty i,
.widget-theme-light .m-search-no-results i,
.widget-theme-light .m-search-error i {
    color: rgba(0, 0, 0, 0.2);
}

.m-search-spinner {
    color: #3b82f6;
}

/* ================================================
   Search Result Cards
   ================================================ */

.m-search-results {
    padding: 0 12px;
}

.m-search-section {
    margin-bottom: 16px;
}

.m-search-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 4px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 6px;
}

.widget-theme-light .m-search-section-header {
    color: rgba(0, 0, 0, 0.4);
    border-bottom-color: rgba(0, 0, 0, 0.05);
}

.m-search-section-header .badge {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.widget-theme-light .m-search-section-header .badge {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
}

.m-search-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    border-radius: 10px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.85);
    transition: background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.widget-theme-light .m-search-card {
    color: rgba(0, 0, 0, 0.75);
}

.m-search-card:hover,
.m-search-card:focus-visible {
    background: rgba(255, 255, 255, 0.06);
    outline: none;
}

.widget-theme-light .m-search-card:hover,
.widget-theme-light .m-search-card:focus-visible {
    background: rgba(0, 0, 0, 0.04);
}

.m-search-card-info {
    flex: 1;
    min-width: 0;
}

.m-search-card-name {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.m-search-card-sub {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.widget-theme-light .m-search-card-sub {
    color: rgba(0, 0, 0, 0.4);
}

.m-search-card-price {
    font-size: 13px;
    font-weight: 700;
    color: #fb923c;
    white-space: nowrap;
    flex-shrink: 0;
}

.m-search-card-title {
    display: none; /* used for section header only */
}

/* Avatars / thumbnails */
.m-search-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.m-search-avatar--sm {
    width: 32px;
    height: 32px;
}

.m-search-avatar--placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 16px;
    flex-shrink: 0;
}

.widget-theme-light .m-search-avatar--placeholder {
    background: rgba(0, 0, 0, 0.06);
    color: rgba(0, 0, 0, 0.25);
}

.m-search-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.m-search-thumb--placeholder {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.25);
    font-size: 18px;
}

.widget-theme-light .m-search-thumb--placeholder {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.2);
}

/* ================================================
   Accessibility
   ================================================ */

@media (prefers-reduced-motion: reduce) {
    .m-search-overlay--open {
        animation: none;
    }
    .m-search-overlay--open .m-search-container {
        transition: none;
    }
    .m-bottom-nav-fab {
        transition: none;
    }
}

/* Focus visible for keyboard navigation */
.m-bottom-nav-item:focus-visible,
.m-bottom-nav-fab:focus-visible,
.m-search-tab:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
}

.widget-theme-light .m-bottom-nav-item:focus-visible,
.widget-theme-light .m-bottom-nav-fab:focus-visible,
.widget-theme-light .m-search-tab:focus-visible {
    outline-color: #2563eb;
}
