/* Файл: catalog/view/javascript/imlabs/eventsearch/imlabs_eventsearch.css */

/* === БАЗОВЫЕ ПЕРЕМЕННЫЕ === */
:root {
    --imls-bg: #ffffff;
    --imls-text: #1a1d21;
    --imls-text-muted: #6b7280;
    --imls-border: #e5e7eb;
    --imls-border-strong: #d1d5db;
    --imls-accent: #337ab7;
    --imls-accent-hover: #286090;
    --imls-accent-light: #f0f4f8;
    --imls-accent-light-hover: #d9e2ec;
    --imls-hover-bg: #f8f9fa;
    --imls-shadow: 0 12px 32px rgba(0, 0, 0, .12);
    --imls-radius: 14px;
    --imls-radius-sm: 10px;
    --imls-radius-pill: 999px;
    --imls-tab-bg: #f8f9fa;
    --imls-tag-bg: #f0f4f8;
    --imls-tag-border: #e5e7eb;
    --imls-focus-ring: 0 0 0 3px rgba(51, 122, 183, .25);
}

/* Тёмная тема (принудительная) */
[data-theme="dark"] {
    --imls-bg: #1e1e2e;
    --imls-text: #cdd6f4;
    --imls-text-muted: #a6adc8;
    --imls-border: #313244;
    --imls-accent: #5fa8e0;
    --imls-accent-hover: #7bbceb;
    --imls-accent-light: #2a3a4d;
    --imls-accent-light-hover: #34495e;
    --imls-hover-bg: #2a2a3c;
    --imls-tab-bg: #252536;
    --imls-tag-bg: #2d2d44;
    --imls-tag-border: #45475a;
    --imls-focus-ring: 0 0 0 3px rgba(95, 168, 224, .3);
}

/* Тема «Авто» — следует системной */
@media (prefers-color-scheme: dark) {
    [data-theme="auto"] {
        --imls-bg: #1e1e2e;
        --imls-text: #cdd6f4;
        --imls-text-muted: #a6adc8;
        --imls-border: #313244;
        --imls-accent: #5fa8e0;
        --imls-accent-hover: #7bbceb;
        --imls-accent-light: #2a3a4d;
        --imls-accent-light-hover: #34495e;
        --imls-hover-bg: #2a2a3c;
        --imls-tab-bg: #252536;
        --imls-tag-bg: #2d2d44;
        --imls-tag-border: #45475a;
        --imls-focus-ring: 0 0 0 3px rgba(95, 168, 224, .3);
    }
}

/* === FULLSCREEN MODE === */
body.imls-fullscreen-active {
    overflow: hidden !important;
    isolation: isolate;
}

.imls-fullscreen-backdrop {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; height: 100%;
    background: rgba(26, 29, 33, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9998;
}

.imls-fullscreen-mode {
    position: fixed;
    top: 8%; left: 50%;
    transform: translateX(-50%);
    width: 640px; max-width: 92vw;
    max-height: 85vh;
    z-index: 9999;
    display: flex; flex-direction: column;
    background-color: #ffffff;
    background-image: none;
    border-radius: 20px;
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.3);
    padding: 20px;
    box-sizing: border-box;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--imls-text);
}

.imls-search-wrapper { position: relative; margin-bottom: 16px; flex-shrink: 0; }

.imls-fs-input {
    width: 100%; height: 56px;
    padding: 0 48px 0 20px;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 16px; font-weight: 400;
    border: 1px solid var(--imls-border-strong);
    border-radius: var(--imls-radius-pill);
    outline: none;
    background-color: #f8f9fa;
    color: var(--imls-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    box-sizing: border-box;
}

.imls-fs-input::placeholder { color: var(--imls-text-muted); }

.imls-fs-input:focus {
    border-color: var(--imls-accent);
    background-color: #ffffff;
    box-shadow: var(--imls-focus-ring);
}

.imls-close-fullscreen {
    position: fixed; top: 20px; right: calc(50% - 340px);
    width: 42px; height: 42px;
    background-color: #ffffff;
    border: 1px solid var(--imls-border);
    border-radius: 50%;
    cursor: pointer; z-index: 10000;
    display: flex; align-items: center; justify-content: center;
    color: var(--imls-text);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.imls-close-fullscreen:hover {
    color: var(--imls-accent);
    background-color: var(--imls-accent-light);
    transform: translateY(-1px);
}

.imls-mobile-close {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    width: 32px; height: 32px;
    background: none; border: none; cursor: pointer;
    color: var(--imls-text-muted);
    display: none; align-items: center; justify-content: center;
    z-index: 2;
    border-radius: 50%;
    transition: color 0.15s ease, background-color 0.15s ease;
}
.imls-mobile-close:hover { color: var(--imls-accent); background-color: var(--imls-accent-light); }

/* === РЕЗУЛЬТАТЫ (DROPDOWN) === */
#imlabs-eventsearch-dropdown {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 400px;
    font-size: 14px;
    color: var(--imls-text);
    background-color: #ffffff;
    border-radius: var(--imls-radius);
    border: 1px solid var(--imls-border);
}

#imlabs-eventsearch-dropdown.imls-fs-results {
    position: relative;
    flex: 1;
    max-height: none;
    border-radius: var(--imls-radius);
    background-color: #ffffff;
}

