/* Heichal AI Search v2.0 - Styles */

.hais-search-wrapper {
    width: 100%;
    background: linear-gradient(135deg, #fff9c4 0%, #fff59d 100%);
    border-bottom: 2px solid #fbc02d;
    padding: 12px 20px;
    direction: rtl;
    box-sizing: border-box;
    position: relative;
    z-index: 100;
}

.hais-search-container {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.hais-search-form {
    flex: 1;
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 30px;
    padding: 6px 18px 6px 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: box-shadow 0.2s, transform 0.2s;
}

.hais-search-form:focus-within {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    transform: translateY(-1px);
}

.hais-search-icon {
    color: #757575;
    margin-left: 8px;
    display: flex;
    align-items: center;
}

.hais-search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px 8px;
    font-size: 16px;
    background: transparent;
    direction: rtl;
    text-align: right;
    font-family: inherit;
    color: #212121;
}

.hais-search-input::placeholder { color: #9e9e9e; }

.hais-search-submit {
    background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    font-family: inherit;
    white-space: nowrap;
}

.hais-search-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.3);
}

.hais-ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fff;
    color: #d32f2f;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    white-space: nowrap;
}

@media (max-width: 768px) {
    .hais-search-container { flex-direction: column; gap: 8px; }
    .hais-search-form { width: 100%; }
}

/* Modal */
.hais-results-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    overflow-y: auto;
    direction: rtl;
}

.hais-results-modal {
    background: #fff;
    border-radius: 12px;
    max-width: 900px;
    width: 100%;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 30px 40px;
    box-sizing: border-box;
}

.hais-close-btn {
    position: absolute;
    top: 12px; left: 16px;
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: #757575;
    width: 36px; height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    line-height: 1;
}

.hais-close-btn:hover { background: #f5f5f5; color: #212121; }

.hais-query-display {
    font-size: 14px;
    color: #757575;
    margin-bottom: 8px;
}

.hais-query-display strong {
    color: #d32f2f;
    font-size: 18px;
    font-weight: 700;
}

.hais-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid #e0e0e0;
}

.hais-section:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.hais-section-title {
    font-size: 18px;
    font-weight: 700;
    color: #212121;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hais-section-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: #d32f2f;
    border-radius: 2px;
}

/* תשובת AI */
.hais-ai-answer {
    background: linear-gradient(135deg, #f8f9ff 0%, #fff8e1 100%);
    border-right: 4px solid #d32f2f;
    padding: 16px 20px;
    border-radius: 8px;
    line-height: 1.7;
    font-size: 15px;
    color: #212121;
}

.hais-ai-answer p { margin: 0 0 8px 0; }
.hais-ai-answer p:last-child { margin-bottom: 0; }

/* כתבות פנימיות */
.hais-internal-results {
    display: grid;
    gap: 12px;
}

.hais-result-item {
    display: flex;
    gap: 16px;
    padding: 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
}

.hais-result-item:hover {
    border-color: #d32f2f;
    box-shadow: 0 2px 12px rgba(211, 47, 47, 0.1);
    transform: translateY(-1px);
}

.hais-result-thumb {
    width: 100px;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.hais-result-thumb-placeholder {
    width: 100px;
    height: 70px;
    background: #f5f5f5;
    border-radius: 6px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bdbdbd;
}

.hais-result-content {
    flex: 1;
    min-width: 0;
}

.hais-result-title {
    font-size: 16px;
    font-weight: 700;
    color: #212121;
    margin: 0 0 6px 0;
    line-height: 1.4;
}

.hais-result-excerpt {
    font-size: 13px;
    color: #616161;
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hais-result-meta {
    font-size: 12px;
    color: #9e9e9e;
    margin-top: 6px;
}

.hais-result-cat {
    display: inline-block;
    background: #d32f2f;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
}

/* קישורים חיצוניים */
.hais-external-results {
    display: grid;
    gap: 10px;
}

.hais-external-item {
    display: block;
    padding: 14px 16px;
    border: 1px solid #e0e0e0;
    border-right: 4px solid #1976d2;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

.hais-external-item:hover {
    background: #f8fbff;
    border-color: #1976d2;
    box-shadow: 0 2px 12px rgba(25, 118, 210, 0.15);
    transform: translateY(-1px);
}

.hais-external-title {
    font-size: 15px;
    font-weight: 700;
    color: #1976d2;
    margin: 0 0 4px 0;
    line-height: 1.4;
}

.hais-external-domain {
    font-size: 12px;
    color: #4caf50;
    margin: 0 0 6px 0;
    font-weight: 500;
}

.hais-external-snippet {
    font-size: 13px;
    color: #616161;
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hais-external-info {
    background: #fff8e1;
    border-right: 4px solid #ffa726;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    color: #5d4037;
    font-size: 14px;
}

/* טעינה */
.hais-loading {
    text-align: center;
    padding: 40px 20px;
}

.hais-loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #d32f2f;
    border-radius: 50%;
    animation: hais-spin 1s linear infinite;
}

@keyframes hais-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hais-loading-text {
    margin-top: 16px;
    color: #616161;
    font-size: 14px;
}

/* שגיאה */
.hais-error {
    background: #ffebee;
    border-right: 4px solid #c62828;
    padding: 16px 20px;
    border-radius: 6px;
    color: #c62828;
}

/* תחתית */
.hais-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
    text-align: center;
    font-size: 12px;
    color: #9e9e9e;
}

@media (max-width: 768px) {
    .hais-results-modal {
        padding: 20px 16px;
        max-height: 100vh;
        border-radius: 0;
    }
    .hais-results-overlay { padding: 0; }
    .hais-result-item { flex-direction: column; }
    .hais-result-thumb, .hais-result-thumb-placeholder {
        width: 100%;
        height: 140px;
    }
}
