/* ==================================================
   GIAO DIỆN CHUẨN WAP 2.0 CLASSIC - WAPEGO / XTGEM 2011
   - Nền trắng, viền mảnh, chữ gọn
   - Thanh tiêu đề xanh dương truyền thống
   - Avatar 30x30px không gradient / không neon / không card bo góc
   ================================================== */

/* ---------- 1. CẤU TRÚC CHUNG (RESET & BASE) ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #ffffff;
    color: #333333;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    line-height: 1.5;
}

a {
    color: #075caa;
    text-decoration: none;
}

a:hover {
    color: #cc0000;
    text-decoration: underline;
}

/* ---------- 2. HEADER WAP TRUYỀN THỐNG ---------- */
.site-header {
    max-width: 920px;
    margin: 4px auto;
    padding: 6px 8px;
    background: #ffffff;
    border: 1px solid #9bbbd5;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 6px;
}

.logo-icon {
    font-size: 14px;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: 13px;
    font-weight: bold;
    color: #286a9d;
}

.brand-tagline {
    font-size: 11px;
    color: #666666;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #008000;
}

.status-dot {
    width: 6px;
    height: 6px;
    background-color: #008000;
}

.badge-vip {
    background: #286a9d;
    color: #ffffff;
    font-size: 11px;
    font-weight: bold;
    padding: 1px 6px;
}

/* ---------- 3. TIÊU ĐỀ KHUNG & DIỄN ĐÀN (CARD & HEADER) ---------- */
.card {
    max-width: 920px;
    margin: 4px auto;
    background: #ffffff;
    border: 1px solid #9bbbd5;
}

.card-header {
    background: #286a9d;
    color: #ffffff;
    padding: 6px 8px;
    font-size: 13px;
    font-weight: bold;
    border-bottom: 1px solid #174c76;
}

.card-header::before {
    content: none !important;
}

/* ---------- 4. DANH SÁCH BÀI VIẾT DẠNG WAP ---------- */
.forum-list {
    display: block;
    width: 100%;
    background: #ffffff;
}

.list-group-item {
    padding: 6px 8px;
    border-bottom: 1px solid #d5e2ec;
    font-size: 13px;
}

.forum-list > .list-group-item:nth-child(even) {
    background: #f4f8fb;
}

.forum-topic {
    position: relative;
    padding: 6px 8px;
    background: transparent;
}

/* Bỏ các khung neon và bóng mờ giả lập cũ */
.forum-topic::before {
    content: none !important;
}

/* Avatar chuẩn WAP 30x30px */
.forum-topic::after {
    content: "";
    position: absolute;
    top: 6px;
    left: 8px;
    width: 30px;
    height: 30px;
    background: url("https://chan.name.vn/assets/img/avtar.jpg") center/cover no-repeat #eeeeee;
    border: 1px solid #b7cde0;
}

.forum-topic .forum-main,
.forum-topic .forum-info {
    margin-left: 38px;
}

/* Tên người dự đoán */
.forum-main::before {
    content: "Người dự đoán:";
    display: block;
    color: #286a9d;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 2px;
}

.forum-main {
    font-size: 13px;
    color: #222222;
    margin-bottom: 4px;
    line-height: 1.4;
    word-break: break-word;
}

/* Thông tin ngày tháng & Trạng thái */
.forum-info {
    border-top: 1px dotted #bfcfdd;
    padding-top: 4px;
    margin-top: 4px;
    font-size: 11px;
    color: #777777;
}

.forum-info .text-muted {
    color: #777777;
    font-size: 11px;
}

.win {
    color: #008000;
    font-weight: bold;
}

.lose {
    color: #cc0000;
    font-weight: bold;
}

/* ---------- 5. PHÂN TRANG ---------- */
.pagination-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 6px 4px;
    background: #edf4fa;
    border-top: 1px solid #b7cde0;
}

.page-btn {
    padding: 2px 6px;
    background: #ffffff;
    color: #075caa;
    border: 1px solid #b7cde0;
    font-size: 12px;
}

.page-btn:hover,
.page-btn.active {
    background: #286a9d;
    color: #ffffff;
    border-color: #174c76;
}

