/*
 * Hua Hin MM Group — мягкое обновление карточек и страницы объекта.
 * Файл подключается ПОСЛЕ старых style.css/responsive.css.
 * Для полного отката достаточно убрать его подключение из views/layouts/main.php.
 */

:root {
    --mm-orange: #d87925;
    --mm-orange-dark: #bd6418;
    --mm-blue: #249bd7;
    --mm-text: #20242a;
    --mm-muted: #737982;
    --mm-line: #e8eaed;
    --mm-surface: #ffffff;
    --mm-soft: #f6f7f8;
    --mm-radius: 16px;
    --mm-shadow: 0 12px 32px rgba(24, 31, 39, .10);
}

html {
    scroll-behavior: smooth;
}

/* ---------- Карточки объектов ---------- */

.product {
    overflow: hidden;
    border: 1px solid var(--mm-line);
    border-radius: var(--mm-radius);
    background: var(--mm-surface);
    box-shadow: var(--mm-shadow);
    text-align: left;
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.product:before {
    display: none;
}

.product:hover {
    transform: translateY(-3px);
    border-color: rgba(216, 121, 37, .28);
    box-shadow: 0 18px 44px rgba(24, 31, 39, .14);
}

.product-img {
    padding-bottom: 62.5%;
    background-color: #eef0f2;
    background-size: 72px auto;
}

.product-img:hover {
    opacity: 1;
}

.product-img .product-slider,
.product-img .slick-list,
.product-img .slick-track,
.product-img .slick-slide,
.product-img .slick-slide > div,
.product-img .slick-slide a,
.product-img .slick-slide .js-href {
    height: 100%;
}

.product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product .object-slider-left,
.product .object-slider-right {
    top: 50%;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, .90);
    background-size: 11px auto;
    box-shadow: 0 5px 18px rgba(0, 0, 0, .16);
    opacity: .92;
    transform: translateY(-50%);
}

.product .object-slider-left {
    left: 12px;
}

.product .object-slider-right {
    right: 12px;
}

.product .object-slider-left:hover,
.product .object-slider-right:hover {
    opacity: 1;
}

.product-info {
    padding: 19px 21px 17px;
}

.product-info > div:first-child {
    margin: 0 0 10px !important;
    color: #90959c !important;
    font-size: 12px;
    line-height: 1.35;
    letter-spacing: .035em;
}

.product-marker {
    min-height: 0;
    margin-bottom: 12px;
}

.product-marker > div {
    margin: 0 5px 0 0;
    padding: 5px 10px;
    border-radius: 7px;
    font-size: 11px;
    line-height: 1.2;
    letter-spacing: .035em;
}

.product-marker-rent {
    background: var(--mm-orange);
}

.product-name,
.product-name.tb,
.product-name .td {
    display: block;
    height: auto;
}

.product-name {
    min-height: 58px;
    margin: 0 0 17px;
    color: var(--mm-text);
    font-size: 17px;
    font-weight: 700;
    line-height: 1.42;
}

.product-name a,
.product-name .js-href {
    color: var(--mm-text);
}

.product-line {
    display: none;
}

.product-price {
    margin: 0 0 4px !important;
    color: var(--mm-text);
    font-family: Roboto, Arial, sans-serif;
    font-size: 21px;
    font-weight: 700;
    line-height: 1.35;
}

.product-price + .product-price {
    margin: 0 !important;
    color: var(--mm-muted);
    font-size: 14px;
    font-weight: 400;
}

.product-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 21px;
    border-top: 1px solid var(--mm-line);
    background: var(--mm-surface);
    color: var(--mm-orange-dark);
    font-size: 14px;
    font-weight: 700;
    text-transform: none;
}

.product-footer:hover {
    background: #fff9f3;
}

.product-footer:after {
    margin-left: 12px;
}

/* ---------- Страница отдельного объекта ---------- */

#availability,
#consultation {
    scroll-margin-top: 82px;
}

#availability {
    background: #fafafa;
}

#availability .input input {
    border: 1px solid var(--mm-line);
    border-radius: 11px;
    background: var(--mm-surface);
}

#availability .button {
    border-radius: 11px;
    background: var(--mm-orange);
    box-shadow: 0 8px 20px rgba(189, 100, 24, .22);
}

#availability .button:hover {
    background: var(--mm-orange-dark);
}

.object > .column > div:first-child > .object-slider {
    overflow: hidden;
    border-radius: var(--mm-radius);
    background: #eef0f2;
    box-shadow: var(--mm-shadow);
}

.object > .column > div:first-child > .object-slider .slick-slide img {
    aspect-ratio: 16 / 10;
    object-fit: cover;
}

.object > .column > div:first-child > .object-slider > .object-slider-left,
.object > .column > div:first-child > .object-slider > .object-slider-right {
    top: 50%;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, .90);
    background-size: 13px auto;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
    opacity: .92;
    transform: translateY(-50%);
}

.object > .column > div:first-child > .object-slider > .object-slider-left {
    left: 14px;
}

.object > .column > div:first-child > .object-slider > .object-slider-right {
    right: 14px;
}

.object-content {
    padding: 27px 30px;
    border: 1px solid var(--mm-line);
    border-radius: var(--mm-radius);
    background: var(--mm-surface);
    box-shadow: 0 10px 28px rgba(24, 31, 39, .08);
}

.object-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
}

.object-price {
    color: var(--mm-text);
    font-family: Roboto, Arial, sans-serif;
    font-size: 28px;
    line-height: 1.25;
}

