/* datban-nearby — form đặt bàn + panel địa điểm lân cận */

#datban .diadiem {
    z-index: 3;
}

.datban-time-wrap {
    top: 0;
    position: relative;
}

.button.refresh {
    cursor: pointer;
}

a.disabled {
    pointer-events: none;
    opacity: 0.6;
}

.notification {
    display: none;
    font-size: 15px;
    line-height: 18px;
    padding: 10px;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-li {
    overflow: visible;
}

/* Full-width — ngay sau select địa điểm (không dùng <li> để tránh CSS form 50%) */
#datban .datban-nearby,
.datban-nearby {
    display: none;
    width: 100% !important;
    max-width: 100% !important;
    -webkit-box-flex: 0;
    -ms-flex: 0 0 100%;
    flex: 0 0 100%;
    float: none !important;
    margin: 0 0 10px !important;
    padding: 0 10px !important;
    clear: both;
    box-sizing: border-box;
}

/* Layout legacy (sources / .lienhe_datban) — padding panel nearby */
.lienhe_datban #datban .datban-nearby,
.lienhe_datban .datban-nearby {
    padding: 10px !important;
}

#datban .datban-nearby.is-show,
.datban-nearby.is-show {
    display: block;
}

.datban-nearby-title {
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    color: #003366;
    margin: 0 0 8px;
    letter-spacing: 0.02em;
}

/* Không hiện title “chọn CN lân cận” khi không có CN */
#datban .datban-nearby.is-none .datban-nearby-title,
.datban-nearby.is-none .datban-nearby-title {
    display: none !important;
}

.datban-nearby-msg {
    display: none;
    margin: 0 0 8px;
    padding: 12px 14px;
    color: #a94442;
    background: #f2dede;
    border: 1px solid #ebccd1;
    line-height: 1.45;
    font-size: 14px;
    font-weight: 600;
    border-radius: 4px;
}

.datban-nearby-msg.is-show {
    display: block !important;
}

/* Msg empty-state: full width, sát thanh toggle, không chừa lỗ grid */
#datban .datban-nearby.is-none .datban-nearby-msg.is-show,
.datban-nearby.is-none .datban-nearby-msg.is-show {
    margin-bottom: 0;
}

#datban .datban-nearby.is-none .datban-nearby-grid,
.datban-nearby.is-none .datban-nearby-grid {
    display: none;
}

/* Thông báo dưới ô Thời gian khi hết chỗ / không có nearby */
#datban .notification-li .notification {
    color: #a94442;
    background: #f2dede;
    border: 1px solid #ebccd1;
    margin-top: 6px;
    border-radius: 4px;
    font-weight: 600;
    -webkit-line-clamp: 4;
}