/* ---------- 6. FORM ĐĂNG NHẬP WAP ---------- */
.card:has(form[action*="act=login"]) {
    max-width: 920px;
    margin: 4px auto;
    border: 1px solid #9bbbd5;
}

.card:has(form[action*="act=login"])::before {
    content: "🔑 Đăng Nhập Hệ Thống";
    display: block;
    background: #286a9d;
    color: #ffffff;
    font-weight: bold;
    font-size: 13px;
    padding: 6px 8px;
}

.card:has(form[action*="act=login"]) .card-body {
    padding: 10px 8px;
}

.form-group {
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 4px;
    border: 1px solid #9bbbd5;
    font-size: 13px;
    background: #ffffff;
}

.form-control:focus {
    outline: 1px solid #286a9d;
}

.btn-primary {
    background: #286a9d;
    color: #ffffff;
    border: 1px solid #174c76;
    padding: 4px 12px;
    font-size: 13px;
    cursor: pointer;
}

.btn-primary:hover {
    background: #174c76;
}

/* ---------- 7. FOOTER WAP ---------- */
.site-footer {
    max-width: 920px;
    margin: 4px auto 10px auto;
    padding: 8px;
    background: #ffffff;
    border: 1px solid #9bbbd5;
    font-size: 12px;
}

.footer-info {
    border-bottom: 1px dotted #bfcfdd;
    padding-bottom: 4px;
    margin-bottom: 6px;
}

.footer-title {
    font-weight: bold;
    color: #286a9d;
    font-size: 12px;
}

.footer-desc {
    font-size: 11px;
    color: #666666;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 11px;
    color: #666666;
}

.footer-links a {
    color: #075caa;
}

.footer-links .divider {
    color: #999999;
    margin: 0 2px;
}

/* ---------- 8. OPTIMIZATION CHO MOBILE ---------- */
@media (max-width: 640px) {
    .site-header,
    .card,
    .site-footer {
        margin: 2px auto;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
    }
}
/* ==========================================
   WAP NAVIGATION TABS (MENU NGANG 4 CỘT)
   Phong cách XtGem / Wapego 2011
   ========================================== */
#tab {
    margin-top: 6px;
    background: #286a9d;
    border: 1px solid #174c76;
}

#tab table {
    width: 100%;
    border-collapse: collapse;
}

#tab td {
    text-align: center;
    border-right: 1px solid #174c76;
    padding: 4px 0;
}

#tab td:last-child {
    border-right: none !important;
}

#tab a {
    display: block;
    color: #ffffff !important;
    text-decoration: none;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    padding: 2px 0;
}

#tab a:hover {
    background: #174c76;
    text-decoration: underline;
}

#tab b {
    font-weight: bold;
}

/* WAP 2.0 - Admin message and date */
.wap-greeting {
    margin-top: 8px;
    padding: 8px;
    background: #f4f8fc;
    border: 1px solid #b7cde3;
    border-top: 2px solid #1769aa;
    border-radius: 2px;
    color: #333;
    font-family: Arial, sans-serif;
    font-size: 12px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.wap-admin-message {
    padding-bottom: 6px;
    border-bottom: 1px dotted #b7cde3;
}

.wap-admin-name {
    color: #0055a5;
    margin-right: 4px;
}

.wap-date {
    margin-top: 6px;
    padding: 4px;
    background: #e5eff9;
    border: 1px solid #d0e0f0;
    color: #075a9e;
    font-weight: bold;
    text-align: center;
}

.wap-welcome {
    margin-top: 6px;
    text-align: center;
}

#wap-greeting {
    color: #0055a5;
}

#wap-greeting-message {
    color: #555;
}


/* ========================================
   WAP 2.0 - CHAT ROOM
   Phong cách Wapego / XtGem cổ điển
======================================== */

/* Khung chat */
.card:has(.chat_message) {
    border: 1px solid #b7cde3;
    border-radius: 2px;
    background: #fff;
    box-shadow: none;
    overflow: hidden;
}