/* === ИНДИКАТОР ЗАГРУЗКИ === */
.imls-loading { padding: 40px 20px; text-align: center; display: flex; align-items: center; justify-content: center; }
.imls-spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--imls-border);
    border-top-color: var(--imls-accent);
    border-radius: 50%;
    animation: imls-spin 0.8s linear infinite;
}
@keyframes imls-spin { to { transform: rotate(360deg); } }

/* === ВКЛАДКИ === */
.imls-tabs {
    display: flex; gap: 4px; padding: 8px;
    background-color: var(--imls-tab-bg);
    border-bottom: 1px solid var(--imls-border);
    flex-shrink: 0;
    border-radius: var(--imls-radius) var(--imls-radius) 0 0;
}

.imls-tab {
    flex: 1; display: flex; align-items: center; justify-content: center;
    gap: 6px; padding: 10px 8px;
    font-size: 12px; font-weight: 600;
    color: var(--imls-text-muted);
    background: transparent;
    border: 1px solid transparent; border-radius: var(--imls-radius-sm);
    cursor: pointer; transition: all 0.2s ease;
    text-transform: uppercase; letter-spacing: 0.04em;
    user-select: none;
}

.imls-tab svg { width: 14px; height: 14px; flex-shrink: 0; }
.imls-tab span { pointer-events: none; }

.imls-tab-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 18px; padding: 0 5px;
    font-size: 10px; font-weight: 700;
    color: var(--imls-text-muted); background-color: var(--imls-border);
    border-radius: 9px;
}

