/**
 * LFA Mobile Bottom Navigation - Styles
 * Version: 1.0.0
 * iOS/Android style bottom navigation
 */

/* ========================================
   BOTTOM NAVIGATION BAR
   ======================================== */

.lfa-mobile-bottom-nav {
    display: none; /* Hidden by default, shown only on mobile */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    padding-bottom: env(safe-area-inset-bottom, 0); /* iOS safe area */
    transition: transform 0.3s ease;
}

/* Show on mobile only */
@media (max-width: 767px) {
    .lfa-mobile-bottom-nav {
        display: block;
    }
    
    /* Add bottom padding to body to prevent content being hidden */
    body {
        padding-bottom: 70px;
    }
    
    body.admin-bar {
        padding-bottom: 70px;
    }
}

.lfa-mobile-nav-inner {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 0;
    max-width: 100%;
}

/* ========================================
   NAVIGATION ITEMS
   ======================================== */

.lfa-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #666;
    background: transparent;
    border: none;
    padding: 8px 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

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

.lfa-nav-item.active {
    color: #2c5282;
}

.lfa-nav-item.active .lfa-nav-icon {
    stroke: #2c5282;
}

/* Icon wrapper for badge */
.lfa-nav-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Icon */
.lfa-nav-icon {
    width: 24px;
    height: 24px;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    margin-bottom: 4px;
}

/* Label */
.lfa-nav-label {
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
}

/* Cart count badge */
.lfa-cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e53e3e;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    animation: cartBadgePop 0.3s ease;
}

@keyframes cartBadgePop {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* ========================================
   SEARCH OVERLAY
   ======================================== */

.lfa-search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    animation: fadeIn 0.3s ease;
}

.lfa-search-overlay.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.lfa-search-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    max-height: 80vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Search header */
.lfa-search-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f7fafc;
}

.lfa-search-close {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.lfa-search-close svg {
    width: 24px;
    height: 24px;
    stroke: #4a5568;
}

.lfa-search-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
}

/* Search input */
.lfa-search-input-wrapper {
    position: relative;
    padding: 20px;
}

.lfa-search-input-icon {
    position: absolute;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    stroke: #a0aec0;
    pointer-events: none;
}

.lfa-search-input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    color: #2d3748;
    background: #ffffff;
    transition: border-color 0.2s ease;
}

.lfa-search-input:focus {
    outline: none;
    border-color: #4299e1;
}

/* Search results */
.lfa-search-results {
    padding: 0 20px 20px;
}

.lfa-search-results.loading {
    text-align: center;
    padding: 40px 20px;
    color: #718096;
}

.lfa-search-results.empty {
    text-align: center;
    padding: 40px 20px;
    color: #718096;
}

.lfa-search-result-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #f7fafc;
    text-decoration: none;
    color: #2d3748;
    transition: all 0.2s ease;
}

.lfa-search-result-item:hover,
.lfa-search-result-item:active {
    background: #edf2f7;
    transform: translateX(5px);
}

.lfa-search-result-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    margin-right: 15px;
    background: #e2e8f0;
}

.lfa-search-result-content {
    flex: 1;
}

.lfa-search-result-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #2d3748;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lfa-search-result-price {
    font-size: 14px;
    font-weight: 700;
    color: #2c5282;
}

.lfa-search-result-stock {
    font-size: 12px;
    color: #48bb78;
    margin-top: 2px;
}

.lfa-search-result-stock.out-of-stock {
    color: #f56565;
}

/* ========================================
   MENU OVERLAY
   ======================================== */

.lfa-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    animation: fadeIn 0.3s ease;
}

.lfa-menu-overlay.active {
    display: block;
}

.lfa-menu-container {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 85%;
    max-width: 400px;
    background: #ffffff;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: slideInRight 0.3s ease;
}

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

/* Menu header */
.lfa-menu-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f7fafc;
}

.lfa-menu-close {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.lfa-menu-close svg {
    width: 24px;
    height: 24px;
    stroke: #4a5568;
}

.lfa-menu-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
}

/* Menu content */
.lfa-menu-content {
    padding: 20px;
}

.lfa-menu-section {
    margin-bottom: 30px;
}

.lfa-menu-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
}

/* Menu lists */
.lfa-mobile-menu,
.lfa-categories-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.lfa-mobile-menu li,
.lfa-categories-menu li {
    margin-bottom: 2px;
}

.lfa-mobile-menu a,
.lfa-categories-menu a {
    display: block;
    padding: 12px 15px;
    color: #2d3748;
    text-decoration: none;
    font-size: 15px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.lfa-mobile-menu a:hover,
.lfa-mobile-menu a:active,
.lfa-categories-menu a:hover,
.lfa-categories-menu a:active {
    background: #edf2f7;
    color: #2c5282;
    transform: translateX(5px);
}

.category-count {
    color: #a0aec0;
    font-size: 13px;
}

/* Submenu */
.lfa-mobile-menu .sub-menu {
    list-style: none;
    margin: 5px 0;
    padding-left: 15px;
}

.lfa-mobile-menu .sub-menu a {
    font-size: 14px;
    padding: 10px 15px;
}

/* ========================================
   LOADING SPINNER
   ======================================== */

.lfa-loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #4299e1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

/* Very small screens (iPhone SE, etc.) */
@media (max-width: 375px) {
    .lfa-nav-label {
        font-size: 10px;
    }
    
    .lfa-nav-icon {
        width: 22px;
        height: 22px;
    }
    
    .lfa-search-result-image {
        width: 50px;
        height: 50px;
    }
}

/* Landscape mode */
@media (max-height: 500px) and (orientation: landscape) {
    .lfa-search-container,
    .lfa-menu-container {
        max-height: 100vh;
    }
}

/* ========================================
   DARK MODE SUPPORT (optional)
   ======================================== */

@media (prefers-color-scheme: dark) {
    .lfa-mobile-bottom-nav {
        background: #1a202c;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.5);
    }
    
    .lfa-nav-item {
        color: #a0aec0;
    }
    
    .lfa-nav-item.active {
        color: #63b3ed;
    }
    
    .lfa-search-container,
    .lfa-menu-container {
        background: #2d3748;
    }
    
    .lfa-search-header,
    .lfa-menu-header {
        background: #1a202c;
        border-bottom-color: #4a5568;
    }
    
    .lfa-search-header h3,
    .lfa-menu-header h3,
    .lfa-search-result-title,
    .lfa-mobile-menu a,
    .lfa-categories-menu a {
        color: #e2e8f0;
    }
    
    .lfa-search-input {
        background: #1a202c;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .lfa-search-result-item {
        background: #1a202c;
    }
    
    .lfa-search-result-item:hover,
    .lfa-search-result-item:active {
        background: #4a5568;
    }
}

/* ========================================
   HIDE ON DESKTOP/TABLET
   ======================================== */

@media (min-width: 768px) {
    .lfa-mobile-bottom-nav,
    .lfa-search-overlay,
    .lfa-menu-overlay {
        display: none !important;
    }
    
    body {
        padding-bottom: 0 !important;
    }
}
