/**
 * Mobile Header & UI Fixes
 * Shortlist toggle, search redesign, mobile header
 */

/* ============================================
   SHORTLIST - MOBILE HIDDEN WITH HEADER TOGGLE
   ============================================ */

/* Hide shortlist panel on mobile */
@media (max-width: 768px) {
    .sffc-shortlist-floating {
        display: none !important;
    }
}

/* Shortlist Toggle Button in Header */
.sffc-shortlist-header-toggle {
    display: none;
    width: 40px;
    height: 40px;
    background: white;
    border: 2px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    .sffc-shortlist-header-toggle {
        display: flex !important;
        order: 1;
        margin-right: 12px;
    }
}

.sffc-shortlist-header-toggle:hover {
    background: var(--vogue-black);
    border-color: var(--vogue-black);
    color: white;
}

.sffc-shortlist-header-toggle svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* Badge for count */
.sffc-shortlist-header-toggle::after {
    content: attr(data-count);
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--vogue-gold);
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    font-family: 'Inter', sans-serif;
}

.sffc-shortlist-header-toggle[data-count="0"]::after {
    display: none;
}

/* Shortlist Dropdown from Header */
.sffc-shortlist-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 320px;
    max-width: calc(100vw - 32px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.08);
    z-index: 1000;
    display: none;
    max-height: 400px;
    overflow-y: auto;
}

.sffc-shortlist-dropdown.active {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   MESSAGE SEARCH - REDESIGNED
   ============================================ */

.sffc-message-search {
    position: sticky;
    top: 80px;
    z-index: 90;
    background: transparent;
    padding: 0;
    margin: 0;
}

.sffc-search-wrapper {
    max-width: 800px;
    margin: 16px auto;
    position: relative;
}

.sffc-search-input {
    width: 100%;
    padding: 12px 44px 12px 16px;
    background: white;
    border: 2px solid rgba(0, 0, 0, 0.06);
    border-radius: 24px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: var(--vogue-black);
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.sffc-search-input:focus {
    outline: none;
    border-color: var(--vogue-gold);
    box-shadow: 
        0 4px 20px rgba(201, 169, 97, 0.15),
        0 0 0 3px rgba(201, 169, 97, 0.1);
    transform: scale(1.02);
}

.sffc-search-input::placeholder {
    color: #999;
    font-style: italic;
}

.sffc-search-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
    transition: color 0.3s ease;
}

.sffc-search-input:focus ~ .sffc-search-icon {
    color: var(--vogue-gold);
}

/* Search Results Counter */
.search-results-badge {
    position: absolute;
    right: 48px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--vogue-gold);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    display: none;
}

.search-results-badge.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Search Highlight in Messages */
.message-search-highlight {
    background: linear-gradient(to right, 
        transparent 0%, 
        rgba(201, 169, 97, 0.2) 10%, 
        rgba(201, 169, 97, 0.2) 90%, 
        transparent 100%);
    padding: 2px 0;
    border-radius: 4px;
    font-weight: 600;
}

/* ============================================
   MOBILE HEADER - REDESIGNED
   ============================================ */

@media (max-width: 768px) {
    .sffc-opp-header {
        padding: 12px 16px !important;
        background: white;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
        position: sticky;
        top: 0;
        z-index: 100;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 12px !important;
        height: 60px;
    }
    
    /* Mobile Header Layout */
    .sffc-header-left {
        display: flex;
        align-items: center;
        gap: 12px;
        flex: 0 0 auto;
    }
    
    .sffc-header-center {
        flex: 1;
        text-align: center;
    }
    
    .sffc-header-right {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 0 0 auto;
    }
    
    /* Brand on mobile */
    .sffc-brand {
        order: 2 !important;
        margin: 0 !important;
    }
    
    .sffc-brand-text {
        display: none !important; /* Hide text on mobile */
    }
    
    .sffc-brand-logo {
        width: 32px !important;
        height: 32px !important;
    }
    
    .sffc-brand-s {
        font-size: 18px !important;
    }
    
    /* User header on mobile */
    .sffc-user-header {
        display: none !important; /* Hide on mobile */
    }
    
    /* Profile actions on mobile */
    .sffc-profile-actions {
        order: 3 !important;
        margin: 0 !important;
        gap: 8px !important;
    }
    
    .sffc-edit-profile-btn {
        width: 36px !important;
        height: 36px !important;
        padding: 0 !important;
        border-radius: 10px !important;
        background: transparent !important;
        border: 2px solid rgba(0, 0, 0, 0.08) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .sffc-edit-profile-btn span {
        display: none !important;
    }
    
    .sffc-edit-profile-btn svg {
        width: 18px !important;
        height: 18px !important;
    }
    
    #currency-selector-container {
        display: none !important; /* Hide currency on mobile header */
    }
    
    /* Conversation stages hidden on mobile */
    .conversation-stage {
        display: none !important;
    }
    
    /* Search bar on mobile */
    .sffc-message-search {
        position: relative;
        top: 0;
        padding: 8px 16px;
        background: #FAFAF8;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }
    
    .sffc-search-wrapper {
        margin: 0;
    }
    
    .sffc-search-input {
        padding: 10px 40px 10px 14px;
        font-size: 14px;
        border-radius: 20px;
    }
}

/* Mobile Header Container Structure */
@media (max-width: 768px) {
    .sffc-opp-header-inner {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
}

/* ============================================
   MOBILE OPTIMIZATIONS
   ============================================ */

@media (max-width: 480px) {
    .sffc-shortlist-dropdown {
        width: calc(100vw - 32px);
        left: 16px;
        right: 16px;
    }
    
    .sffc-search-input {
        font-size: 13px;
        padding: 8px 36px 8px 12px;
    }
    
    .sffc-search-icon {
        width: 16px;
        height: 16px;
        right: 12px;
    }
}