.imls-tab:hover { background-color: var(--imls-accent-light); color: var(--imls-accent); }
.imls-tab.active {
    background-color: #ffffff;
    color: var(--imls-accent);
    border-color: var(--imls-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.imls-tab.active .imls-tab-count { background-color: var(--imls-accent); color: #fff; }

/* === КОНТЕНТ ВКЛАДОК === */
.imls-tab-content { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.imls-tab-pane { display: none; flex: 1; overflow-y: auto; }
.imls-tab-pane.active { display: block; }
.imls-tab-empty { padding: 40px 20px; color: var(--imls-text-muted); text-align: center; }

/* === КАРТОЧКИ === */
.imls-item { display: block; border-bottom: 1px solid var(--imls-border); text-decoration: none; color: inherit; }
.imls-item:last-child { border-bottom: none; }
.imls-item-content { display: flex; align-items: center; padding: 12px 16px; gap: 12px; transition: background-color 0.15s ease; }
.imls-item-content:hover, .imls-item-content.imls-active { background-color: var(--imls-hover-bg); }

.imls-item-icon { flex-shrink: 0; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; color: var(--imls-text-muted); }
.imls-item-image { flex-shrink: 0; }

.imls-image-container {
    border-radius: 8px;
    overflow: hidden;
    background-color: #ffffff;
    border: 1px solid var(--imls-border);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    line-height: 0;
    display: block; 
}
.imls-image-container img {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: 7px;
    transition: transform 0.2s ease;
    display: block;
}
.imls-item-content:hover .imls-image-container {
    border-color: var(--imls-accent);
    box-shadow: 0 4px 12px rgba(51, 122, 183, .2);
}
.imls-item-content:hover .imls-image-container img { transform: scale(1.06); }

.imls-item-details { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.imls-item-name { font-weight: 600; color: var(--imls-text); word-wrap: break-word; line-height: 1.3; }

/* === ТЕГИ === */
.imls-item-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.imls-meta-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 500;
    background-color: var(--imls-tag-bg);
    color: var(--imls-text-muted);
    border-radius: 6px;
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
    border: 1px solid var(--imls-tag-border);
    transition: all 0.2s ease;
}
.imls-meta-tag:hover { background-color: #ffffff; border-color: var(--imls-text-muted); }
.imls-meta-price {
    background-color: var(--imls-accent);
    color: #fff;
    border-color: transparent;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(51, 122, 183, .25);
}
.imls-meta-price:hover { background-color: var(--imls-accent-hover); color: #fff; border-color: transparent; }

.imls-item-arrow { flex-shrink: 0; color: var(--imls-text-muted); opacity: 0.5; transition: transform 0.2s ease, opacity 0.2s ease; }
.imls-item-content:hover .imls-item-arrow, .imls-item-content.imls-active .imls-item-arrow { transform: translateX(3px); opacity: 1; color: var(--imls-accent); }

/* === ВСЕ РЕЗУЛЬТАТЫ === */
.imls-all-results { border-top: 2px solid var(--imls-border); background-color: var(--imls-tab-bg); cursor: pointer; flex-shrink: 0; }
.imls-all-results .imls-item-content { justify-content: center; font-weight: 600; color: var(--imls-accent); text-decoration: none; }
.imls-all-results:hover .imls-item-content { background-color: var(--imls-accent-light); }

/* === ПУСТОЕ СОСТОЯНИЕ === */
.imls-empty-state { padding: 40px 20px; text-align: center; color: var(--imls-text-muted); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.imls-empty-state svg { margin-bottom: 12px; opacity: 0.5; }
.imls-empty-state p { margin: 0; font-size: 15px; font-weight: 500; }

/* === СТРАНИЦА РЕЗУЛЬТАТОВ === */
.imls-results-page .imls-results-count { margin-bottom: 16px; }
.imls-result-card {
    border: 1px solid var(--imls-border);
    border-radius: var(--imls-radius);
    background-color: #ffffff;
    padding: 12px;
    margin-bottom: 16px;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s ease;
}
.imls-result-card:hover { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08); }
.imls-result-card .imls-result-image { display: block; margin-bottom: 8px; }
.imls-result-card .imls-result-image img { width: 100%; height: auto; border-radius: 8px; }
.imls-result-card h4 { font-size: 14px; margin: 0 0 6px; line-height: 1.3; }
.imls-result-card h4 a { color: var(--imls-text); text-decoration: none; }
.imls-result-card h4 a:hover { color: var(--imls-accent); }
.imls-results-empty { padding: 60px 20px; }

/* === АДАПТИВ === */
@media (min-width: 769px) { .imls-mobile-close { display: none; } }

@media (max-width: 768px) {
    .imls-fullscreen-mode {
        top: 0; left: 0; transform: none;
        width: 100%; height: 100vh; max-height: 100vh; max-width: 100vw;
        border-radius: 0; padding: 12px;
        background-color: #ffffff;
    }
    .imls-fs-input { height: 48px; font-size: 16px; padding: 0 44px 0 16px; border-radius: var(--imls-radius-pill); }
    .imls-search-wrapper { margin-bottom: 12px; margin-top: 8px; }
    #imlabs-eventsearch-dropdown.imls-fs-results { border-radius: 12px; background-color: #ffffff; }
    .imls-close-fullscreen { display: none; }
    .imls-mobile-close { display: flex; }
    .imls-tabs { padding: 4px; gap: 4px; border-radius: 12px 12px 0 0; }
    .imls-tab { padding: 8px 6px; font-size: 10px; gap: 4px; }
    .imls-tab svg { width: 12px; height: 12px; }
    .imls-item-content { padding: 10px 12px; gap: 10px; }
    .imls-image-container { border-width: 1px; border-radius: 6px; width: 100% !important; max-width: 100px; aspect-ratio: 4 / 3; height: auto !important; }
    .imls-image-container img { width: 100%; height: 100%; }
    .imls-item-name { font-size: 13px; }
    .imls-meta-tag { font-size: 10px; padding: 2px 6px; }
}

@media (max-width: 480px) {
    .imls-fullscreen-mode { padding: 8px; }
    .imls-fs-input { height: 44px; font-size: 15px; }
    .imls-tab { font-size: 10px; padding: 7px 4px; }
    .imls-tab svg { display: none; }
}

/* === ДОСТУПНОСТЬ === */
@media (prefers-reduced-motion: reduce) {
    .imls-spinner { animation-duration: 3s; }
    .imls-image-container img,
    .imls-item-content,
    .imls-close-fullscreen,
    .imls-mobile-close,
    .imls-tab,
    .imls-item-arrow {
        transition-duration: .001ms !important;
    }
    .imls-item-content:hover .imls-image-container img { transform: none; }
    .imls-item-content:hover .imls-item-arrow { transform: none; }
}