/**
 * Smart Search Styles
 * Modern, RTL-friendly design with AI branding
 */

/* Container */
.smart-search-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    direction: rtl;
    text-align: right;
}

/* Search Box */
.smart-search-box {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 24px;
    transition: box-shadow 0.3s ease;
}

.smart-search-box:hover {
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.12);
}

/* Input Wrapper */
.smart-search-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

/* Input Field */
.smart-search-input {
    flex: 1;
    padding: 16px 20px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-family: inherit;
    direction: rtl;
    text-align: right;
    transition: all 0.3s ease;
    background: #f9f9f9;
}

.smart-search-input:focus {
    outline: none;
    border-color: #667eea;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.smart-search-input::placeholder {
    color: #999;
}

/* Vague Query State */
.smart-search-form.vague-query .smart-search-input {
    border-color: #ffa500;
    background: #fff9f0;
}

/* Search Button */
.smart-search-button {
    padding: 16px 32px;
    background: #ce7929;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.smart-search-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: #e38a03;
}

.smart-search-button:active {
    transform: translateY(0);
    background: #ce7929;
}

.smart-search-button:focus {
    background: #ce7929;
}

.smart-search-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.smart-search-button.loading {
    background: #999;
}

.smart-search-button svg {
    width: 20px;
    height: 20px;
}

.smart-search-button span {
    display: none;
}

/* Loading State */
.smart-search-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding: 12px;
    background: #f0f4ff;
    border-radius: 8px;
    color: #667eea;
    font-weight: 500;
}

.smart-search-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error Message */
.smart-search-error {
    margin-top: 16px;
    padding: 12px 16px;
    background: #fff0f0;
    border: 1px solid #ffcccc;
    border-radius: 8px;
    color: #d32f2f;
    font-weight: 500;
}

/* Suggestions */
.smart-search-suggestions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.suggestions-title {
    font-size: 14px;
    color: #666;
    margin: 0 0 12px 0;
    font-weight: 600;
}

.suggestions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.suggestion-item {
    display: inline-block;
    padding: 8px 16px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
}

.suggestion-item:hover {
    background: #667eea;
    color: #ffffff;
    border-color: #667eea;
    transform: translateY(-2px);
}

.suggestion-service {
    background: #e8eaf6;
    border-color: #667eea;
    color: #667eea;
}

.suggestion-specialty {
    background: #f3e5f5;
    border-color: #9c27b0;
    color: #9c27b0;
}

.suggestion-original {
    background: #fff9e6;
    border-color: #ffa500;
    color: #ff8800;
}

/* AI Badge */
.smart-search-ai-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 20px;
    color: #667eea;
    font-size: 13px;
    font-weight: 600;
}

.smart-search-ai-badge svg {
    width: 16px;
    height: 16px;
}

/* Style Variations */
.smart-search-container[data-style="minimal"] .smart-search-box {
    box-shadow: none;
    border: 1px solid #e0e0e0;
    padding: 16px;
}

.smart-search-container[data-style="minimal"] .smart-search-ai-badge {
    display: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .smart-search-container {
        padding: 16px;
    }
    
    .smart-search-box {
        padding: 20px;
    }
    
    .smart-search-input-wrapper {
        flex-direction: column;
    }
    
    .smart-search-button {
        width: 100%;
        justify-content: center;
    }
    
    .smart-search-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .suggestions-list {
        flex-direction: column;
    }
    
    .suggestion-item {
        display: block;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .smart-search-box {
        padding: 16px;
    }
    
    .smart-search-input {
        padding: 14px 16px;
        font-size: 15px;
    }
    
    .smart-search-button {
        padding: 14px 24px;
        font-size: 15px;
    }
    
}

/* Accessibility */
.smart-search-input:focus-visible,
.smart-search-button:focus-visible,
.suggestion-item:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .smart-search-container {
        display: none;
    }
}

/* Dark Mode Support (if needed)
@media (prefers-color-scheme: dark) {
    .smart-search-box {
        background: #1e1e1e;
        color: #ffffff;
    }
    
    .smart-search-input {
        background: #2d2d2d;
        border-color: #444;
        color: #ffffff;
    }
    
    .smart-search-input::placeholder {
        color: #888;
    }
    
    .smart-search-input:focus {
        background: #2d2d2d;
    }
    
    .suggestion-item {
        background: #2d2d2d;
        border-color: #444;
        color: #ffffff;
    }
} */

/* Animation for entrance */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.smart-search-container {
    animation: fadeInUp 0.5s ease-out;
}

/* Highlight effect for detected vague queries */
.smart-search-form.vague-query::after {
    content: "💡 תיאור מפורט יותר יעזור לנו למצוא עבורך את האדם הנכון";
    display: block;
    margin-top: 8px;
    font-size: 13px;
    color: #ff8800;
    font-weight: 500;
}

/* ============================================
   AI Suggestions Results
   ============================================ */

