/* ==========================================================================
   CSS CHO TRANG CHAT APP (TĨNH, THUẦN)
   ========================================================================== */

/* Tràn viền màn hình và ẩn header/footer mặc định của layout */
.page-chat-app {
    background-color: #0b1e16;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    overflow: hidden;
}

/* KHUNG ỨNG DỤNG */
.natuh-chat-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 99999;
    background-color: #f0f2f5;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Áp dụng font nhưng LOẠI TRỪ các thẻ chứa icon để không làm lỗi hiển thị icon */
.natuh-chat-page *:not(.material-icons-outlined):not(.material-icons-outlined) {
    box-sizing: border-box;
}

/* =========================================
   HEADER SECTION
   ========================================= */
.natuh-chat-page .chat-header {
    background: #1e4a30;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: left;
    width: 100%;
    padding: 24px 20px 32px 20px;
    /* Thêm padding dưới để có chỗ cho phần trắng bo góc đè lên */
    flex-shrink: 0;
}

.natuh-chat-page .chat-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.natuh-chat-page .chat-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.natuh-chat-page .chat-logo {
    width: 125px;
    height: 32px;
    position: relative;
    top: -10px;
}

.natuh-chat-page .chat-logo-svg {
    width: 100%;
    height: 100%;
}

.natuh-chat-page .chat-title {
    font-size: 20px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.05em;
    margin: 0;
}

.natuh-chat-page .chat-actions {
    display: flex;
    gap: 12px;
}

.natuh-chat-page .action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.natuh-chat-page .action-btn .material-icons-outlined {
    font-size: 20px;
}

/* =========================================
   MAIN CHAT AREA (Scrollable)
   ========================================= */
.natuh-chat-page .chat-main-area {
    flex: 1;
    min-height: 0;
    /* Bắt buộc để flexbox hiểu giới hạn chiều cao và cho phép cuộn */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Bật vuốt mượt có đà trên iOS */
    background-color: #ffffff;
    border-radius: 28px 28px 0 0;
    /* Bo góc trên cùng */
    margin-top: -24px;
    /* Kéo trồi lên để đè lên phần nền xanh */
    z-index: 10;
    position: relative;
    padding-top: 20px;
    /* Khoảng cách từ đỉnh bo góc xuống thanh search */
}

/* SEARCH BAR */
.natuh-chat-page .chat-search-container {
    padding: 0 20px;
}

.natuh-chat-page .chat-search-bar {
    width: 100%;
    height: 44px;
    background-color: #F0F2F5;
    /* Màu xám xám y như ảnh */
    border-radius: 22px;
    display: flex;
    align-items: center;
    padding: 0 16px;
}

.natuh-chat-page .search-icon {
    color: #999999;
    font-size: 20px;
    margin-right: 8px;
}

.natuh-chat-page .search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    color: #333333;
    background: transparent;
}

.natuh-chat-page .search-input::placeholder {
    color: #999999;
}

/* FILTERS */
.natuh-chat-page .chat-filters {
    display: flex;
    gap: 10px;
    padding: 10px 10px;
    overflow-x: auto;
    -ms-overflow-style: none;
    /* IE/Edge */
    scrollbar-width: none;
    /* Firefox */
}

.natuh-chat-page .chat-filters::-webkit-scrollbar {
    display: none;
}

.natuh-chat-page .filter-chip {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 400;
    white-space: nowrap;
    border: none;
    background-color: #F5F6F8;
    color: #666666;
    cursor: pointer;
}

.natuh-chat-page .filter-chip.active {
    background-color: #123321;
    color: #ffffff;
}

/* CHAT LIST */
.natuh-chat-page .chat-list {
    display: flex;
    flex-direction: column;
}

.natuh-chat-page .chat-item {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    cursor: pointer;
}

.natuh-chat-page .chat-item:active {
    background-color: #f9f9f9;
}

.natuh-chat-page .chat-avatar {
    position: relative;
    width: 50px;
    height: 50px;
    margin-right: 10px;
    flex-shrink: 0;
}

.natuh-chat-page .avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Màu placeholder avatar cho giống ảnh */
.natuh-chat-page .avatar-orange {
    background-color: #DFA141;
}

.natuh-chat-page .avatar-gray {
    background-color: #EFEFEF;
}

.natuh-chat-page .avatar-orange-light {
    background-color: #CBA563;
}

.natuh-chat-page .avatar-green {
    background-color: #375941;
}

.natuh-chat-page .avatar-green-dark {
    background-color: #123321;
}

.natuh-chat-page .status-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background-color: #FF9800;
    /* Chấm màu cam của thông báo/online */
    border: 2px solid #ffffff;
    border-radius: 50%;
}

.natuh-chat-page .status-dot--online {
    background-color: #22c55e !important;
}

.natuh-chat-page .chat-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-bottom: 1px solid #F0F0F0;
    padding-bottom: 6px;
    padding-top: 2px;
}

.natuh-chat-page .chat-info.border-none {
    border-bottom: none;
}

.natuh-chat-page .chat-info-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
}

.natuh-chat-page .chat-name {
    font-size: 14px;
    font-weight: 600;
    color: #1A1A1A;
}

.natuh-chat-page .chat-time {
    font-size: 12px;
    font-weight: 500;
    color: #999999;
}

