/* Smart Search Component Styles
 * Version: 4.1.0
 * Last Update: January 9, 2026
 * v4.1.0: v2.44.74 - RTL: revert broken dropdown positioning, fix overflow
 * v4.0.9: v2.44.73 - RTL desktop: allow dropdown overflow on smart-search-bar
 * v4.0.8: v2.44.70 - RTL dropdown both use left:0, remove camera min-width
 * v4.0.7: Fix RTL platform dropdown - allow overflow on search-pills
 * v4.0.6: Fix RTL mobile overflow with camera dropdown
 */

.smart-search-wrapper {
    margin: 1.5rem auto;
    position: relative;
    z-index: 100;
    overflow: visible;
    max-width: 100%;
}

.smart-search-container {
    position: relative;
    max-width: 1100px;  /* Wider container for search bar */
    width: 100%;
    margin: 0 auto;
    padding: 0;
    overflow: visible;
}

.smart-search-bar {
    background: white;
    border-radius: 32px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    min-height: 68px;
    max-height: 68px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: visible;
}

.search-pills {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
    overflow: visible;
}

.pill-wrapper {
    position: relative;
    display: inline-flex;
    overflow: visible;
}

.search-pill {
    position: relative; /* v2.44.69: Required for dropdown positioning */
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--gray-100);
    border-radius: 24px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    border: 2px solid var(--gray-200);
    height: 52px;
}

.search-pill:hover {
    background: var(--gray-200);
    transform: translateY(-1px);
    border-color: var(--gray-300);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.search-pill.active {
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-primary-dark));
    color: white;
    border-color: var(--theme-primary);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

.search-pill .pill-icon {
    font-size: 0.875rem;
    opacity: 0.9;
}

.search-pill .pill-remove {
    font-size: 1rem;
    opacity: 0.7;
    margin-left: 0.25rem;
    transition: opacity 0.2s;
}

.search-pill .pill-remove:hover {
    opacity: 1;
}

.search-input-wrapper {
    flex: 1 1 auto;
    position: relative;
    min-width: 0;
    max-width: none;
}

.search-main-input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 1rem;
    padding: 0.75rem 1rem;
    background: transparent;
    color: var(--gray-900);
    font-weight: 500;
    line-height: 1.5;
}

.search-main-input::placeholder {
    color: var(--gray-400);
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Remove selection highlight for search inputs */
.search-main-input::selection,
input#mainSearchInput::selection {
    background: transparent !important;
    background-color: transparent !important;
}

.search-main-input::-moz-selection,
input#mainSearchInput::-moz-selection {
    background: transparent !important;
    background-color: transparent !important;
}

.search-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    height: 100%;
}

.search-image-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--gray-600);
    flex-shrink: 0;
    padding: 0;
}

.search-image-btn:hover {
    background: transparent;
    color: var(--primary-color);
    transform: scale(1.1);
}

.search-submit-btn {
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-primary-dark));
    color: white;
    border: none;
    padding: 0 2rem;
    border-radius: 24px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 52px;
    box-shadow: 0 1px 4px rgba(102, 126, 234, 0.2);
    flex-shrink: 0;
    white-space: nowrap;
}

.search-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.35);
}

.search-submit-btn:active {
    transform: translateY(0);
}

.search-submit-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Dropdown Menus */
.pill-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    background: white;
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.05);
    padding: 0.75rem;
    z-index: 99999;
    min-width: 250px;
    max-width: calc(100vw - 1rem); /* v2.44.25: Fix #11 - Prevent overflow on mobile */
    max-height: 450px;
    overflow-y: auto;
    overflow-x: hidden;
    display: none;
}

