/* =========================================================
   Reader Search
   ========================================================= */

.search-page {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
}

/* ---------------------------------------------------------
   Heading
   --------------------------------------------------------- */

.search-heading {
    margin-bottom: 22px;
}

.search-heading p {
    max-width: 760px;
    margin: 0;
    line-height: 1.6;
}

/* ---------------------------------------------------------
   Search form
   --------------------------------------------------------- */

.search-hero-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin: 0 0 18px;
    padding: 14px;
    box-sizing: border-box;
}

.search-hero-field {
    min-width: 0;
    height: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border: 1px solid #d8e4f0;
    border-radius: 13px;
    background: #fff;
    box-sizing: border-box;
}

.search-hero-field:focus-within {
    border-color: #9fc9ef;
    box-shadow: 0 0 0 4px rgba(47, 128, 237, .07);
}

.search-hero-field > span {
    display: grid !important;
    place-items: center;
    width: auto !important;
    height: auto !important;
    flex: 0 0 auto;
    color: #6f8299;
}

.search-hero-field > span svg {
    width: 18px;
    height: 18px;
}

.search-hero-field input {
    width: 100%;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
}

.search-hero-panel select,
.search-genre-field select {
    width: 100%;
    height: 50px;
    padding: 0 12px;
    border: 1px solid #d8e4f0;
    border-radius: 13px;
    background: #fff;
    color: #24324a;
    outline: 0;
    box-sizing: border-box;
}

.search-hero-panel .btn {
    min-width: 150px;
    height: 50px;
}

/* ---------------------------------------------------------
   Toolbar
   --------------------------------------------------------- */

.search-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin: 0 0 22px;
}

.result-summary {
    flex: 0 0 auto;
    padding-top: 7px;
    color: #6a7b91;
    font-size: 13px;
}

.result-summary strong {
    color: #1f3553;
}

.search-chips {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.search-chips .chip {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* ---------------------------------------------------------
   Results grid
   --------------------------------------------------------- */

.search-results {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    width: 100%;
    align-items: start;
}

.search-results .story-card {
    width: 100%;
    min-width: 0;
    margin: 0;
}

.search-results .story-cover {
    position: relative;
    isolation: isolate;
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
}

.search-results .cover-image {
    display: block !important;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/*
 * IMPORTANT:
 * theme.css memberi semua span langsung di story-cover
 * width:100%; height:100%; display:grid.
 *
 * Karena itu badge wajib di-reset di sini.
 */

.search-results .story-cover > .cover-badge {
    position: absolute !important;
    left: 10px !important;
    right: auto !important;
    top: auto !important;
    bottom: 10px !important;

    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    max-width: calc(100% - 20px) !important;

    padding: 5px 9px !important;
    margin: 0 !important;

    border-radius: 999px !important;

    background: rgba(47, 128, 237, .94) !important;
    color: #fff !important;

    font-size: 10px !important;
    line-height: 1.1 !important;
    font-weight: 800 !important;

    white-space: nowrap !important;
    text-align: center !important;

    box-sizing: border-box !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .12) !important;

    z-index: 3 !important;
}

.search-results .story-cover > .cover-gradient {
    position: absolute !important;
    inset: 58% 0 0 !important;
    z-index: 1 !important;

    display: block !important;
    width: auto !important;
    height: auto !important;

    background: linear-gradient(
        180deg,
        transparent,
        rgba(8, 24, 44, .72)
    ) !important;

    pointer-events: none !important;
}

/* ---------------------------------------------------------
   Empty state
   --------------------------------------------------------- */

.search-empty {
    min-height: 320px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    text-align: center;
}

.search-empty p {
    max-width: 520px;
    margin: 0 0 10px;
}

/* ---------------------------------------------------------
   Tablet
   --------------------------------------------------------- */

@media (max-width: 1100px) {
    .search-results {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .search-hero-panel {
        grid-template-columns: minmax(0, 1fr) 170px;
    }

    .search-hero-panel .btn {
        grid-column: 1 / -1;
        width: 100%;
    }

    .search-toolbar {
        display: grid;
        gap: 12px;
    }

    .search-chips {
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 3px;
        scrollbar-width: thin;
    }
}

/* ---------------------------------------------------------
   Mobile
   --------------------------------------------------------- */

@media (max-width: 680px) {
    .search-hero-panel {
        grid-template-columns: 1fr;
    }

    .search-hero-panel .btn {
        grid-column: auto;
        width: 100%;
    }

    .search-results {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .search-results .story-cover > .cover-badge {
        left: 8px !important;
        bottom: 8px !important;
        max-width: calc(100% - 16px) !important;
        padding: 4px 7px !important;
        font-size: 9px !important;
    }
}

@media (max-width: 430px) {
    .search-results {
        grid-template-columns: 1fr;
    }
}