/* ==========================================================
   mod_kroon_search – v1.1.2
   ========================================================== */

/* --- TRIGGER --- */
.mod-kroon-search {
    display: inline-flex;
    align-items: center;
}

.kroon-search-trigger {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    background: none;
    border: none;
    cursor: pointer;
    color: white;
    padding: .35rem .5rem;
    border-radius: .5rem;
    font-size: 1rem;
    line-height: 1;
    transition: background .15s, opacity .15s;
}
.kroon-search-input::placeholder {
    color: #cecece;
}
.kroon-search-trigger:hover  { background: rgba(255,255,255,.1); }
.kroon-search-trigger:active { opacity: .7; }
.kroon-search-trigger i      { font-size: 1.15rem; }
.kroon-search-trigger-label  { font-size: .85rem; font-weight: 500; letter-spacing: .01em; }

/* --- OVERLAY – blur, transparent bg --- */
.kroon-search-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: transparent;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 9990;
    animation: kroonFadeIn .2s ease;
}
.kroon-search-overlay.active { display: block; }

@keyframes kroonFadeIn { from { opacity: 0 } to { opacity: 1 } }

/* --- PANEL --- */
.kroon-search-panel {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: #13151a;
    border-bottom: 1px solid #2a2d38;
    z-index: 9999;
    flex-direction: column;
    box-shadow: 0 8px 40px rgba(0,0,0,.5);
    animation: kroonSlideDown .22s cubic-bezier(.22,.68,0,1.15);
}
.kroon-search-panel.active { display: flex; }

@keyframes kroonSlideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

/* --- CONTAINER --- */
.kroon-inner {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 12px;
    padding-right: 12px;
}
@media (min-width: 576px)  { .kroon-inner { max-width: 540px;  } }
@media (min-width: 768px)  { .kroon-inner { max-width: 720px;  } }
@media (min-width: 992px)  { .kroon-inner { max-width: 960px;  } }
@media (min-width: 1200px) { .kroon-inner { max-width: 1140px; } }
@media (min-width: 1400px) { .kroon-inner { max-width: 1320px; } }

/* --- HEADER --- */
.kroon-search-header {
    padding: .9rem 0;
    display: flex;
    align-items: center;
    gap: .75rem;
}

