/* ========================================
   STARTER MEILISEARCH - СТИЛИ
   ======================================== */

/* Обёртка */
.sms-search-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
}

/* Форма */
.sms-search-form {
    position: relative;
}

/* Input wrapper */
.sms-input-wrapper {
    display: flex;
    align-items: stretch;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sms-input-wrapper:focus-within {
    border-color: #f43f5e;
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.1);
}

/* Input */
.sms-search-input {
    flex: 1;
    padding: 14px 18px;
    border: none;
    outline: none;
    font-size: 16px;
    background: transparent;
}

.sms-search-input::placeholder {
    color: #9ca3af;
}

/* Кнопка */
.sms-search-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 22px;
    background: linear-gradient(135deg, #f43f5e 0%, #ec4899 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.sms-search-button:hover {
    opacity: 0.9;
}

.sms-search-button svg {
    flex-shrink: 0;
}

.sms-search-button span {
    display: none;
}

@media (min-width: 480px) {
    .sms-search-button span {
        display: inline;
    }
}

/* ========================================
   ВЫПАДАЮЩИЙ СПИСОК РЕЗУЛЬТАТОВ
   ======================================== */

.sms-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    max-height: 450px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.sms-results-dropdown.active {
    display: block;
}

/* Загрузка */
.sms-loading {
    padding: 20px;
    text-align: center;
    color: #6b7280;
}

.sms-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 2px solid #e0e0e0;
    border-top-color: #f43f5e;
    border-radius: 50%;
    animation: sms-spin 0.8s linear infinite;
}

@keyframes sms-spin {
    to { transform: rotate(360deg); }
}

/* Нет результатов */
.sms-no-results {
    padding: 20px;
    text-align: center;
    color: #6b7280;
}

/* Время поиска */
.sms-search-time {
    padding: 8px 16px;
    font-size: 11px;
    color: #9ca3af;
    background: #f9fafb;
    border-bottom: 1px solid #f3f4f6;
}

/* Элемент результата */
.sms-result-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.15s ease;
}

.sms-result-item:last-child {
    border-bottom: none;
}

.sms-result-item:hover,
.sms-result-item.active {
    background: #fef2f2;
}

/* Миниатюра */
.sms-result-thumbnail {
    flex-shrink: 0;
    width: 70px;
    height: 52px;
    border-radius: 4px;
    overflow: hidden;
    background: #f3f4f6;
}

.sms-result-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Контент результата */
.sms-result-content {
    flex: 1;
    min-width: 0;
}

.sms-result-title {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    margin: 0 0 4px 0;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sms-result-excerpt {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Категории */
.sms-result-categories {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.sms-result-category {
    font-size: 10px;
    padding: 2px 6px;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 3px;
}

/* Подсветка */
.sms-result-title mark,
.sms-result-excerpt mark {
    background: #fef08a;
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

/* Ссылка "Все результаты" */
.sms-view-all {
    display: block;
    padding: 14px 16px;
    text-align: center;
    background: #f9fafb;
    color: #f43f5e;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border-top: 1px solid #e0e0e0;
}

.sms-view-all:hover {
    background: #fef2f2;
}

/* ========================================
   СТИЛЬ MINIMAL
   ======================================== */

.sms-style-minimal .sms-input-wrapper {
    border: 1px solid #d1d5db;
    border-radius: 50px;
}

.sms-style-minimal .sms-search-input {
    padding: 12px 24px;
}

.sms-style-minimal .sms-search-button {
    background: transparent;
    color: #6b7280;
    padding: 12px 18px;
    border-radius: 0 50px 50px 0;
}

.sms-style-minimal .sms-search-button:hover {
    color: #f43f5e;
    background: transparent;
}

.sms-style-minimal .sms-results-dropdown {
    border-radius: 16px;
    margin-top: 8px;
    border: 1px solid #e0e0e0;
}

.sms-style-minimal .sms-view-all {
    border-radius: 0 0 16px 16px;
}

/* ========================================
   СТИЛЬ DARK
   ======================================== */

.sms-style-dark .sms-input-wrapper {
    background: #1f2937;
    border-color: #374151;
}

.sms-style-dark .sms-input-wrapper:focus-within {
    border-color: #f43f5e;
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.2);
}

.sms-style-dark .sms-search-input {
    color: #fff;
}

.sms-style-dark .sms-search-input::placeholder {
    color: #9ca3af;
}

.sms-style-dark .sms-results-dropdown {
    background: #1f2937;
    border-color: #374151;
}

.sms-style-dark .sms-search-time {
    background: #111827;
    color: #6b7280;
    border-color: #374151;
}

.sms-style-dark .sms-result-item {
    border-color: #374151;
}

.sms-style-dark .sms-result-item:hover,
.sms-style-dark .sms-result-item.active {
    background: #374151;
}

.sms-style-dark .sms-result-title {
    color: #fff;
}

.sms-style-dark .sms-result-excerpt {
    color: #9ca3af;
}

.sms-style-dark .sms-result-category {
    background: #374151;
    color: #9ca3af;
}

.sms-style-dark .sms-view-all {
    background: #111827;
    border-color: #374151;
    color: #f43f5e;
}

.sms-style-dark .sms-view-all:hover {
    background: #1f2937;
}

.sms-style-dark .sms-result-thumbnail {
    background: #374151;
}

/* ========================================
   АДАПТИВНОСТЬ
   ======================================== */

@media (max-width: 640px) {
    .sms-search-wrapper {
        max-width: 100%;
    }
    
    .sms-search-input {
        font-size: 16px; /* Предотвращает zoom на iOS */
        padding: 12px 14px;
    }
    
    .sms-search-button {
        padding: 12px 16px;
    }
    
    .sms-result-thumbnail {
        width: 56px;
        height: 42px;
    }
    
    .sms-result-title {
        font-size: 13px;
    }
    
    .sms-result-excerpt {
        font-size: 11px;
        -webkit-line-clamp: 1;
    }
    
    .sms-result-categories {
        display: none;
    }
}

/* ========================================
   FULL WIDTH вариант
   ======================================== */

.sms-search-wrapper.sms-fullwidth {
    max-width: 100%;
}

/* ========================================
   HEADER вариант (компактный)
   ======================================== */

.sms-search-wrapper.sms-header {
    max-width: 300px;
}

.sms-header .sms-input-wrapper {
    border-radius: 6px;
}

.sms-header .sms-search-input {
    padding: 8px 12px;
    font-size: 14px;
}

.sms-header .sms-search-button {
    padding: 8px 12px;
}

.sms-header .sms-search-button span {
    display: none !important;
}