/* Tiêu đề Chat room */
.card:has(.chat_message) > .card-header {
    padding: 7px 10px;
    background: #1769aa;
    border-bottom: 1px solid #0d518b;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    line-height: 1.5;
}

.card:has(.chat_message) > .card-header a {
    color: #fff;
    text-decoration: none;
}

.card:has(.chat_message) > .card-header a:hover {
    text-decoration: underline;
}

/* Khu vực nhập tin nhắn */
.card:has(.chat_message) > .card-body {
    padding: 8px;
    background: #f1f6fb;
    border-bottom: 1px solid #cbdbea;
}

.card:has(.chat_message) > .card-body form {
    display: flex;
    align-items: stretch;
    gap: 5px;
    margin: 0;
}

/* Ô nhập nội dung */
.card:has(.chat_message) > .card-body input[type="text"] {
    flex: 1;
    width: 100%;
    min-width: 0;
    height: 34px;
    padding: 6px 8px;
    border: 1px solid #a9bfd5;
    border-radius: 2px;
    background: #fff;
    color: #333;
    font-family: Arial, sans-serif;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}

.card:has(.chat_message) > .card-body input[type="text"]:focus {
    border-color: #1769aa;
    background: #fff;
}

/* Nút gửi tin nhắn */
.card:has(.chat_message) > .card-body input[type="submit"] {
    flex-shrink: 0;
    min-height: 34px;
    padding: 5px 12px;
    border: 1px solid #0d518b;
    border-radius: 2px;
    background: #1769aa;
    color: #fff;
    font-family: Arial, sans-serif;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
}

.card:has(.chat_message) > .card-body input[type="submit"]:hover {
    background: #0d518b;
}

/* Danh sách tin nhắn */
.card:has(.chat_message) > .list-group {
    margin: 0;
    padding: 0;
    background: #fff;
}

/* Từng dòng chat */
.card:has(.chat_message) > .list-group > .list-group-item {
    padding: 7px 9px;
    border: 0;
    border-bottom: 1px dotted #cbdbea;
    border-radius: 0;
    background: #fff;
    color: #333;
    font-family: Arial, sans-serif;
    font-size: 12px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

/* Xen kẽ màu nền cho dễ theo dõi */
.card:has(.chat_message) > .list-group > .list-group-item:nth-child(even) {
    background: #f5f9fd;
}

.card:has(.chat_message) > .list-group > .list-group-item:last-child {
    border-bottom: 0;
}

/* Tên thành viên */
.card:has(.chat_message) .user-name {
    color: #075a9e;
    font-weight: bold;
    text-decoration: none;
}

.card:has(.chat_message) .user-name:hover {
    color: #d35400;
    text-decoration: underline;
}

/* Nội dung tin nhắn */
.card:has(.chat_message) .chat_message {
    color: #333;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Phân trang chat */
.card:has(.chat_message) ~ .mt-3 {
    margin-top: 8px !important;
    font-size: 12px;
}

/* Tương thích màn hình nhỏ */
@media (max-width: 480px) {
    .card:has(.chat_message) > .card-header {
        padding: 6px 8px;
        font-size: 13px;
    }

    .card:has(.chat_message) > .card-body {
        padding: 6px;
    }

    .card:has(.chat_message) > .list-group > .list-group-item {
        padding: 7px;
        font-size: 12px;
    }

    .card:has(.chat_message) > .card-body input[type="submit"] {
        padding: 5px 9px;
    }
}

/* ========================================
   WAP 2.0 - CLASSIC PAGINATION
======================================== */

.pagination-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 8px 0;
    padding: 0;
    box-sizing: border-box;
}

.pagination-wrap .pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 6px;
    background: #f1f6fb;
    border: 1px solid #b7cde3;
    border-radius: 2px;
    box-sizing: border-box;
}

/* Nút phân trang dùng chung */
.pagination-wrap .pagination a,
.pagination-wrap .pagination span {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: 30px;
    min-height: 30px;
    padding: 5px 8px;
    border: 1px solid #b7cde3;
    border-radius: 2px;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
    font-size: 12px;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
}

