/* ============================================
   SpeedyBook: Modern Listing Card (sb-card)
   ============================================ */

article.sb-card {
    padding-bottom: 24px;
}

/* Ссылка-обёртка */
.sb-card__link {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--content-background-color);
    border-radius: 16px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.02);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s cubic-bezier(0.215, 0.61, 0.355, 1), 
                box-shadow 0.3s cubic-bezier(0.215, 0.61, 0.355, 1), 
                border-color 0.3s ease;
}
.sb-card__link:hover {
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 20px 38px rgba(15, 23, 42, 0.09), 0 4px 12px rgba(15, 23, 42, 0.03);
    transform: translateY(-5px);
    text-decoration: none;
    color: inherit;
}

/* --- Фото --- */
.sb-card__photo {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--listing-thumbnail-background-color, #e2e8f0);
    flex-shrink: 0;
}
.sb-card__photo img,
.sb-card__photo .listing-picture-slider {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
/* No-photo placeholder */
.sb-card__photo.no-picture {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%) !important;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sb-card__photo.no-picture::after {
    content: '';
    position: absolute;
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    background-image: url('../img/no-picture.svg');
    background-position: center center;
    background-size: 32px;
    background-repeat: no-repeat;
    border: 1px solid rgba(255, 255, 255, 0.8);
}
.sb-card__photo.no-picture img {
    background: none !important;
}

/* --- Бейджи --- */
.sb-card__badges {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 2;
}
.sb-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.688rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    backdrop-filter: blur(4px);
    white-space: nowrap;
}
.sb-badge--booking {
    background: rgba(16, 185, 129, 0.9); /* Premium Emerald */
    color: #fff;
}
.sb-badge--online {
    background: rgba(30, 64, 175, 0.85);
    color: #fff;
}

/* --- Рейтинг --- */
.sb-card__rating-slot {
    position: absolute;
    bottom: 8px;
    left: 10px;
    z-index: 2;
}
.sb-card__rating-slot:empty { display: none; }

/* Rating plugin output inside slot */
.sb-card__rating-slot .stat-line {
    background: rgba(0,0,0,0.5);
    color: #fff;
    border-radius: 6px;
    padding: 2px 7px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.sb-rating-overlay {
    background: rgba(0,0,0,0.5);
    color: #fff;
    border-radius: 6px;
    padding: 2px 7px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

/* --- Избранное (Сердечко в стиле Airbnb) --- */
.sb-card__fav {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 3;
    width: 28px;
    height: 28px;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.2);
}
.sb-card__fav:hover {
    transform: scale(1.18);
}
.sb-card__fav .icon {
    width: 22px;
    height: 20px;
    fill: rgba(0, 0, 0, 0.22); /* Полупрозрачная темная подложка для контура */
    stroke: #ffffff;
    stroke-width: 1.5px;
    stroke-linejoin: round;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45));
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.sb-card__fav:hover .icon {
    fill: rgba(244, 63, 94, 0.35); /* Нежная розовая заливка при наведении */
    stroke: #f43f5e;
    transform: scale(1.05);
}
.sb-card__fav.added,
.sb-card__fav.remove {
    animation: sbHeartPop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.sb-card__fav.added .icon,
.sb-card__fav.remove .icon {
    fill: #f43f5e; /* Сочный Rose 500 при активном состоянии */
    stroke: #f43f5e;
    filter: drop-shadow(0 2px 6px rgba(244, 63, 94, 0.45));
}

@keyframes sbHeartPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.22); }
    100% { transform: scale(1); }
}

