/* Loupik SERP — Google-like layout, Loupik brand */

body.page-serp {
    margin: 0;
    min-height: 100vh;
    background: #fff;
    color: #202124;
    font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
    /* overflow-x:hidden na html/body rozbíjí position:sticky — clip ne */
    overflow-x: clip;
    overflow-y: visible;
}

html:has(body.page-serp),
html.page-serp-html {
    overflow-x: clip;
    overflow-y: visible;
}

body.page-serp .top-bar {
    display: none !important;
}

/* Stejný footer jako na zbytku webu — nikdy neschovávat */
body.page-serp .site-footer {
    display: block !important;
    visibility: visible !important;
    margin-top: auto;
    width: 100%;
    flex-shrink: 0;
}

.serp-top {
    position: sticky;
    top: 0;
    z-index: 40;
    background: #fff;
    border-bottom: 1px solid #ebebeb;
}

.serp-top__row {
    display: grid;
    grid-template-columns: auto minmax(0, 720px) auto;
    align-items: center;
    gap: 1.25rem 1.5rem;
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 1.5rem 0.65rem;
}

.serp-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    flex-shrink: 0;
}

.serp-logo img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 8px;
}

.serp-logo__text {
    display: inline-flex;
    align-items: baseline;
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: -0.03em;
    line-height: 1;
}

.serp-logo__name {
    background: linear-gradient(90deg, #ec4899, #db2777);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.serp-logo__tld {
    color: #6b7280;
    font-weight: 700;
    font-size: 0.95em;
}

.serp-form {
    min-width: 0;
}

.serp-form__field {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    height: 46px;
    padding: 0 0.55rem 0 1rem;
    border: 1px solid #dfe1e5;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(32, 33, 36, 0.08);
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.serp-form__field:hover,
.serp-form__field:focus-within {
    border-color: transparent;
    box-shadow: 0 1px 6px rgba(32, 33, 36, 0.22);
}

.serp-form__icon {
    color: #9aa0a6;
    flex-shrink: 0;
}

.serp-form__input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    font-size: 1rem;
    color: #202124;
    height: 100%;
}

.serp-form__input::-webkit-search-decoration,
.serp-form__input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.serp-form__clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    color: #70757a;
    border-radius: 50%;
    text-decoration: none;
}

.serp-form__clear:hover {
    background: #f1f3f4;
    color: #202124;
}

.serp-form__submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #db2777;
    cursor: pointer;
}

.serp-form__submit:hover {
    background: #fdf2f8;
}

.serp-nav {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    justify-content: flex-end;
}

.serp-nav a {
    color: #5f6368;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
}

.serp-nav a:hover {
    color: #db2777;
}

.serp-tabs {
    display: flex;
    gap: 1.75rem;
    box-sizing: border-box;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.serp-tabs::-webkit-scrollbar {
    display: none;
}

.serp-tabs__item {
    flex: 0 0 auto;
    padding: 0.7rem 0.35rem 0.75rem;
    color: #5f6368;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}

.serp-tabs__item:hover {
    color: #202124;
}

.serp-tabs__item.is-active {
    color: #db2777;
    border-bottom-color: #db2777;
    font-weight: 700;
}

.serp-layout {
    box-sizing: border-box;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
    align-items: stretch;
    justify-content: start;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
    flex: 1 0 auto;
}

.serp-layout.has-rail {
    /* Výsledky + reklama hned vedle sebe (ne reklama až u pravého kraje) */
    grid-template-columns: minmax(0, 652px) 300px;
    column-gap: 2.75rem;
    align-items: stretch;
}

.serp-main {
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0.85rem 0 0;
}

.serp-main > .serp-stats,
.serp-main > .serp-alert,
.serp-main > .serp-empty-hint,
.serp-main > .serp-list,
.serp-main > .serp-related,
.serp-main > .serp-pager {
    max-width: none;
}

.serp-main > .serp-images {
    max-width: min(100%, 980px);
}

.serp-rail {
    box-sizing: border-box;
    width: 300px;
    padding-top: 0.85rem;
    /* Musí být stejně vysoký jako výsledky, jinak sticky nemá kam „jet“ */
    align-self: stretch;
    min-height: 100%;
}

.serp-rail__ad {
    position: -webkit-sticky;
    position: sticky;
    top: 7rem;
    z-index: 5;
    width: 300px;
    min-height: 250px;
    background: transparent;
    border: none;
    border-radius: 0;
}

.serp-rail__ad-inner {
    overflow: hidden;
    border-radius: 0;
    min-height: 0;
    background: transparent;
}

.serp-rail__ad .loupik-adsense,
.serp-rail__ad .loupik-ad-slot {
    display: block !important;
    width: 300px !important;
    min-height: 250px;
    border: none !important;
    background: transparent !important;
    background-image: none !important;
}

.serp-stats {
    margin: 0 0 1.1rem;
    color: #70757a;
    font-size: 0.875rem;
}

.serp-stats strong {
    color: #3c4043;
    font-weight: 600;
}

.serp-empty-hint {
    color: #5f6368;
    font-size: 0.95rem;
}

.serp-alert {
    padding: 1rem 1.1rem;
    border-radius: 12px;
    background: #fff7fb;
    border: 1px solid #f9c7de;
    color: #4b5563;
}

.serp-alert strong {
    display: block;
    color: #be185d;
    margin-bottom: 0.35rem;
}

.serp-alert p {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.5;
}

.serp-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1.55rem;
}

.serp-item__cite {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.2rem;
}

.serp-item__favicon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #f1f3f4;
    object-fit: contain;
    flex-shrink: 0;
    padding: 3px;
}