.smart-search-results {
    margin-top: 24px;
    padding: 24px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.ai-explanation {
    margin: 0 0 20px 0;
    padding: 12px 20px;
    font-size: 16px;
    line-height: 1.6;
    color: #667eea;
    font-weight: 600;
    text-align: center;
    direction: rtl;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 20px;
}

.suggestions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 20px;
}

.suggestion-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.suggestion-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color, #007bff), var(--secondary-color, #00d4ff));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.suggestion-card:hover {
    border-color: var(--primary-color, #007bff);
    box-shadow: 0 8px 24px rgba(0, 123, 255, 0.15);
    transform: translateY(-2px);
}

.suggestion-card:hover::before {
    transform: scaleX(1);
}

.suggestion-title {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
    text-align: right;
    direction: rtl;
}

.suggestion-context {
    margin: 0 0 12px 0;
    font-size: 14px;
    line-height: 1.6;
    color: #555;
    text-align: right;
    direction: rtl;
}

.suggestion-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #888;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
    text-align: right;
    direction: rtl;
}

.suggestion-provider-button {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 16px;
    background: transparent;
    color: #e38a03;
    border: 1px solid #e38a03;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    width: 100%;
}

.suggestion-card:hover .suggestion-provider-button {
    background: #e38a03;
    color: #ffffff;
}

/* Tablet: 2 columns */
@media (max-width: 992px) {
    .suggestions-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
    
    .suggestion-card {
        padding: 18px;
    }
    
    .suggestion-title {
        font-size: 17px;
    }
}

/* Mobile: 1 column */
@media (max-width: 640px) {
    .smart-search-results {
        padding: 20px;
        margin-top: 20px;
    }
    
    .suggestions-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .suggestion-card {
        padding: 16px;
    }
    
    .suggestion-title {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    .suggestion-context {
        font-size: 13px;
        margin-bottom: 10px;
    }
    
    .suggestion-meta {
        font-size: 11px;
        padding-top: 10px;
    }
    
    .ai-explanation {
        font-size: 15px;
        margin-bottom: 16px;
    }
}

/* Dark mode support for results
@media (prefers-color-scheme: dark) {
    .smart-search-results {
        background: #2d2d2d;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }
    
    .ai-explanation {
        color: #e0e0e0;
    }
    
    .suggestion-card {
        background: #1a1a1a;
        border-color: #444;
    }
    
    .suggestion-card:hover {
        border-color: var(--primary-color, #007bff);
        background: #2d2d2d;
    }
    
    .suggestion-title {
        color: #ffffff;
    }
    
    .suggestion-context {
        color: #b0b0b0;
    }
    
    .suggestion-meta {
        color: #888;
        border-top-color: #444;
    }
} */

/* ============================================
   Smart Search Toggle
   ============================================ */

.smart-search-toggle-wrapper {
    text-align: center;
    margin: 20px 0;
}

.smart-search-toggle-link {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    padding: 16px 40px !important;
    background: #ce7929 !important;
    color: white !important;
    text-decoration: none !important;
    border-radius: 50px !important;
    font-size: 20px !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 3px 10px rgba(206, 121, 41, 0.3) !important;
    cursor: pointer !important;
    border: none !important;
}

.smart-search-toggle-link:hover {
    background: #b56820 !important;
    box-shadow: 0 5px 15px rgba(206, 121, 41, 0.4) !important;
    transform: translateY(-2px) !important;
    text-decoration: none !important;
    color: white !important;
}

/* Link style variant */
.smart-search-toggle-link[data-style="link"] {
    background: none;
    color: white !important;
    padding: 8px 16px;
    font-size: 15px;
    box-shadow: none;
    border-radius: 0;
}

.smart-search-toggle-link[data-style="link"]:hover {
    color: #f2eef4 !important;
    transform: none;
    box-shadow: none;
}

/* Wrapper for hidden smart search */
.smart-search-wrapper {
    margin-top: 0;
    margin-bottom: 30px;
    padding: 40px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.smart-search-wrapper .smart-search-container {
    max-width: 100%;
}

.smart-search-examples {
    max-width: 870px;
    margin-top: 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
    line-height: 1.8;
}

.smart-search-examples small {
    display: block;
    font-weight: 700 !important;
    font-size: 16px !important;
}

/* Animation - slide down without pushing content up */
@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
    to {
        opacity: 1;
        max-height: 1000px;
        padding-top: 40px;
        padding-bottom: 40px;
    }
}

.smart-search-wrapper.active {
    animation: slideDown 0.5s ease-out;
}

/* Tablet responsive */
@media (max-width: 992px) {
    .smart-search-wrapper {
        padding: 30px;
        max-width: 95%;
    }
}

/* Mobile responsive for toggle */
@media (max-width: 740px) {
    .smart-search-toggle-link {
        padding: 12px 17px !important;
        font-size: 15px !important;
    }
    
    .smart-search-wrapper {
        padding: 20px;
        margin-top: 0;
        margin-bottom: 20px;
        max-width: 100%;
    }
    
    .smart-search-examples small{
        font-size: 13px !important;
    }
}