/* --- Метка Featured --- */
.sb-card-label--featured {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: linear-gradient(135deg, #f59e0b, #d97706); /* Beautiful premium Amber gold gradient */
    color: #ffffff;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.15);
    z-index: 2;
}

/* --- Выделение Featured карточки --- */
.sb-card.featured .sb-card__link {
    border: 1px solid rgba(255, 193, 7, 0.3);
    box-shadow: 0 4px 20px rgba(255, 193, 7, 0.1);
}

/* --- Тело карточки --- */
.sb-card__body {
    padding: 16px 16px 10px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.sb-card__meta {
    font-size: 0.688rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #94a3b8; /* Slate 400 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    margin-bottom: 5px;
}
.sb-card__meta-sep { color: #cbd5e1; }
.sb-card__meta-city { color: #64748b; }

.sb-card__title {
    font-size: 0.938rem;
    font-weight: 700;
    line-height: 1.35;
    color: #1e293b; /* Premium slate-900 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0 0 6px 0;
}

.sb-card__description {
    font-size: 0.785rem;
    color: #64748b; /* Slate 500 */
    line-height: 1.45;
    margin: 0 0 12px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Safety line-clamp to prevent height breakages */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sb-card__price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px dashed rgba(226, 232, 240, 0.8);
}

.sb-card__price {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--body-font-color);
}
.sb-card__price .price-contact-form {
    color: var(--sb-primary);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.sb-card__date {
    font-size: 0.75rem;
    color: var(--muted, #94a3b8);
    display: flex;
    align-items: center;
    gap: 4px;
}
.sb-card__date .icon {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

/* --- Кнопка CTA --- */
.sb-card__footer {
    padding: 0 16px 14px;
    margin-top: auto;
}
.sb-card__cta {
    display: block;
    width: 100%;
    height: 36px;
    line-height: 34px; /* Adjust for 1px border */
    text-align: center;
    background: rgba(16, 185, 129, 0.06); /* Soft, premium emerald tint */
    color: #059669; /* Deep refined emerald text */
    border: 1px solid rgba(16, 185, 129, 0.18);
    border-radius: 8px;
    font-size: 0.813rem;
    font-weight: 600;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none !important;
}
.sb-card__link:hover .sb-card__cta {
    background: #10b981; /* High fidelity emerald solid on hover */
    color: #fff;
    border-color: #10b981;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.28);
}

/* --- ГОРИЗОНТАЛЬНЫЙ ВИД (List Mode) --- */
.list .sb-card {
    max-width: 100% !important;
    width: 100% !important;
    flex: 0 0 100% !important;
    float: none !important;
    padding: 0 12px 24px !important;
}
.list .sb-card__link {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
}
.list .sb-card__photo {
    width: 280px !important;
    min-width: 280px !important;
    aspect-ratio: 4 / 3 !important;
    border-radius: 16px 0 0 16px !important;
}
.list .sb-card__body {
    flex-grow: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    padding: 24px 28px !important;
}
.list .sb-card__description {
    -webkit-line-clamp: 4 !important;
    font-size: 0.813rem !important;
    color: #64748b !important;
    line-height: 1.45 !important;
    margin: 0 0 16px 0 !important;
}
.list .sb-card__footer {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 24px 32px !important;
    min-width: 220px !important;
    border-left: 1px dashed rgba(226, 232, 240, 0.8) !important;
    border-top: none !important;
    margin-top: 0 !important;
}
.list .sb-card__cta {
    width: 100% !important;
    height: 40px !important;
    line-height: 38px !important;
    margin-top: 0 !important;
}

/* --- ПОПАП НА КАРТЕ (Map Popup) --- */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    overflow: hidden;
    padding: 0 !important;
}
.leaflet-popup-content {
    margin: 0 !important;
    width: 250px !important;
    font-family: var(--sb-font);
}
.leaflet-popup-content .sb-card__photo {
    aspect-ratio: 16 / 9;
}
.leaflet-popup-content .sb-card__body {
    padding: 12px;
}
.leaflet-popup-content .sb-card__title {
    font-size: 14px;
}
.leaflet-popup-content .sb-card__cta {
    margin-top: 10px;
    padding: 6px;
    font-size: 12px;
}

/* --- Скрываем старые элементы --- */
article.sb-card ul.card-info > li.offer-task,
article.sb-card ul.card-info > li.offer-service,
article.sb-card div.navigation-column,
article.sb-card ul.card-info > li.fields .booking-services,
article.sb-card ul.card-info > li.system,
article.sb-card ul.card-info > li.fields .stat-line {
    display: none !important;
}

/* ============================================
   SpeedyBook: Modern Compact Mini Card (sb-mini-card)
   ============================================ */
li.sb-mini-card {
    list-style: none !important;
    padding: 6px 0;
}
.sb-mini-card__link {
    display: flex !important;
    gap: 12px;
    align-items: center;
    padding: 10px;
    background: var(--content-background-color, #ffffff);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    text-decoration: none !important;
    color: inherit !important;
    transition: all 0.2s ease;
}
.sb-mini-card__link:hover {
    background: var(--content-background-color, #ffffff);
    border-color: rgba(16, 185, 129, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.sb-mini-card__photo {
    width: 64px;
    height: 64px;
    min-width: 64px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    background: var(--listing-thumbnail-background-color, #e2e8f0);
}
.sb-mini-card__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.sb-mini-card__photo.no-picture::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url('../img/no-picture.svg') center center / 24px no-repeat
                var(--listing-thumbnail-background-color, #e2e8f0);
}
.sb-mini-card__photo.no-picture img {
    background: none !important;
}
.sb-mini-card__body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-width: 0;
}
.sb-mini-card__meta {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sb-mini-card__meta-sep {
    color: #cbd5e1;
}
.sb-mini-card__meta-city {
    color: #64748b;
}
.sb-mini-card__title {
    font-size: 0.813rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
    margin: 0 0 4px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.sb-mini-card__price {
    font-size: 0.813rem;
    font-weight: 700;
    color: #059669;
}

/* ============================================
   SpeedyBook: Mobile & Responsive Adaptation
   ============================================ */
@media (max-width: 768px) {
    /* Collapse horizontal list view back to vertical stack on tablets and mobiles */
    .list .sb-card__link {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    .list .sb-card__photo {
        width: 100% !important;
        min-width: 100% !important;
        aspect-ratio: 16 / 10 !important;
        border-radius: 16px 16px 0 0 !important;
    }
    .list .sb-card__body {
        padding: 16px !important;
    }
    .list .sb-card__footer {
        padding: 0 16px 16px !important;
        border-left: none !important;
        border-top: 1px dashed rgba(226, 232, 240, 0.8) !important;
        min-width: auto !important;
        margin-top: 0 !important;
    }
    .list .sb-card__cta {
        width: 100% !important;
    }
}

@media (max-width: 480px) {
    /* Optimize card grid layout on very narrow screens */
    .sb-card {
        padding-bottom: 16px !important;
    }
    .sb-card__body {
        padding: 12px 12px 8px !important;
    }
    .sb-card__title {
        font-size: 0.875rem !important;
        margin-bottom: 4px !important;
    }
    .sb-card__description {
        font-size: 0.75rem !important;
        margin-bottom: 8px !important;
        -webkit-line-clamp: 2 !important;
    }
    .sb-card__footer {
        padding: 0 12px 12px !important;
    }
    .sb-card__cta {
        height: 34px !important;
        line-height: 32px !important;
        font-size: 0.75rem !important;
    }
}

/* ============================================
   SpeedyBook: Carousel & Box Layout Adaptation
   ============================================ */

/* ============================================
   SpeedyBook: Carousel & Box Layout Adaptation
   ============================================ */

/* 1. Hide legacy absolute shadow pseudo-element under carousel & modern grid items */
ul.featured:not(.list) > li::before,
ul.featured > li::before {
    display: none !important;
}

/* 2. Reset legacy grid/list container li margins & styles inside carousel and box items */
ul.featured > li,
.f-carousel__slide_item,
.f-carousel__slide {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    margin-bottom: 0 !important;
    /* Add beautiful vertical & horizontal padding to prevent clipping and create cards spacing */
    padding: 8px 12px 20px 12px !important;
}

/* 3. Ensure the outer modern card stretches perfectly to fill the carousel slide height */
ul.featured > li > .sb-card,
.f-carousel__slide > .sb-card,
.f-carousel__slide_item > .sb-card {
    height: 100% !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

/* 4. Ensure wrapper link occupies 100% height and uses flexbox column layout */
.sb-card__link {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
}

/* 5. Pin the thumbnail photo ratio at 4:3, preventing vertical stretch under flex layouts */
.sb-card__photo {
    width: 100% !important;
    aspect-ratio: 4 / 3 !important;
    height: auto !important;
    flex-shrink: 0 !important;
}

/* 6. Allow card body to expand and push footer/price-row cleanly to the bottom */
.sb-card__body {
    flex-grow: 1 !important;
    display: flex !important;
    flex-direction: column !important;
}

/* 7. Optimizations for Carousel & Sidebar blocks (sleek, high-density compact descriptions) */
.f-carousel__slide .sb-card__description,
.f-carousel__slide_item .sb-card__description,
.listings_carousel .sb-card__description,
.side_block .sb-card__description {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 0.75rem !important;
    line-height: 1.35 !important;
    color: #64748b !important;
    margin-bottom: 8px !important;
}

.f-carousel__slide .sb-card__body,
.f-carousel__slide_item .sb-card__body,
.side_block .sb-card__body {
    padding: 12px 12px 6px !important;
}

.f-carousel__slide .sb-card__footer,
.f-carousel__slide_item .sb-card__footer,
.side_block .sb-card__footer {
    padding: 0 12px 10px !important;
}

.f-carousel__slide .sb-card__title,
.f-carousel__slide_item .sb-card__title,
.side_block .sb-card__title {
    font-size: 0.875rem !important;
    margin-bottom: 4px !important;
    -webkit-line-clamp: 2 !important;
}