.kroon-search-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: .6rem;
    background-color: rgba(10, 13, 15, 0.6) !important;
    border: 1px solid #2e3245;
    border-radius: 2rem;
    padding: 1rem 1.1rem;
    transition: border-color .15s, box-shadow .15s;
}
.kroon-search-input-wrap:focus-within {
    border-color: var(--sunshine, #f5a623);
    box-shadow: 0 0 0 3px rgba(245,166,35,.18);
}

.kroon-search-input-wrap i {
    color: #d2d2d2;
    font-size: 1rem;
    flex-shrink: 0;
}

.kroon-search-input {
    flex: 1;
    border: none;
    background: transparent !important;
    outline: none;
    padding: .7rem 0;
    font-size: 1rem;
    color: var(--cloud, #e5e7eb) !important;
    min-width: 0;
}
.kroon-search-input::placeholder { color: #4b5563; }
.kroon-search-input::-webkit-search-cancel-button { display: none; }

.kroon-search-close {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border: 1px solid #2e3245;
    background: rgba(10,13,15,.6);
    border-radius: 50%;
    cursor: pointer;
    color: #6b7280;
    font-size: .9rem;
    transition: background .15s, color .15s, border-color .15s;
    line-height: 1;
}
.kroon-search-close:hover { background: #2e3245; color: var(--cloud, #e5e7eb); border-color: #3d4260; }

/* --- EREDMÉNY TERÜLET --- */
.kroon-search-results-wrap {
    padding: .75rem 0 1.25rem;
    min-height: 160px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #2e3245 transparent;
}
.kroon-search-results-wrap::-webkit-scrollbar       { width: 4px; }
.kroon-search-results-wrap::-webkit-scrollbar-track { background: transparent; }
.kroon-search-results-wrap::-webkit-scrollbar-thumb { background: #2e3245; border-radius: 99px; }

.kroon-search-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: 2.5rem 1rem;
    color: #4b5563;
    font-size: .9rem;
}
.kroon-search-status i { font-size: 1.3rem; }

.kroon-search-count {
    font-size: .7rem;
    color: #4b5563;
    margin-bottom: .6rem;
    letter-spacing: .06em;
    text-transform: uppercase;
}

/* --- KÁRTYA TRACK --- */
.kroon-cards-track {
    display: flex;
    gap: .75rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    scrollbar-width: thin;
    scrollbar-color: #2e3245 transparent;
}
.kroon-cards-track::-webkit-scrollbar       { height: 4px; }
.kroon-cards-track::-webkit-scrollbar-track { background: transparent; }
.kroon-cards-track::-webkit-scrollbar-thumb { background: #2e3245; border-radius: 99px; }

/* --- KÁRTYA --- */
.kroon-card {
    flex: 0 0 200px;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    border-radius: .6rem;
    overflow: hidden;
    background: #1a1d2a;
    border: 1px solid #252838;
    transition: border-color .15s, box-shadow .15s;
    cursor: pointer;
    /* button reset */
    padding: 0;
    text-align: left;
    -webkit-appearance: none;
    appearance: none;
}
.kroon-card:hover {
    border-color: var(--sunshine, #f5a623);
    box-shadow: 0 4px 20px rgba(245,166,35,.12);
}
.kroon-card.is-active {
    border-color: var(--sunshine, #f5a623);
    box-shadow: 0 0 0 2px rgba(245,166,35,.3);
}

.kroon-card-img-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #1e2130;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.kroon-card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: .35rem;
    mix-blend-mode: lighten;
}
.kroon-card-img-placeholder {
    font-size: 1.8rem;
    color: #2e3245;
}

.kroon-card-info {
    padding: .45rem .55rem .55rem;
    display: flex;
    flex-direction: column;
    gap: .15rem;
    flex: 1;
}
.kroon-card-name {
    font-size: .75rem;
    font-weight: 500;
    color: #d1d5db;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.kroon-card-price {
    font-size: .78rem;
    font-weight: 700;
    color: var(--sunshine, #f5a623);
    margin-top: auto;
    padding-top: .3rem;
}

/* --- SKELETON --- */
.kroon-skeleton-track {
    display: flex;
    gap: .75rem;
    overflow: hidden;
    padding-bottom: 6px;
}
.kroon-skeleton-card {
    flex: 0 0 130px;
    border-radius: .6rem;
    background: #1a1d2a;
    border: 1px solid #252838;
    overflow: hidden;
}
.kroon-skeleton-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: linear-gradient(90deg, #1e2130 25%, #252838 50%, #1e2130 75%);
    background-size: 200% 100%;
    animation: kroonShimmer 1.5s infinite;
}
.kroon-skeleton-text {
    margin: .5rem .55rem .25rem;
    height: .6rem;
    border-radius: .2rem;
    background: linear-gradient(90deg, #1e2130 25%, #252838 50%, #1e2130 75%);
    background-size: 200% 100%;
    animation: kroonShimmer 1.5s infinite;
}
.kroon-skeleton-text.s2    { width: 80%; animation-delay: .1s; }
.kroon-skeleton-text.s3    { width: 55%; animation-delay: .2s; }
.kroon-skeleton-text.price { width: 65%; height: .7rem; margin-top: .4rem; animation-delay: .15s; }

@keyframes kroonShimmer {
    0%   { background-position:  200% 0; }
    100% { background-position: -200% 0; }
}

/* --- DETAIL PANEL --- */
.kroon-detail-panel {
    margin-top: .9rem;
    background: #1a1d2a;
    border: 1px solid #2e3245;
    border-radius: .75rem;
    overflow: hidden;
    animation: kroonDetailIn .2s ease;
}
@keyframes kroonDetailIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.kroon-detail-inner {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.1rem;
}

.kroon-detail-thumb {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: .45rem;
    background: #1e2130;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.kroon-detail-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    mix-blend-mode: lighten;
}
.kroon-detail-thumb i { color: #2e3245; font-size: 1.4rem; }

.kroon-detail-body { flex: 1; min-width: 0; }

.kroon-detail-title {
    font-size: .88rem;
    font-weight: 600;
    color: var(--cloud, #e5e7eb);
    margin-bottom: .5rem;
    line-height: 1.3;
}

.kroon-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem .75rem;
    margin-bottom: .6rem;
}

.kroon-detail-badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    background: #252838;
    border: 1px solid #2e3245;
    border-radius: .3rem;
    padding: .2rem .55rem;
    font-size: .73rem;
    color: #9ca3af;
}
.kroon-detail-badge strong {
    color: var(--cloud, #d1d5db);
    font-weight: 600;
}

/* Application szöveg – HTML tartalomként renderelve, kibontható */
.kroon-detail-application {
    font-size: .8rem;
    color: #9ca3af;
    line-height: 1.55;
    margin-bottom: .5rem;
    max-height: 4.8em;
    overflow: hidden;
    position: relative;
    transition: max-height .25s ease;
}
.kroon-detail-application.is-expanded {
    max-height: none;
}
/* WYSIWYG tartalom normalizálás – div, p, ul, stb. */
.kroon-detail-application > * { margin: 0 0 .35rem; }
.kroon-detail-application > *:last-child { margin-bottom: 0; }
.kroon-detail-application p  { margin: 0 0 .35rem; }
.kroon-detail-application ul,
.kroon-detail-application ol { padding-left: 1.25rem; margin: 0 0 .35rem; }
.kroon-detail-application div { display: block; }

/* Fade-out gradiens csak összecsukott állapotban */
.kroon-detail-application:not(.is-expanded)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1.6em;
    background: linear-gradient(transparent, #1a1d2a);
    pointer-events: none;
}

/* Kibontás / összecsukás gomb */
.kroon-detail-toggle {
    display: inline-block;
    background: none;
    border: none;
    padding: 0;
    margin-bottom: .75rem;
    font-size: .75rem;
    font-weight: 600;
    color: var(--sunshine, #f5a623);
    cursor: pointer;
    text-decoration: underline;
}
.kroon-detail-toggle:hover {
    color: var(--cloud, #e5e7eb);
}

/* Bővebben gomb – csak a megadott classok, egyedi szín felülírással */
.kroon-detail-btn {
    display: inline-flex;
    align-items: center;
}
.kroon-detail-link {
    color: #000 !important;
}
.kroon-detail-link:hover {
    color: #fff !important;
}

/* --- MOBIL --- */
@media (max-width: 575px) {
    .kroon-search-trigger-label { display: none; }
    .kroon-card          { flex: 0 0 110px; }
    .kroon-skeleton-card { flex: 0 0 110px; }
    .kroon-detail-inner  { gap: .65rem; padding: .75rem .9rem; }
    .kroon-detail-thumb  { width: 44px; height: 44px; }
    .kroon-detail-title  { font-size: .82rem; }
}

/* --- INPUT BORDER FIX --- */
/* A template.css globális id-szelektora keretet ad az inputnak, ezt felülírjuk */
.kroon-search-input {
    border: none !important;
}

/* --- DRAG-TO-SCROLL --- */
.kroon-cards-track {
    cursor: grab;
}
.kroon-cards-track.is-dragging {
    cursor: grabbing;
    scroll-snap-type: none; /* húzás közben ne ugráljon snap-re */
    user-select: none;
    -webkit-user-select: none;
}
.kroon-cards-track.is-dragging .kroon-card {
    pointer-events: none; /* húzás közben a kártya ne reagáljon hoverre/clickre */
}
