/**
 * Mobile Search CSS
 * Styling for typesense_mobile_search shortcode variations
 */

/* Base mobile search container */
.typesense-mobile-search {
    width: 100%;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.mobile-search-wrapper {
    width: 100%;
}

/* Mobile search button - base styling */
.mobile-search-button {
    width: 100%;
    background: #ffffff;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.mobile-search-button:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
    transform: translateY(-1px);
}

.mobile-search-button:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.mobile-search-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Mobile search content layout */
.mobile-search-content {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.mobile-search-icon {
    color: #6b7280;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.mobile-search-placeholder {
    flex: 1;
    text-align: left;
    color: #6b7280;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.4;
}

.mobile-search-arrow {
    color: #9ca3af;
    flex-shrink: 0;
    opacity: 0.6;
    transition: all 0.3s ease;
}

.mobile-search-button:hover .mobile-search-arrow {
    color: #3b82f6;
    opacity: 1;
    transform: translateX(2px);
}

/* Style variations */

/* Default style - already covered above */

/* Compact style */
.mobile-search-compact .mobile-search-button {
    padding: 10px 14px;
    border-radius: 8px;
}

.mobile-search-compact .mobile-search-placeholder {
    font-size: 14px;
}

.mobile-search-compact .mobile-search-icon {
    width: 18px;
    height: 18px;
}

.mobile-search-compact .mobile-search-content {
    gap: 10px;
}

/* Minimal style */
.mobile-search-minimal .mobile-search-button {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 12px 14px;
    box-shadow: none;
}

.mobile-search-minimal .mobile-search-button:hover {
    background: #ffffff;
    border-color: #6c757d;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.mobile-search-minimal .mobile-search-placeholder {
    font-size: 15px;
    color: #495057;
}

.mobile-search-minimal .mobile-search-arrow {
    display: none; /* Hide arrow in minimal style */
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .mobile-search-button {
        padding: 12px 14px;
        border-radius: 10px;
    }
    
    .mobile-search-placeholder {
        font-size: 15px;
    }
    
    .mobile-search-compact .mobile-search-button {
        padding: 8px 12px;
    }
    
    .mobile-search-compact .mobile-search-placeholder {
        font-size: 13px;
    }
}

/* Large touch targets for accessibility */
@media (pointer: coarse) {
    .mobile-search-button {
        min-height: 48px; /* iOS/Android recommended minimum */
        padding: 14px 16px;
    }
    
    .mobile-search-compact .mobile-search-button {
        min-height: 44px;
        padding: 12px 14px;
    }
}

/* Dark mode support (if theme supports it) */
@media (prefers-color-scheme: dark) {
    .mobile-search-button {
        background: #1f2937;
        border-color: #374151;
        color: #ffffff;
    }
    
    .mobile-search-placeholder {
        color: #d1d5db;
    }
    
    .mobile-search-icon {
        color: #9ca3af;
    }
    
    .mobile-search-arrow {
        color: #6b7280;
    }
    
    .mobile-search-button:hover {
        border-color: #60a5fa;
        background: #111827;
    }
    
    .mobile-search-button:hover .mobile-search-arrow {
        color: #60a5fa;
    }
    
    .mobile-search-minimal .mobile-search-button {
        background: #111827;
        border-color: #374151;
    }
    
    .mobile-search-minimal .mobile-search-button:hover {
        background: #1f2937;
        border-color: #4b5563;
    }
}

/* Animation for when search is opening */
.mobile-search-button.opening {
    transform: scale(0.98);
    opacity: 0.8;
}

/* Focus indicators for keyboard navigation */
.mobile-search-button:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Loading state (for when search is processing) */
.mobile-search-button.loading {
    pointer-events: none;
}

.mobile-search-button.loading .mobile-search-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Legacy support for older mobile search implementation */
.typesense-search-mobile .mobile-search-container {
    width: 100%;
}

.mobile-search-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-search-trigger:hover {
    background: #ffffff;
    border-color: #0073aa;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.1);
}

.mobile-search-trigger .search-icon {
    color: #6c757d;
}

.mobile-search-trigger .search-text {
    color: #6c757d;
    font-size: 15px;
}

.mobile-search-trigger:hover .search-icon,
.mobile-search-trigger:hover .search-text {
    color: #0073aa;
}