.object-param {
    margin: 0 15px 8px;
}

.object-content .text {
    color: #3f444b;
    text-align: left;
}

.object-content .text h2,
.object-content .text h3 {
    color: var(--mm-text);
    text-align: left;
}

.object-content .text p,
.object-content .text ul,
.object-content .text ol {
    line-height: 1.68;
}

/*
 * Описания из старого редактора проходят через nl2br(). Из-за этого
 * форматирующие переводы строк вокруг HTML-блоков становятся настоящими
 * <br> и накапливаются в большие пустые промежутки. Скрываем только такие
 * служебные переносы внутри контейнера .mm-rent; переносы в тексте остаются.
 */
.object-content .text .mm-rent > br,
.object-content .text .mm-rent > ul > br,
.object-content .text .mm-rent > ol > br {
    display: none;
}

.object-content .text .mm-rent > p > br:first-child,
.object-content .text .mm-rent > p > br:last-child {
    display: none;
}

.object-content .text .mm-rent h2 {
    margin: 0 0 14px !important;
}

.object-content .text .mm-rent h3 {
    margin: 22px 0 10px !important;
}

.object-content .text .mm-rent p {
    margin: 8px 0 !important;
}

.object-content .text .mm-rent ul,
.object-content .text .mm-rent ol {
    margin: 8px 0 16px !important;
    padding-left: 22px !important;
}

.object-content .text .mm-rent li {
    margin: 5px 0 !important;
}

/* По умолчанию новые мобильные элементы скрыты. Без этого CSS сработает hidden. */
.object-mobile-actions[hidden] {
    display: none;
}

/* ---------- Телефоны ---------- */

@media screen and (max-width: 767px) {
    body:has(.object-mobile-actions) {
        padding-bottom: calc(78px + env(safe-area-inset-bottom));
    }

    .catalog-full .column,
    .catalog .column {
        margin-left: 0;
        margin-right: 0;
    }

    .catalog-full .column > div,
    .catalog .column > div {
        padding: 11px 0;
    }

    .catalog .product,
    .catalog-full .product {
        max-width: none;
        margin: 0;
        border-radius: 14px;
    }

    .product:hover {
        transform: none;
    }

    .product-img {
        padding-bottom: 66%;
    }

    .product-info {
        padding: 17px 18px 15px;
    }

    .product-name {
        min-height: 0;
        margin-bottom: 15px;
        font-size: 16px;
    }

    .product-price {
        font-size: 20px;
    }

    .product-footer {
        min-height: 48px;
        box-sizing: border-box;
        padding: 13px 18px;
    }

    #availability {
        padding: 20px 0;
        scroll-margin-top: 72px;
    }

    #availability .column {
        margin: -6px;
    }

    #availability .column > div {
        padding: 6px;
    }

    #availability .input input,
    #availability .button {
        min-height: 50px;
        font-size: 16px;
    }

    .object {
        margin-top: 24px;
    }

    .object > .column {
        margin: 0;
    }

    .object > .column > div {
        padding: 0;
    }

    .object > .column > div + div {
        margin-top: 18px;
    }

    .object > .column > div:first-child > .object-slider {
        border-radius: 13px;
    }

    .object > .column > div:first-child > .object-slider > .object-slider-left,
    .object > .column > div:first-child > .object-slider > .object-slider-right {
        width: 38px;
        height: 38px;
        background-size: 11px auto;
    }

    .object-slider-dots[data-total] {
        margin-top: 11px;
        color: var(--mm-muted);
        font-size: 13px;
        font-weight: 700;
        line-height: 24px;
    }

    .object-slider-dots[data-total] ul {
        display: inline;
        counter-reset: mm-photo;
    }

    .object-slider-dots[data-total] li {
        display: inline;
        counter-increment: mm-photo;
    }

    .object-slider-dots[data-total] li button {
        display: none;
    }

    .object-slider-dots[data-total] li.slick-active:before {
        content: counter(mm-photo) " / ";
    }

    .object-slider-dots[data-total]:after {
        content: attr(data-total);
    }

    .object-content {
        padding: 21px 19px;
        border-radius: 13px;
        box-shadow: none;
    }

    .object-section {
        margin-bottom: 20px;
        padding-bottom: 20px;
        text-align: left;
    }

    .object-price {
        font-size: 25px;
    }

    .object-param {
        margin: 0 7px 8px 0;
        padding: 9px 11px;
        border-radius: 9px;
        background: var(--mm-soft);
        font-size: 14px;
    }

    .order-button,
    .order-button2 {
        display: none;
    }

    .object-mobile-actions[hidden] {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 70;
        display: flex !important;
        gap: 9px;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
        border-top: 1px solid rgba(0, 0, 0, .08);
        background: rgba(255, 255, 255, .96);
        box-shadow: 0 -7px 24px rgba(24, 31, 39, .12);
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
    }

    .object-mobile-action {
        display: flex;
        min-height: 50px;
        flex: 1 1 50%;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
        border-radius: 11px;
        color: #fff;
        font-size: 14px;
        font-weight: 700;
        line-height: 1.2;
        text-align: center;
        text-decoration: none;
    }

    .object-mobile-action:hover {
        color: #fff;
    }

    .object-mobile-action-telegram {
        background: var(--mm-blue);
    }

    .object-mobile-action-availability {
        background: var(--mm-orange);
    }
}

@media screen and (max-width: 374px) {
    .object-mobile-action {
        font-size: 13px;
    }
}