/* Các trang có thể bấm */
.pagination-wrap .pagination a.link {
    background: #fff;
    color: #075a9e;
    border-color: #b7cde3;
    cursor: pointer;
}

.pagination-wrap .pagination a.link:hover {
    background: #1769aa;
    border-color: #0d518b;
    color: #fff;
}

/* Trang hiện tại */
.pagination-wrap .pagination .current {
    background: #1769aa;
    border-color: #0d518b;
    color: #fff;
    font-weight: bold;
    cursor: default;
}

.pagination-wrap .pagination .current b {
    color: #fff;
    font-weight: bold;
}

/* Trang đầu, trang trước/sau bị vô hiệu hóa */
.pagination-wrap .pagination .disabled {
    background: #e6edf4;
    border-color: #d0dce8;
    color: #8a9aaa;
    cursor: default;
}

/* Ưu tiên hiển thị tốt trên điện thoại */
@media (max-width: 480px) {
    .pagination-wrap {
        margin: 6px 0;
    }

    .pagination-wrap .pagination {
        gap: 3px;
        padding: 5px;
    }

    .pagination-wrap .pagination a,
    .pagination-wrap .pagination span {
        min-width: 28px;
        min-height: 28px;
        padding: 5px 6px;
        font-size: 11px;
    }
}


/* ========================================
   WAP 2.0 - POST / CHAT MESSAGE
   Giao diện theo ảnh mẫu
======================================== */

/* Khung bài viết */
.post {
    display: block;
    margin: 3px 3px 10px;
    padding: 10px 12px 8px;
    background: #ffffff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.025);
    color: #183047;
    font-family: Arial, sans-serif;
    font-size: 13px;
    line-height: 1.55;
    overflow-wrap: anywhere;
    box-sizing: border-box;
}

/* Nội dung bài viết */
.post .chat_message {
    display: block;
    margin: 0;
    padding: 0;
    color: #183047;
    font-size: 13px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Ngày đăng */
.post p {
    margin: 5px 0 0;
    padding: 0;
    color: #8796b0;
    font-family: Arial, sans-serif;
    font-size: 10px;
    line-height: 1.4;
    text-align: right;
}

/* Nếu nội dung có liên kết */
.post a {
    color: #1769aa;
    text-decoration: none;
}

.post a:hover {
    text-decoration: underline;
}

/* Điện thoại */
@media (max-width: 480px) {
    .post {
        margin-bottom: 9px;
        padding: 9px 10px 7px;
        border-radius: 11px;
        font-size: 12px;
    }

    .post .chat_message {
        font-size: 12px;
        line-height: 1.55;
    }

    .post p {
        margin-top: 5px;
        font-size: 10px;
    }
}

/* Logo ảnh trên header */
.brand-logo .logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    overflow: hidden;
}

.brand-logo .logo-icon img {
    display: block;
    width: 36px;
    height: 36px;
    max-width: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* ==========================================
   KHẮC PHỤC LỖI XUỐNG DÒNG (CHAT MESSAGE)
   ========================================== */
.chat_message {
    display: block;
    white-space: pre-wrap;      /* Giữ nguyên định dạng xuống dòng của người dùng */
    word-break: break-word;     /* Tránh tràn chữ */
    overflow-wrap: anywhere;
    line-height: 1.4;           /* Thu hẹp khoảng cách dòng cho gọn gàng */
    margin: 0;
}

/* Xử lý triệt để việc bị nhân đôi khoảng trắng / thẻ br thừa */
.chat_message br {
    display: inline;            /* Đưa về dạng inline để không bị nhảy thành dòng trống lớn */
    margin: 0;
}

/* Nếu hệ thống lưu sẵn nhiều thẻ <br> liên tiếp, ẩn các thẻ <br> thừa sát nhau */
.chat_message br + br {
    display: none; 
}

/* Bố cục form chat */

.chat-room .card-body form,

.card:has(.chat_message) > .card-body form {

    display: flex;

    flex-wrap: wrap;

    gap: 6px;

}



.chat-room .card-body textarea,

.card:has(.chat_message) > .card-body textarea {

    flex: 1 1 100%;

    min-width: 0;

}