.serp-item__cite-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.serp-item__site {
    font-size: 0.88rem;
    color: #202124;
    font-weight: 500;
}

.serp-item__url {
    font-size: 0.78rem;
    color: #4d5156;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.serp-item__sep {
    margin: 0 0.15rem;
    color: #9aa0a6;
}

.serp-item__title {
    display: inline-block;
    color: #1a0dab;
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1.3;
    text-decoration: none;
    margin: 0.05rem 0 0.15rem;
}

.serp-item__title:visited {
    color: #681da8;
}

.serp-item__title:hover {
    text-decoration: underline;
}

.serp-item__snippet {
    margin: 0;
    color: #4d5156;
    font-size: 0.9rem;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.serp-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.85rem;
    width: 100%;
}

.serp-images__card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.serp-images__thumb {
    display: block;
    aspect-ratio: 4 / 3;
    border-radius: 10px;
    overflow: hidden;
    background: #f1f3f4;
}

.serp-images__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.serp-images__missing {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #9aa0a6;
    font-size: 0.78rem;
    font-weight: 600;
}

.serp-images__title {
    font-size: 0.82rem;
    color: #1a0dab;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.serp-images__host {
    font-size: 0.75rem;
    color: #70757a;
}

.serp-related {
    margin-top: 2.5rem;
}

.serp-related h2 {
    margin: 0 0 0.85rem;
    font-size: 1.15rem;
    font-weight: 500;
    color: #202124;
}

.serp-related__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.serp-related__grid a {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 999px;
    background: #f1f3f4;
    color: #202124;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.serp-related__grid a:hover {
    background: #e8eaed;
}

.serp-pager {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 2.25rem;
    flex-wrap: wrap;
}

.serp-pager__btn {
    min-width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.65rem;
    border-radius: 999px;
    color: #db2777;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
}

.serp-pager__btn:hover {
    background: #fdf2f8;
}

.serp-pager__btn.is-current {
    color: #fff;
    background: linear-gradient(90deg, #ec4899, #db2777);
    pointer-events: none;
}

.serp-pager__next {
    margin-left: 0.25rem;
    padding: 0 1rem;
}

@media (max-width: 900px) {
    .serp-top__row {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "logo nav"
            "form form";
        padding: 0.85rem 1rem 0.5rem;
        gap: 0.75rem;
    }

    .serp-logo { grid-area: logo; }
    .serp-form { grid-area: form; }
    .serp-nav { grid-area: nav; }

    .serp-logo__text {
        font-size: 1.15rem;
    }

    .serp-tabs {
        padding: 0 1rem;
    }

    .serp-layout {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        padding: 0 1rem 2.5rem;
    }

    .serp-layout.has-rail {
        grid-template-columns: 1fr;
    }

    .serp-main {
        width: 100%;
        margin: 0;
        padding: 0.75rem 0 0;
    }

    .serp-rail {
        width: 100%;
        max-width: 336px;
        justify-self: stretch;
        padding-top: 0;
    }

    .serp-rail__ad {
        position: static;
    }

    .serp-related__grid {
        grid-template-columns: 1fr;
    }

    .serp-images {
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