/* Lưới card: desktop 3 cột / hàng */
#datban .datban-nearby-grid,
.datban-nearby-grid {
    display: none;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

#datban .datban-nearby-picker.is-expanded .datban-nearby-grid,
.datban-nearby-picker.is-expanded .datban-nearby-grid {
    display: block;
}

.datban-brand-hidden {
    display: none !important;
}

#datban .datban-nearby-card,
.datban-nearby-card {
    width: 32.666%;
    float: left;
    margin: 0 1% 8px 0;
    padding: 0;
    cursor: pointer;
    box-sizing: border-box;
}

#datban .datban-nearby-card:nth-child(3n),
.datban-nearby-card:nth-child(3n) {
    margin-right: 0;
}

.datban-nearby-card-inner {
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #fff;
    height: 100%;
    min-height: 88px;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.datban-nearby-card:hover .datban-nearby-card-inner,
.datban-nearby-card:focus .datban-nearby-card-inner {
    border-color: #003366;
    box-shadow: 0 1px 4px rgba(0, 51, 102, 0.12);
    outline: none;
}

/* Icon pin + địa chỉ trên một hàng; pill giờ góc phải */
.datban-nearby-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 6px;
}

.datban-nearby-card-pin {
    flex-shrink: 0;
    font-size: 14px;
    color: #9a9a9a;
    margin-bottom: 0;
    line-height: 1;
    padding-top: 1px;
}

.datban-nearby-card-addr {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    line-height: 16px;
    margin-bottom: 0;
    color: #003366;
    font-weight: 700;
    text-transform: uppercase;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Pill "Còn bàn lúc HH:mm" — xanh lá (khớp trạng thái còn bàn) */
.datban-nearby-card-badge {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    padding: 3px 8px;
    border-radius: 999px;
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
    box-sizing: border-box;
}

.datban-nearby-card-km {
    font-size: 12px;
    color: #888;
    line-height: 1.3;
}

.datban-nearby-card-km .fa {
    margin-right: 3px;
    font-size: 11px;
}

@media only screen and (max-width: 767px) {
    /* Tablet: 2 cột / hàng */
    #datban .datban-nearby-card,
    .datban-nearby-card {
        width: 49%;
        float: left;
        margin: 0 2% 8px 0;
    }

    #datban .datban-nearby-card:nth-child(3n),
    .datban-nearby-card:nth-child(3n) {
        margin-right: 2%;
    }

    #datban .datban-nearby-card:nth-child(2n),
    .datban-nearby-card:nth-child(2n) {
        margin-right: 0;
    }
}

@media only screen and (max-width: 576px) {
    .notification {
        -webkit-line-clamp: 3;
        line-height: 19px;
    }

    .notification-li {
        height: auto;
        min-height: 65px;
    }

    /* Mobile: 1 cột full width */
    #datban .datban-nearby-card,
    .datban-nearby-card {
        width: 100%;
        float: none;
        margin: 0 0 8px 0;
    }

    .datban-nearby-card-badge {
        margin-left: auto;
    }

    #datban .datban-nearby-card:nth-child(3n),
    .datban-nearby-card:nth-child(3n),
    #datban .datban-nearby-card:nth-child(2n),
    .datban-nearby-card:nth-child(2n) {
        margin-right: 0;
    }
}

/* Khối gộp: banner hết bàn + chọn khung giờ khác (một viền / một nền) */
#datban .datban-soldout-block,
.datban-soldout-block {
    display: none;
    margin: 0 0 10px;
    padding: 0;
    background: #fffaf9;
    border: 1px solid #E07A7A;
    border-radius: 8px;
    box-sizing: border-box;
    overflow: hidden;
}

#datban .datban-soldout-block.is-show,
.datban-soldout-block.is-show {
    display: block;
}

/* Banner bên trong khối — bỏ viền/radius riêng, sát hàng toggle */
#datban .datban-soldout-banner,
.datban-soldout-banner {
    display: none;
    margin: 0;
    padding: 10px 14px;
    color: #C44A4A;
    background: transparent;
    border: none;
    border-radius: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
    box-sizing: border-box;
}

#datban .datban-soldout-banner.is-show,
.datban-soldout-banner.is-show {
    display: block;
}

/* Có picker: ngăn cách nhẹ banner | toggle trong cùng khối */
#datban .datban-soldout-block.has-picker .datban-soldout-banner.is-show,
.datban-soldout-block.has-picker .datban-soldout-banner.is-show {
    border-bottom: 1px solid #f0c8c8;
}

/* Ngăn cách giữa slot picker và nearby picker */
#datban .datban-slot-picker.is-show + .datban-nearby-picker.is-show,
.datban-slot-picker.is-show + .datban-nearby-picker.is-show {
    border-top: 1px solid #f0c8c8;
}

/* Hàng “Chọn khung giờ khác” & “Chi nhánh lân cận” — nằm trong khối, đồng bộ giao diện */
#datban .datban-slot-picker,
.datban-slot-picker,
#datban .datban-nearby-picker,
.datban-nearby-picker {
    display: none;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    background: transparent;
    border: none;
    border-radius: 0;
}

#datban .datban-slot-picker.is-show,
.datban-slot-picker.is-show,
#datban .datban-nearby-picker.is-show,
.datban-nearby-picker.is-show {
    display: block;
    padding: 10px 14px;
    background: #fff;
}

#datban .datban-slot-picker.is-show.is-expanded,
.datban-slot-picker.is-show.is-expanded,
#datban .datban-nearby-picker.is-show.is-expanded,
.datban-nearby-picker.is-show.is-expanded {
    padding-bottom: 12px;
}

/* Title = text + checkbox nhỏ bên phải */
#datban .datban-slot-picker-title,
.datban-slot-picker-title,
#datban .datban-nearby-picker-title,
.datban-nearby-picker-title {
    display: -webkit-inline-box;
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-flex-wrap: nowrap;
    flex-wrap: nowrap;
    -webkit-gap: 8px;
    gap: 8px;
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    color: #003366;
    letter-spacing: 0.02em;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    max-width: 100%;
}

#datban .datban-slot-picker.is-expanded .datban-slot-picker-title,
.datban-slot-picker.is-expanded .datban-slot-picker-title,
#datban .datban-nearby-picker.is-expanded .datban-nearby-picker-title,
.datban-nearby-picker.is-expanded .datban-nearby-picker-title {
    margin: 0 0 8px;
}

#datban .datban-slot-picker-title > span,
.datban-slot-picker-title > span,
#datban .datban-nearby-picker-title > span,
.datban-nearby-picker-title > span {
    -webkit-box-flex: 0;
    -webkit-flex: 0 1 auto;
    flex: 0 1 auto;
    min-width: 0;
}

/*
 * Override #datban .contact input (width:100%; height:45px) —
 * checkbox phải nhỏ, cố định, không giống ô text.
 */
#datban .contact .datban-slot-toggle,
#datban .datban-slot-toggle,
.datban-slot-toggle,
#datban .contact .datban-nearby-toggle,
#datban .datban-nearby-toggle,
.datban-nearby-toggle {
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 14px;
    flex: 0 0 14px;
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
    width: 14px !important;
    height: 14px !important;
    max-width: 14px !important;
    margin: 0;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-sizing: border-box;
    vertical-align: middle;
    cursor: pointer;
    -webkit-appearance: checkbox;
    -moz-appearance: checkbox;
    appearance: checkbox;
}

/* Lưới giờ: ẩn mặc định; chỉ hiện khi checkbox bật (is-expanded) */
#datban .datban-slot-grid,
.datban-slot-grid {
    display: none;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-box-align: stretch;
    -webkit-align-items: stretch;
    align-items: stretch;
    -webkit-gap: 8px;
    gap: 8px;
    width: 100%;
    margin: 0;
    padding: 0;
}

#datban .datban-slot-picker.is-expanded .datban-slot-grid,
.datban-slot-picker.is-expanded .datban-slot-grid {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
}

/* PC: 6 ô / hàng — calc trừ 5 khe 8px; khe đều bốn phía */
#datban .datban-slot,
.datban-slot {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 calc((100% - 40px) / 6);
    flex: 0 0 calc((100% - 40px) / 6);
    max-width: calc((100% - 40px) / 6);
    float: none;
    margin: 0;
    padding: 10px 6px;
    min-height: 56px;
    box-sizing: border-box;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #F4EFE6;
    color: #888;
    text-align: center;
    cursor: default;
    font-family: inherit;
    line-height: 1.25;
    -webkit-appearance: none;
    appearance: none;
}

#datban .datban-slot-time,
.datban-slot-time {
    display: block;
    font-size: 14px;
    font-weight: 700;
}

#datban .datban-slot-status,
.datban-slot-status {
    display: block;
    margin-top: 2px;
    min-height: 14px;
    font-size: 11px;
    font-weight: 600;
}

#datban .datban-slot.is-available,
.datban-slot.is-available {
    background: #eef3f8;
    border-style: solid;
    border-color: #003366;
    color: #003366;
    cursor: pointer;
}

#datban .datban-slot.is-available:hover,
.datban-slot.is-available:hover,
#datban .datban-slot.is-available:focus,
.datban-slot.is-available:focus {
    background: #003366;
    border-style: solid;
    border-color: #003366;
    color: #fff;
    outline: none;
}

#datban .datban-slot.is-full,
.datban-slot.is-full,
#datban .datban-slot.is-too_soon,
.datban-slot.is-too_soon {
    background: #F4EFE6;
    border-style: solid;
    border-color: #e0e0e0;
    color: #888;
    cursor: default;
}

/* Hết bàn: gạch ngang giờ + chữ trạng thái, giữ màu/border hiện có. Không gạch is-too_soon. */
#datban .datban-slot.is-full .datban-slot-time,
.datban-slot.is-full .datban-slot-time,
#datban .datban-slot.is-full .datban-slot-status,
.datban-slot.is-full .datban-slot-status {
    text-decoration: line-through;
}

#datban .datban-slot.is-selected_full,
.datban-slot.is-selected_full {
    background: #F4EFE6;
    border-style: dashed;
    border-color: #a94442;
    color: #a94442;
    cursor: default;
}

#datban .datban-slot[disabled],
.datban-slot[disabled] {
    opacity: 1;
    cursor: default;
}

/* Mobile: 3 ô / hàng — calc trừ 2 khe 8px */
@media only screen and (max-width: 767px) {
    #datban .datban-slot,
    .datban-slot {
        -webkit-box-flex: 0;
        -webkit-flex: 0 0 calc((100% - 16px) / 3);
        flex: 0 0 calc((100% - 16px) / 3);
        max-width: calc((100% - 16px) / 3);
        width: auto;
        margin: 0;
    }

    /* Nhóm nút full hàng — CTA in-flow nằm cuối form khi không còn dính viewport */
    #datban .formBox .btn-group {
        display: block;
        width: 100%;
        max-width: 100%;
    }

    /* Ẩn Làm lại — chỉ mobile */
    #datban .button.refresh {
        display: none;
    }

    /* CTA mặc định: in-flow cuối form, cao theo chữ, inset 16px.
       Màu gán thẳng token template: layout mới --button-2 vàng; layout cũ fallback đỏ. */
    #datban .formBox .cur.button {
        position: relative;
        float: none;
        display: block;
        clear: both;
        -webkit-box-flex: 0;
        -webkit-flex: 0 0 calc(100% - 32px);
        flex: 0 0 calc(100% - 32px);
        width: auto;
        max-width: none;
        height: auto;
        margin: 0 16px 16px;
        border-radius: 16px;
        text-align: center;
        white-space: normal;
        line-height: 1.35;
        padding: 14px 18px;
        box-sizing: border-box;
        letter-spacing: 0.4px;
        overflow: hidden;
        color: #ffffff;
        color: var(--white, #ffffff);
        background: #ee4037;
        background: var(--button-2);
        box-shadow: inset 0 -5px 0 0 rgb(0 0 0 / 15%);
    }

    /* Hover/focus khớp .formBox .button: navy --button-1, layout cũ cam */
    #datban .formBox .cur.button:hover,
    #datban .formBox .cur.button:focus {
        color: #ffffff;
        color: var(--white, #ffffff);
        background: #f58c21;
        background: var(--button-1);
    }

    /* Dính đáy viewport khi khối page_conten_page còn che đáy màn hình */
    #datban .formBox .cur.button.is-datban-cta-stuck {
        position: fixed;
        left: 16px;
        right: 16px;
        bottom: 16px;
        z-index: 9000;
        -webkit-flex: none;
        flex: none;
        width: auto;
        margin: 0;
    }

    /* Chừa chỗ field cuối khi CTA đang overlay — JS ghi đè theo chiều cao nút */
    #datban #form_datbanhome.is-datban-cta-stuck-pad {
        padding-bottom: 80px;
    }

    /* Text CTA tối đa 2 dòng, không tràn vỡ góc */
    #datban .formBox .cur.button .datban-book-label {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
}
