/* Mobile Navigation Bar */
.mobile-nav-bar {
    display: none; /* Hidden by default, shown only on mobile */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #222222;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom, 0); /* For iPhone X and newer */
    transition: transform 0.3s ease; /* Smooth transition for hiding/showing */
}

/* Hide navigation bar when footer is visible */
.mobile-nav-bar.hide {
    transform: translateY(100%);
}

.mobile-nav-buttons {
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 0;
}

.mobile-nav-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #f5f5f5;
    text-decoration: none;
    border: none;
    background: none;
    padding: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    width: 33.333%;
}

.mobile-nav-button i {
    font-size: 1.4rem;
    margin-bottom: 0.25rem;
    color: #f5f5f5;
    display: inline-block;
    width: 1.4rem;
    text-align: center;
}

.nav-label {
    font-size: 0.8rem;
    color: #f5f5f5;
}

.mobile-nav-button:hover i,
.mobile-nav-button:active i,
.mobile-nav-button.active i {
    color: #e1af1a; /* Gold accent color for active/hover state */
}

/* Mobile Search Container */
.mobile-search-container {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background-color: #222222;
    padding: 1rem;
    transform: translateY(100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
}

.mobile-search-container.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Search wrapper and input styling */
.mobile-search-container .search-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.mobile-search-input {
    flex-grow: 1;
    padding: 0.875rem 3rem 0.875rem 1rem;
    border: 1px solid #444;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #fff;
    background-color: #333;
    transition: all 0.2s ease;
}

.search-submit-btn {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #e1af1a;
    font-size: 1.2rem;
    cursor: pointer;
}

/* Search loader (spinner) */
.mobile-search-container .search-loader {
    position: absolute;
    right: 3.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 2px solid #444;
    border-top: 2px solid #e1af1a;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
}

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

/* Mobile Search Results Overlay - COMPLETELY NEW SECTION */
.mobile-search-results-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.95);
    z-index: 1100; /* Higher than nav bar */
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s 0.3s;
    padding-bottom: 70px; /* Space for navbar below */
    overflow-y: auto;
}

.mobile-search-results-overlay.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Search header with title and close button */
.mobile-search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: #222222;
    border-bottom: 1px solid #444;
    position: sticky;
    top: 0;
    z-index: 10;
}

.search-title {
    font-size: 1rem;
    font-weight: 600;
    color: #f5f5f5;
}

.close-search {
    background: none;
    border: none;
    color: #f5f5f5;
    font-size: 1.2rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.close-search:hover {
    background-color: rgba(255,255,255,0.1);
}

.mobile-results-container .search-result-item {
    display: flex;
    align-items: flex-start;
    padding: 1rem;
    text-decoration: none;
    border-bottom: 1px solid #444;
    transition: background-color 0.2s ease;
    background-color: #222222;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.mobile-results-container .search-result-item:last-child {
    margin-bottom: 0;
}

.mobile-results-container .search-result-item:hover {
    background-color: #333333;
    border-left: none;
    padding-left: 1rem;
}

.mobile-results-container .search-result-image {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
    margin-right: 1rem;
    flex-shrink: 0;
}

.mobile-results-container .search-result-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.mobile-results-container .search-result-title {
    color: #ffffff !important;  /* Force white text */
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    white-space: normal; /* Allow text wrapping on mobile */
}

.mobile-results-container .search-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
    color: #999 !important; /* Force consistent color */
}

.mobile-results-container .search-result-meta span {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.mobile-results-container .search-result-meta i {
    color: #e1af1a !important; /* Force gold icon color */
    font-size: 0.875rem;
}

.mobile-results-container .no-results {
    padding: 2rem 1rem;
    text-align: center;
    color: #999;
    font-size: 1rem;
}

.no-results {
    padding: 2rem 1rem;
    text-align: center;
    color: #999;
    font-size: 1rem;
}

/* Add body class to prevent scrolling when search is active */
body.mobile-search-active {
    overflow: hidden;
}

/* Bottom padding for content to prevent overlap with the mobile nav */
@media (max-width: 768px) {
    main {
        padding-bottom: 70px; /* Adjust based on mobile nav height */
    }
    
    .mobile-nav-bar {
        display: block;
    }
    
    /* Additional spacing for iPhone X and newer */
    @supports (padding-bottom: env(safe-area-inset-bottom)) {
        main {
            padding-bottom: calc(70px + env(safe-area-inset-bottom, 0));
        }
    }
}

/* Responsive adjustment for very small screens */
@media (max-width: 320px) {
    .nav-label {
        font-size: 0.7rem;
    }
    
    .mobile-nav-button i {
        font-size: 1.2rem;
    }
    
    .search-result-image {
        width: 45px;
        height: 45px;
    }
    
    .search-result-title {
        font-size: 0.9rem;
    }
}