/* ========================================
   MOBILE HEADER - Hidden on Desktop
======================================== */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(245, 245, 247, 0.85); /* Translucent */
    border-bottom: 1px solid rgba(0,0,0,0.1);
    z-index: 1000;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-sizing: border-box;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.mobile-logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 17px;
    font-weight: 600;
    color: #1d1d1f;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.mobile-logo img {
    max-height: 36px;
    width: auto;
}

.mobile-nav-toggle,
.mobile-search-toggle {
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    color: #007AFF;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

/* Show header only on mobile */
@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }
    body {
        padding-top: 60px;
    }
}

/* Desktop: Hide mobile header */
@media (min-width: 769px) {
    .mobile-header {
        display: none !important;
    }
    
    .mobile-search-modal {
        display: none !important;
    }
}

/* ========================================
   REDESIGNED SEARCH OVERLAY (iOS Style)
======================================== */
.mobile-search-modal {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    z-index: 2000; /* Above header */
}

/* Forced Visible State */
.mobile-search-modal.active {
    display: block !important;
}

.mobile-search-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 12px 16px;
}

/* Search Form Layout */
.mobile-search-form {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

/* Input Wrapper */
.search-input-wrapper {
    position: relative;
    flex: 1;
    background: #E3E3E8; /* iOS Gray */
    border-radius: 10px;
    height: 36px;
    display: flex;
    align-items: center;
}

.mobile-search-icon {
    position: absolute;
    left: 8px;
    color: #8E8E93;
    z-index: 1;
    pointer-events: none;
}

.mobile-search-input {
    width: 100%;
    height: 100%;
    padding: 0 30px 0 30px; /* Space for icons */
    border-radius: 10px;
    border: none;
    background: transparent;
    font-size: 17px;
    color: #000;
    outline: none;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    appearance: none;
    -webkit-appearance: none;
}

.mobile-search-input::placeholder {
    color: #8E8E93;
}

/* Clear Button */
.mobile-search-clear {
    position: absolute;
    right: 6px;
    width: 18px;
    height: 18px;
    border: none;
    background: #8E8E93;
    color: #fff;
    border-radius: 50%;
    padding: 2px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.mobile-search-input:not(:placeholder-shown) ~ .mobile-search-clear {
    display: flex;
}

/* Cancel Button */
.mobile-search-cancel {
    background: none;
    border: none;
    color: #007AFF;
    font-size: 17px;
    padding: 0;
    cursor: pointer;
    white-space: nowrap;
}

/* Recent Searches */
.recent-searches-wrapper {
    flex: 1;
    overflow-y: auto;
}

.recent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 0 4px;
}

.recent-header h3 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: #1d1d1f;
}

#clear-recent-searches {
    background: none;
    border: none;
    color: #007AFF;
    font-size: 15px;
    cursor: pointer;
}

.recent-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.recent-item {
    display: flex;
    align-items: center;
    padding: 12px 4px;
    border-bottom: 1px solid #E5E5EA;
    cursor: pointer;
    color: #007AFF;
    font-size: 19px;
    font-weight: 400;
}

.recent-item svg {
    margin-right: 10px;
    color: #8E8E93;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
}

body.sidebar-open .sidebar-overlay {
    display: block;
}

body.sidebar-open,
body.search-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    .mobile-header { background: rgba(28, 28, 30, 0.85); border-bottom-color: rgba(255,255,255,0.1); }
    .mobile-logo { color: #fff; }
    .mobile-search-modal { background: #000000; }
    .search-input-wrapper { background: #1C1C1E; }
    .mobile-search-input { color: #fff; }
    .recent-header h3 { color: #fff; }
    .recent-item { border-bottom-color: #2C2C2E; }
}