/**
 * ZSMH Search — typeahead dropdown styles
 * ============================================================================
 * CSS namespace: .zsh-* (ZSMH Search) — aby sa neplietlo so .zsmh-search-bar
 * z témy.
 */

.zsh-dropdown {
    position: fixed;
    z-index: 99999;
    top: 0;
    left: 0;
    width: 400px;
    max-height: 70vh;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
    font-family: 'Trebuchet MS', 'Lucida Grande', sans-serif;
    font-size: 14px;
    color: #1a1a1a;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    pointer-events: none;
    display: none;
}

.zsh-dropdown.is-open {
    display: block;
}

.zsh-dropdown.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.zsh-dropdown::-webkit-scrollbar { width: 6px; }
.zsh-dropdown::-webkit-scrollbar-track { background: #f5f5f5; }
.zsh-dropdown::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

/* ─── Groups ───────────────────────────────────────────────────── */

.zsh-group-head {
    padding: 10px 16px 6px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    background: #fafafa;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 2;
}

.zsh-group-count {
    background: #eee;
    color: #666;
    padding: 1px 7px;
    border-radius: 999px;
    font-weight: bold;
    font-size: 10px;
}

/* ─── Items ───────────────────────────────────────────────────── */

.zsh-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    color: inherit;
    text-decoration: none;
    transition: background 0.1s;
    outline: none;
}

.zsh-item:hover,
.zsh-item.is-active {
    background: #fdf2e1;
}

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

.zsh-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f19e00;
}

.zsh-item[data-type="ucitelia"] .zsh-dot { background: #4147a6; }
.zsh-item[data-type="udalosti"] .zsh-dot { background: #1e90ff; }
.zsh-item[data-type="triedy"]   .zsh-dot { background: #27ae60; }
.zsh-item[data-type="predmety"] .zsh-dot { background: #d38900; }
.zsh-item[data-type="kruzky"]   .zsh-dot { background: #7a2e3b; }
.zsh-item[data-type="terminy"]  .zsh-dot { background: #b8860b; }
.zsh-item[data-type="navody"]   .zsh-dot { background: #666; }
.zsh-item[data-type="page"]     .zsh-dot { background: #aaa; }
.zsh-item[data-type="ms_akcie"] .zsh-dot { background: #27ae60; }
.zsh-item[data-type="emil"]     .zsh-dot { background: #f19e00; width: 10px; height: 10px; box-shadow: 0 0 0 3px rgba(241,158,0,.2); }

.zsh-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

.zsh-title mark {
    background: #fdf2e1;
    color: #d38900;
    padding: 0 2px;
    font-weight: bold;
    border-radius: 2px;
}

.zsh-meta {
    flex-shrink: 0;
    font-size: 12px;
    color: #888;
    white-space: nowrap;
}

/* Lock indicator pre zamknuté výsledky */
.zsh-item.is-locked .zsh-title {
    color: #666;
}

.zsh-lock {
    flex-shrink: 0;
    font-size: 11px;
    color: #d38900;
    background: rgba(241, 158, 0, 0.12);
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: bold;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.zsh-lock::before {
    content: "🔒";
    font-size: 10px;
}

/* eMil CTA — prvá položka */
.zsh-item[data-type="emil"] {
    background: linear-gradient(90deg, rgba(241, 158, 0, 0.08), transparent);
    font-weight: bold;
    border-bottom: 1px solid #eee;
    padding-top: 14px;
    padding-bottom: 14px;
    margin-bottom: 10px;
    position: relative;
}

.zsh-item[data-type="emil"]::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -6px;
    height: 4px;
    background: linear-gradient(180deg, rgba(0,0,0,.04), transparent);
    pointer-events: none;
}

.zsh-item[data-type="emil"]:hover,
.zsh-item[data-type="emil"].is-active {
    background: linear-gradient(90deg, rgba(241, 158, 0, 0.18), rgba(241, 158, 0, 0.02));
}

.zsh-item[data-type="emil"] .zsh-meta {
    color: #d38900;
}

/* ─── Footer — „Zobraziť všetky" ─────────────────────────────── */

.zsh-footer {
    display: block;
    padding: 14px 16px;
    text-align: center;
    background: #fafafa;
    border-top: 1px solid #e5e5e5;
    margin-top: 8px;
    font-size: 13px;
    font-weight: bold;
    color: #4147a6;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.1s;
    position: sticky;
    bottom: 0;
}

.zsh-footer:hover,
.zsh-footer.is-active {
    background: #fdf2e1;
    color: #d38900;
}

/* ─── Empty / Loading states ─────────────────────────────────── */

.zsh-empty,
.zsh-loading {
    padding: 24px 16px;
    text-align: center;
    color: #888;
    font-size: 13px;
}

.zsh-loading::before {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 8px;
    border: 2px solid #f19e00;
    border-top-color: transparent;
    border-radius: 50%;
    vertical-align: middle;
    animation: zsh-spin 0.8s linear infinite;
}

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

/* ─── Mobile — full-width pod inputom ──────────────────────── */
/* Pozn.: `top` a `max-height` nastavuje JS z input.getBoundingClientRect()
   aby rešpektoval aj scroll / otáčanie zariadenia. */

@media (max-width: 640px) {
    .zsh-dropdown {
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        border-radius: 0 0 14px 14px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    }

    .zsh-item {
        padding: 14px 16px;
        font-size: 15px;
    }

    .zsh-group-head {
        padding: 12px 16px 8px;
    }
}

/* ─── Prefers-reduced-motion ─────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .zsh-dropdown,
    .zsh-loading::before {
        transition: none;
        animation: none;
    }
}