.pill-dropdown.active {
    display: block;
    animation: dropdownFade 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Camera Dropdown - override positioning to open to the left */
.pill-dropdown.camera-dropdown {
    left: auto !important;
    right: 0 !important;
    min-width: auto; /* v2.44.70: Remove min-width constraint */
    max-width: calc(100vw - 1rem); /* v2.44.25: Fix #3 - Prevent overflow on mobile */
}

.dropdown-item {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.9375rem;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

.dropdown-item:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.dropdown-item.selected {
    background: var(--theme-primary);
    color: white;
    font-weight: 600;
}

.dropdown-item.selected:hover {
    background: var(--theme-primary-dark);
    color: white;
}

.dropdown-separator {
    height: 1px;
    background: var(--gray-200);
    margin: 0.5rem 0;
}

.dropdown-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 2px solid var(--gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.dropdown-checkbox.checked {
    background: var(--theme-primary);
    border-color: var(--theme-primary);
}

.dropdown-checkbox.checked::after {
    content: '✓';
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Country Confirmation Modal */
.country-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.country-modal-overlay.active {
    display: flex;
}

.country-modal {
    background: white;
    border-radius: 16px;
    padding: 1.75rem;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

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

@keyframes modalPop {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.country-modal-header {
    text-align: center;
    margin-bottom: 1.25rem;
}

.country-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.country-modal-subtitle {
    color: var(--gray-600);
    font-size: 0.875rem;
    line-height: 1.5;
}

.country-modal-body {
    margin-bottom: 1.25rem;
}

.country-alert {
    background: var(--alert-warning-bg);
    border: 1px solid var(--warning-color);
    border-radius: 8px;
    padding: 0.875rem;
    margin-bottom: 1rem;
    display: flex;
    gap: 0.75rem;
    align-items: start;
}

.country-alert-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.country-alert-text {
    font-size: 0.8125rem;
    color: var(--alert-warning-text);
    line-height: 1.5;
}

.country-select-wrapper {
    margin-bottom: 1rem;
}

.country-select-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.country-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-300);
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--gray-900);
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><path fill="%23666" d="M6 9L1 4h10z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.country-select:hover {
    border-color: var(--theme-primary);
}

.country-select:focus {
    outline: none;
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.country-modal-actions {
    display: flex;
    gap: 0.75rem;
}

.country-modal-btn {
    flex: 1;
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.country-modal-btn-primary {
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-primary-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.country-modal-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.country-modal-btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.country-modal-btn-secondary:hover {
    background: var(--gray-200);
}

/* Hide floating toolbar when country modal is active */
body:has(.country-modal-overlay.active) .floating-toolbar {
    display: none !important;
}

/* Responsive - Tablet (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .smart-search-wrapper {
        margin: 2rem auto;
    }

    .smart-search-bar {
        min-height: 56px;
        max-height: 56px;
        gap: 0.375rem;
        padding: 0.375rem;
    }

    .search-pills {
        gap: 0.375rem;
    }

    .search-pill {
        height: 40px;
        padding: 0.5rem 0.875rem;
        font-size: 0.8125rem;
    }

    .search-input-wrapper {
        min-width: 120px;
    }

    .search-image-btn {
        width: 40px;
        height: 40px;
    }

    .search-submit-btn {
        height: 40px;
        padding: 0 1rem;
        font-size: 0.875rem;
    }

    .search-main-input {
        font-size: 0.875rem;
    }

    .search-main-input::placeholder {
        font-size: 0.875rem;
    }
}

/* Responsive - Mobile (max 768px) */
@media (max-width: 768px) {
    .smart-search-wrapper {
        margin: 1.5rem auto;
    }

    .smart-search-bar {
        min-height: auto;
        flex-wrap: wrap;
        padding: 0.75rem;
        border-radius: 24px;
    }

    .search-pills {
        width: 100%;
        order: 1;
        margin-bottom: 0.75rem;
    }

    .search-pill {
        font-size: 0.8125rem;
        padding: 0.5rem 0.875rem;
    }

    .search-input-wrapper {
        width: 100%;
        order: 2;
        margin-bottom: 0.75rem;
        min-width: auto;
    }

    .search-main-input {
        font-size: 1rem;
        padding: 0.5rem;
    }

    .search-actions {
        width: 100%;
        order: 3;
        justify-content: flex-end;
    }

    .search-image-btn {
        width: 40px;
        height: 40px;
    }

    .search-submit-btn {
        height: 40px;
        padding: 0.625rem 1.5rem;
        font-size: 0.9375rem;
    }

    .country-modal {
        padding: 1.5rem;
        max-width: 340px;
    }

    .country-modal-title {
        font-size: 1.125rem;
    }

    .country-modal-subtitle {
        font-size: 0.8125rem;
    }
}

/* Responsive - Small Mobile (max 480px) */
@media (max-width: 480px) {
    .smart-search-wrapper {
        margin: 1rem auto;
    }

    .smart-search-bar {
        padding: 0.5rem;
        gap: 0.5rem;
        border-radius: 20px;
    }

    .search-pills {
        gap: 0.375rem;
        margin-bottom: 0.5rem;
    }

    .search-pill {
        height: 40px;
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
        max-width: 110px;
        overflow: hidden;
    }

    .search-pill span:first-child {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .search-input-wrapper {
        margin-bottom: 0.5rem;
    }

    .search-main-input {
        font-size: 0.9375rem;
        padding: 0.375rem 0.5rem;
    }

    .search-main-input::placeholder {
        font-size: 0.8125rem;
    }

    .search-image-btn {
        width: 36px;
        height: 36px;
    }

    .search-image-btn svg {
        width: 16px;
        height: 16px;
    }

    .search-submit-btn {
        height: 36px;
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
        gap: 0.375rem;
    }

    .search-submit-btn svg {
        width: 16px;
        height: 16px;
    }

    /* Dropdowns on small mobile */
    .pill-dropdown {
        min-width: 200px;
        max-width: calc(100vw - 2rem);
        padding: 0.5rem;
    }

    .dropdown-item {
        padding: 0.625rem 0.75rem;
        font-size: 0.875rem;
    }

    /* Modal adjustments */
    .country-modal {
        padding: 1.25rem;
        max-width: 300px;
    }

    .country-modal-title {
        font-size: 1rem;
    }

    .country-modal-btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
}

/* Responsive - Extra Small Mobile (max 400px) - Match header patterns */
@media (max-width: 400px) {
    .smart-search-bar {
        padding: 0.375rem;
        gap: 0.375rem;
    }

    .search-pills {
        gap: 0.25rem;
    }

    .search-pill {
        height: 36px;
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
        max-width: 90px;
        border-radius: 1rem;
    }

    .search-input-wrapper {
        min-width: 0;
    }

    .search-main-input {
        font-size: 0.875rem;
        padding: 0.25rem 0.375rem;
    }

    .search-image-btn {
        width: 32px;
        height: 32px;
    }

    .search-image-btn svg {
        width: 14px;
        height: 14px;
    }

    .search-submit-btn {
        height: 32px;
        padding: 0.375rem 0.75rem;
        font-size: 0.8125rem;
        border-radius: 1rem;
    }

    .search-submit-btn svg {
        width: 14px;
        height: 14px;
    }

    /* Compact dropdowns */
    .pill-dropdown {
        min-width: 180px;
        padding: 0.375rem;
        border-radius: 12px;
    }

    .dropdown-item {
        padding: 0.5rem 0.625rem;
        font-size: 0.8125rem;
        border-radius: 8px;
    }

    .dropdown-checkbox {
        width: 16px;
        height: 16px;
    }
}

/* ===========================================
   RTL (Right-to-Left) Support - v4.0.6
   Fix mobile overflow issues in Hebrew/Arabic
   =========================================== */

/* v2.44.74: RTL - removed overflow rules, using base CSS */

/* v2.44.74: RTL Mobile - minimal rules, no overflow overrides */
@media (max-width: 768px) {
    [dir="rtl"] .pill-dropdown {
        max-width: calc(100vw - 2rem);
    }
}

@media (max-width: 480px) {
    [dir="rtl"] .search-pill {
        max-width: 120px;
    }
}

@media (max-width: 400px) {
    [dir="rtl"] .search-pill {
        max-width: 100px;
    }
}