.natuh-chat-page .chat-info-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.natuh-chat-page .chat-snippet {
    font-size: 13px;
    font-weight: 500;
    color: #777777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.natuh-chat-page .unread-text {
    color: #1A1A1A;
    font-weight: 600;
}

.natuh-chat-page .chat-badge {
    background-color: #D35400;
    /* Màu đỏ cam */
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.natuh-chat-page .list-spacer {
    height: 80px;
    /* Spacer để cuộn không bị kẹt dưới bottom nav */
}

/* =========================================
   BOTTOM NAVIGATION
   ========================================= */
.natuh-chat-page .chat-bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 64px;
    background-color: #ffffff;
    border-top: 1px solid #EEEEEE;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 50;
}

.natuh-chat-page .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #999999;
    gap: 4px;
    padding: 8px 0;
    width: 60px;
}

.natuh-chat-page .nav-item.active {
    color: #123321;
}

.natuh-chat-page .nav-icon {
    font-size: 24px;
}

.natuh-chat-page .nav-text {
    font-size: 11px;
    font-weight: 600;
}

/* =========================================
   CHAT ITEM BLOCKED BADGE & ACTIONS
   ========================================= */
.natuh-chat-page .chat-blocked-badge {
    color: #EF4444;
    font-weight: 700;
    font-size: 11px;
    margin-right: 4px;
}

.natuh-chat-page .chat-item-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.natuh-chat-page .chat-item-more-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #94A3B8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.15s, color 0.15s;
}

.natuh-chat-page .chat-item-more-btn:hover {
    background-color: #F1F5F9;
    color: #334155;
}

.natuh-chat-page .chat-item-more-btn .material-icons-outlined {
    font-size: 18px;
}

/* =========================================
   CONVERSATION ACTION SHEET (BOTTOM SHEET)
   ========================================= */
.chat-action-sheet {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.chat-action-sheet__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
}

.chat-action-sheet__container {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: #ffffff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
    padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
    animation: sheetSlideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

@keyframes sheetSlideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.chat-action-sheet__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid #F1F5F9;
    margin-bottom: 10px;
}

.chat-action-sheet__target {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-action-sheet__name {
    font-size: 15px;
    font-weight: 700;
    color: #0F172A;
}

.chat-action-sheet__close {
    background: transparent;
    border: none;
    padding: 6px;
    border-radius: 50%;
    color: #94A3B8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-action-sheet__close:hover {
    background: #F1F5F9;
    color: #334155;
}

.chat-action-sheet__body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-action-sheet__item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border: none;
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
    color: #334155;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    transition: background-color 0.15s;
}

.chat-action-sheet__item:hover {
    background: #F8FAFC;
}

.chat-action-sheet__item--danger {
    color: #DC2626;
}

.chat-action-sheet__item--danger:hover {
    background: #FEF2F2;
}

.chat-action-sheet__item-icon {
    font-size: 22px;
    color: inherit;
}

/* =========================================
   BLOCK CONFIRMATION MODAL ON CHAT LIST
   ========================================= */
.cd-block-modal {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cd-block-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.cd-block-modal__container {
    position: relative;
    background: #ffffff;
    width: 90%;
    max-width: 440px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    animation: cdModalPop 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes cdModalPop {
    from {
        opacity: 0;
        transform: scale(0.92);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.cd-block-modal__header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #F1F5F9;
}

.cd-block-modal__title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cd-block-modal__icon {
    font-size: 22px;
    color: #EF4444;
}

.cd-block-modal__title {
    font-size: 16px;
    font-weight: 700;
    color: #0F172A;
    margin: 0;
}

.cd-block-modal__close {
    background: transparent;
    border: none;
    padding: 6px;
    border-radius: 50%;
    color: #94A3B8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cd-block-modal__close:hover {
    background: #F1F5F9;
    color: #334155;
}

.cd-block-modal__body {
    padding: 20px;
}

.cd-block-modal__warning-box {
    background: #FEF2F2;
    border: 1px solid #FEE2E2;
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    gap: 12px;
}

.cd-block-modal__warning-icon {
    color: #DC2626;
    font-size: 24px;
    flex-shrink: 0;
}

.cd-block-modal__warning-content {
    flex: 1;
}

.cd-block-modal__warning-title {
    font-size: 14px;
    font-weight: 500;
    color: #991B1B;
    margin: 0 0 8px;
    line-height: 1.4;
}

.cd-block-modal__warning-title strong {
    font-weight: 700;
}

.cd-block-modal__warning-list {
    margin: 0;
    padding-left: 18px;
    font-size: 12.5px;
    color: #B91C1C;
    line-height: 1.5;
}

.cd-block-modal__warning-list li {
    margin-bottom: 4px;
}

.cd-block-modal__warning-list li:last-child {
    margin-bottom: 0;
}

.cd-block-modal__footer {
    padding: 14px 20px;
    border-top: 1px solid #F1F5F9;
    background: #F8FAFC;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.chat-logo img {
    filter: brightness(0) invert(1);
}

.cd-btn {
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background-color 0.15s, transform 0.1s;
}

.cd-btn:active {
    transform: scale(0.97);
}

.cd-btn--secondary {
    background: #E2E8F0;
    color: #334155;
}

.cd-btn--secondary:hover {
    background: #CBD5E1;
}

.cd-btn--danger {
    background: #EF4444;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cd-btn--danger:hover {
    background: #DC2626;
}