/*
 *  Търсачката на началната страница на телефон — тъмна карта върху снимката.
 *  Зарежда се от homepage/_mobile.phtml (засега само на /temp-homepage).
 *
 *  Разметката на формата не е пипана: тя носи datepicker-а, dropdown-ите и
 *  филтърната логика и се ползва и на други страници. Скриптът в
 *  _mobile.phtml слага класа .mobile-search и приятелските надписи; тук са
 *  подредбата и видът на картата. Общото с резултатите — месеците, цената,
 *  скролбарът — е в search-filters.css.
 *
 *  Важи под 768px, както и каруселът с офертите.
 */

@media screen and (max-width: 767px) {

    /* --- къде стои картата ---------------------------------------------- */

    /* „Виж всички оферти" и „Търси по критерии" отпадат — вторият отваряше
       формата, а тя тук стои отворена. */
    .mobile-search .actions {
        display: none;
    }

    /* Слайдерът е тъмен и под снимката оставя ивица, върху която картата не
       изпъква. В мокъпите там е белият фон на страницата. */
    .homepage-slider.has-mobile-search {
        background: none;
    }

    .homepage-slider .controls.mobile-search {
        background: none;
        /* Картата се вдига върху снимката, както в мокъпите, и стои с отстъп
           от ръбовете на екрана, за да личи, че е карта. */
        width: 100%;
        padding: 0 18px;
        margin-top: -46px;
        margin-bottom: 0;
        position: relative;
        z-index: 4;
    }
    /* Отворен панел стърчи под картата — стои над офертите под нея. */
    .homepage-slider .controls.mobile-search.has-open-panel {
        z-index: 1000;
    }
    /* Точките на слайдера остават зад картата и само я разместват. */
    .homepage-slider .controls.mobile-search .slider-pagination {
        display: none;
    }

    /* --- картата ------------------------------------------------------- */

    .mobile-search .cruise-search-form {
        border-radius: 0;
        padding: 14px;
        box-sizing: border-box;
        background: #0b3152;
        box-shadow: 0 8px 24px rgba(11, 49, 82, 0.35);
    }
    .mobile-search .cruise-search-form * {
        box-sizing: border-box;
    }

    /* Заглавието се добавя от скрипта, защото формата се ползва и другаде. */
    .mobile-search-title {
        font-family: 'Roboto Condensed', sans-serif;
        font-weight: 700;
        font-size: 16px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        text-align: center;
        color: #fff;
        margin: 0 0 10px;
    }

    /* --- подредба ------------------------------------------------------ */

    .mobile-search .cruise-search-form .grid {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin: 0;
    }
    .mobile-search .cruise-search-form .grid > li {
        width: auto;
        margin: 0;
        padding: 0;
        float: none;
        flex: 0 0 100%;
        /* Без това полето не се свива под собствения си надпис и двете колони
           не се побират на един ред. */
        min-width: 0;
    }
    .mobile-search .cruise-search-form .grid > li > * {
        min-width: 0;
        max-width: 100%;
    }

    /* Най-отгоре „Къде искаш да пътуваш?", на цял ред. Под него „Кога?" и
       „За колко време?" един до друг. Периодът е първото поле в разметката. */
    .mobile-search .cruise-search-form .js-region-checkbox-filter {
        order: 1;
    }
    .mobile-search .cruise-search-form .grid > li:first-child,
    .mobile-search .cruise-search-form .js-duration-checkbox-filter {
        flex: 0 0 calc(50% - 4px);
        max-width: calc(50% - 4px);
    }
    .mobile-search .cruise-search-form .grid > li:first-child {
        order: 2;
    }
    .mobile-search .cruise-search-form .js-duration-checkbox-filter {
        order: 3;
    }

    /* Останалите се показват, щом формата се разгърне — от „Още филтри" или
       от докосване на което и да е поле. */
    .mobile-search .cruise-search-form .js-startpoint-checkbox-filter { order: 5; }
    .mobile-search .cruise-search-form .js-routepoint-checkbox-filter { order: 6; }
    .mobile-search .cruise-search-form .js-company-checkbox-filter { order: 7; }
    .mobile-search .cruise-search-form .js-ship-checkbox-filter { order: 8; }
    .mobile-search .cruise-search-form .js-type-checkbox-filter { order: 9; }
    /* „Цена на човек" се показва от search-filters.css, щом формата е
       разгъната — style.css я крие на телефон навсякъде. */
    .mobile-search .cruise-search-form .price-per-person-filter { order: 10; }

    .mobile-search .cruise-search-form .js-startpoint-checkbox-filter,
    .mobile-search .cruise-search-form .js-routepoint-checkbox-filter,
    .mobile-search .cruise-search-form .js-company-checkbox-filter,
    .mobile-search .cruise-search-form .js-ship-checkbox-filter,
    .mobile-search .cruise-search-form .js-type-checkbox-filter {
        display: none;
    }
    .mobile-search.is-expanded .cruise-search-form .js-startpoint-checkbox-filter,
    .mobile-search.is-expanded .cruise-search-form .js-routepoint-checkbox-filter,
    .mobile-search.is-expanded .cruise-search-form .js-company-checkbox-filter,
    .mobile-search.is-expanded .cruise-search-form .js-ship-checkbox-filter,
    .mobile-search.is-expanded .cruise-search-form .js-type-checkbox-filter {
        display: block;
    }


    .mobile-search .cruise-search-form .col-20.center {
        order: 20;
    }
    .mobile-search .cruise-search-form .search-close-button-parent {
        display: none;
    }

    /* --- самите полета -------------------------------------------------- */

    .mobile-search .cruise-search-form .checkbox-dropdown__trigger,
    .mobile-search .cruise-search-form input.daterangepicker {
        position: relative;
        height: 44px;
        width: 100%;
        background-color: #fff;
        border: 0;
        border-radius: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 28px 0 12px;
        font-family: 'Roboto', sans-serif;
        font-size: 13.5px;
        font-weight: 500;
        color: #263340;
        text-align: left;
        cursor: pointer;
    }
    .mobile-search .cruise-search-form input.daterangepicker {
        text-overflow: ellipsis;
    }
    /* Дългите надписи се отрязват, вместо да разширяват полето. */
    .mobile-search .cruise-search-form .js-checkbox-dropdown-label {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Иконки на трите основни полета */
    .mobile-search .cruise-search-form input.daterangepicker,
    .mobile-search .cruise-search-form .js-region-checkbox-filter .checkbox-dropdown__trigger,
    .mobile-search .cruise-search-form .js-duration-checkbox-filter .checkbox-dropdown__trigger {
        background-repeat: no-repeat;
        background-position: 12px center;
        background-size: 14px 14px;
        padding-left: 34px;
    }
    .mobile-search .cruise-search-form input.daterangepicker {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%230b3152' stroke-width='2'%3E%3Crect x='3' y='5' width='18' height='16' rx='1'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3C/svg%3E");
    }
    .mobile-search .cruise-search-form .js-region-checkbox-filter .checkbox-dropdown__trigger {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%230b3152' stroke-width='2'%3E%3Cpath d='M21 10c0 6-9 12-9 12s-9-6-9-12a9 9 0 0 1 18 0z'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3C/svg%3E");
    }
    .mobile-search .cruise-search-form .js-duration-checkbox-filter .checkbox-dropdown__trigger {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%230b3152' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
    }

    /* Стрелката вдясно на падащите полета */
    .mobile-search .cruise-search-form .checkbox-dropdown__trigger:after {
        content: '';
        position: absolute;
        right: 12px;
        top: 50%;
        width: 9px;
        height: 6px;
        margin-top: -3px;
        background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='7' viewBox='0 0 11 7' fill='none'%3E%3Cpath d='M1 1l4.5 4.5L10 1' stroke='%230b3152' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat center;
    }

    /* --- „Още филтри" --------------------------------------------------- */

    /* Редовете във формата са поне 48px (style.css) — този е само надпис
       и иначе оставя дупка над бутона. */
    .mobile-search .cruise-search-form .grid > li.mobile-search-more {
        order: 4;
        min-height: 0;
        /* Решетката слага 8px между всички елементи; тук се прибират, за да
           стои редът плътно между полетата и бутона. */
        margin: -2px 0;
    }
    .mobile-search-more-button {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 4px 0;
        border: 0;
        background: none;
        font-family: 'Roboto', sans-serif;
        font-size: 12.5px;
        font-weight: 500;
        white-space: nowrap;
        color: #7ecbe8;
        cursor: pointer;
    }
    .mobile-search-more-button span {
        font-weight: 400;
        color: rgba(255, 255, 255, 0.55);
    }
    /* Разгънат, редът слиза под бутона „Търси" и се превръща в „Затвори". */
    .mobile-search .cruise-search-form .grid > li.mobile-search-more.is-open {
        order: 21;
        display: flex;
        justify-content: center;
        margin: 2px 0 0;
    }
    .mobile-search-more.is-open .mobile-search-more-button {
        text-decoration: underline;
    }

    /* --- бутонът -------------------------------------------------------- */

    .mobile-search .cruise-search-form .col-20.center .btn {
        height: 48px;
        width: 100%;
        border: 0;
        border-radius: 0;
        background: #ffda0e;
        color: #0b3152;
        font-family: 'Roboto Condensed', sans-serif;
        text-transform: uppercase;
        font-weight: 700;
        font-size: 16px;
        line-height: 48px;
        text-align: center;
    }
    .mobile-search .cruise-search-form .col-20.center .clear-filters {
        display: block;
        margin-top: 10px;
        text-align: center;
        font-size: 12.5px;
        color: rgba(255, 255, 255, 0.55);
    }
}

/* --- падащите панели ---------------------------------------------------- */

@media screen and (max-width: 767px) {

    /* Панелите се отварят под полето си, но по цялата ширина на картата —
       под половин ред (период, продължителност) иначе са твърде тесни.
       Затова позиционирането минава през формата: междинните обвивки стават
       static, а панелът остава на мястото си във flow-а (top: auto), тоест
       точно под полето. Височината е ограничена, скролът е вътре. */
    .mobile-search .cruise-search-form {
        position: relative;
    }
    .mobile-search .cruise-search-form .grid > li,
    .mobile-search .cruise-period-selector,
    .mobile-search .checkbox-dropdown-container {
        position: static;
    }
    .mobile-search .cruise-period-selector-wrapper,
    .mobile-search .checkbox-dropdown[aria-expanded="true"] .checkbox-dropdown__panel {
        position: absolute;
        top: auto;
        left: 14px;
        right: 14px;
        /* Широкият вариант на панела (регион) е nowrap и с min-width —
           на телефон би излязъл вдясно от екрана. */
        width: auto;
        min-width: 0;
        white-space: normal;
        max-height: 50vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        margin-top: 2px;
        border: 0;
        border-bottom: 4px solid #ffda0e;
        border-radius: 0;
        box-shadow: 0 10px 30px rgba(11, 49, 82, 0.35);
        z-index: 200;
    }
    .mobile-search .checkbox-dropdown__option {
        padding-left: 14px;
        padding-right: 14px;
    }

    /* Месеците, цената, 16px шрифтът и скролбарът са общи с резултатите —
       в search-filters.css. */
}
