:root {
    /* --- BẢNG MÀU TỪ LOGO TÂM HỒN XANH --- */
    --thx-green: #6bbf48;         
    --thx-green-dark: #569e38;    
    --thx-green-pastel: #f0f9eb;  
    --thx-orange: #f38122;
    --thx-orange-pastel: #fdf3e8;
    --thx-blue: #2d76b9;
    --thx-blue-pastel: #eaf4fd;
    --thx-red: #e9484b;
    --thx-red-pastel: #fdecec;
    
    /* --- CẤU HÌNH GIAO DIỆN --- */
    --thx-primary: var(--thx-green-dark); 
    --thx-bg-body: #fdfdfd;       
    --thx-bg-card: #ffffff;
    --thx-text-main: #2d3436;     
    --thx-text-muted: #636e72;    
    --thx-border: #dfe6e9;
    --thx-radius: 16px;           
    --thx-tab-radius: 12px;
    --thx-shadow-card: 0 4px 12px rgba(107, 191, 72, 0.08), 0 2px 4px rgba(0,0,0,0.02);
    --thx-shadow-hover: 0 10px 20px rgba(107, 191, 72, 0.15), 0 4px 8px rgba(0,0,0,0.05);
}

/* =========================================
   1. CẤU TRÚC & TYPOGRAPHY
   ========================================= */
.thx-community-wrapper {
    background-color: var(--thx-bg-body);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--thx-text-main);
    line-height: 1.6;
    padding: 40px 0;
    min-height: 85vh;
    font-size: 16px;
    overflow-x: hidden; /* Tránh cuộn ngang trang */
    width: 100%;
    box-sizing: border-box;
}

.thx-community-wrapper *, 
.thx-community-wrapper *::before, 
.thx-community-wrapper *::after {
    box-sizing: border-box;
}

.thx-container, .thx-group-wrapper {
    max-width: 1140px; margin: 0 auto; padding: 0 20px;
}

.thx-community-wrapper a { text-decoration: none; color: inherit; transition: all 0.2s ease; }
h1, h2, h3, h4 { color: #2d3436; font-weight: 700; margin: 0; line-height: 1.3; }

/* Grid System - Responsive */
.thx-grid-modern, .thx-member-grid, .thx-event-list-simple, .thx-survey-grid {
    display: grid;
    /* Desktop: 4 columns, Mobile: 1fr (full width) */
    grid-template-columns: repeat(4, 1fr); 
    gap: 30px; margin-top: 30px;
}

/* =========================================
   2. DASHBOARD HEADER (TRANG CHỦ)
   ========================================= */
.thx-header-dashboard {
    background: var(--thx-bg-card);
    border-radius: var(--thx-radius);
    padding: 35px;
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: var(--thx-shadow-card);
    margin-bottom: 35px;
    border: 1px solid var(--thx-green-pastel);
    flex-wrap: wrap; gap: 20px;
}

.thx-dash-title { font-size: 30px; color: var(--thx-green-dark); margin-bottom: 8px; }
.thx-dash-subtitle { font-size: 17px; color: var(--thx-text-muted); }

/* User Card */
.thx-user-card-modern {
    display: flex; align-items: center; gap: 15px;
    background: var(--thx-green-pastel);
    padding: 10px 20px 10px 10px;
    border-radius: 50px; border: 1px solid #dcdcdc;
}
.thx-uc-avatar img { width: 50px; height: 50px; border-radius: 50%; display: block; border: 2px solid #fff; }
.thx-uc-content { display: flex; flex-direction: column; line-height: 1.2; }
.thx-uc-role { font-size: 12px; text-transform: uppercase; font-weight: 700; color: var(--thx-orange); }

/* =========================================
   3. MENU TAB (RESPONSIVE SCROLL)
   ========================================= */
.thx-mobile-tab-toggle { display: none; }
.thx-tabs-container { margin-bottom: 30px; }

.thx-nav-tabs, .thx-group-tabs {
    display: flex; gap: 8px; 
    border-bottom: 3px solid var(--thx-green-pastel);
    padding: 0 10px; margin-bottom: 30px; 
    
    /* Responsive Scroll */
    overflow-x: auto; 
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch; /* Mượt trên iOS */
    scrollbar-width: none; /* Ẩn thanh cuộn Firefox */
}
.thx-nav-tabs::-webkit-scrollbar, .thx-group-tabs::-webkit-scrollbar { 
    display: none; /* Ẩn thanh cuộn Chrome/Safari */ 
}

.thx-tab-link, .thx-tab-item {
    padding: 14px 26px;
    font-weight: 600; font-size: 16px;
    color: var(--thx-text-muted);
    background: transparent;
    border: 1px solid transparent; border-bottom: none;
    border-radius: var(--thx-tab-radius) var(--thx-tab-radius) 0 0;
    margin-bottom: -3px; 
    transition: all 0.2s; 
    white-space: nowrap; /* Không xuống dòng */
    flex-shrink: 0; /* Không co lại */
    display: flex; align-items: center; gap: 8px; cursor: pointer;
    text-decoration: none;
}

.thx-tab-link:hover, .thx-tab-item:hover { color: var(--thx-green-dark); background: var(--thx-green-pastel); }
.thx-tab-link.active, .thx-tab-item.active {
    background: #fff; color: var(--thx-green-dark);
    border-color: var(--thx-green-pastel); border-bottom-color: #fff;
    border-top: 4px solid var(--thx-green);
}

/* =========================================
   4. HEADER NHÓM & ẢNH BÌA
   ========================================= */
.thx-group-header {
    background: #fff; border-radius: var(--thx-radius); overflow: hidden;
    border: 1px solid var(--thx-border); box-shadow: var(--thx-shadow-card);
    margin-bottom: 30px;
}

.thx-cover-image { height: 260px; background: #eee; position: relative; }
.thx-cover-image img { width: 100%; height: 100%; object-fit: cover; }
.thx-default-cover { width: 100%; height: 100%; background: linear-gradient(135deg, var(--thx-green), var(--thx-blue)); opacity: 0.8; }

.thx-group-logo {
    position: absolute; bottom: 12px; left: 12px;
    width: 100px; height: 100px; border-radius: 16px; 
    border: 3px solid #fff; box-shadow: 0 4px 10px rgba(0,0,0,0.2); 
    overflow: hidden; background: #fff; z-index: 10;
}
.thx-group-logo img { width: 100%; height: 100%; object-fit: cover; }

.thx-header-info {
    padding: 30px 40px;
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 20px;
}
.thx-header-info h1 { font-size: 34px; font-weight: 800; color: var(--thx-green-dark); margin: 0; flex: 1; min-width: 250px; }

.thx-cta-block { padding: 40px; }

.thx-action-buttons { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }

.thx-badge-member { 
    color: var(--thx-green-dark); background: var(--thx-green-pastel); 
    padding: 8px 18px; border-radius: 30px; font-weight: 700; font-size: 14px; 
    display: flex; align-items: center; gap: 6px;
}

.thx-group-description {
    background: #fff; padding: 40px; border-radius: var(--thx-radius);
    border: 1px solid var(--thx-border); font-size: 17px; color: #444; line-height: 1.8;
}

/* =========================================
   5. THẺ BÀI VIẾT (CARDS)
   ========================================= */
.thx-modern-card, .thx-event-card {
    background: #fff; border: 1px solid var(--thx-border);
    border-radius: var(--thx-radius); overflow: hidden;
    display: flex; flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s; height: 100%;
}
.thx-modern-card:hover, .thx-event-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--thx-shadow-hover);
    border-color: var(--thx-green);
}

.thx-card-header { height: 180px; background-size: cover; background-position: center; position: relative; background-color: #f9f9f9; }
.thx-badge-count {
    position: absolute; bottom: 12px; right: 12px;
    background: rgba(255,255,255,0.95); color: var(--thx-green-dark);
    padding: 6px 12px; border-radius: 12px; font-size: 13px; font-weight: 700;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.thx-card-body { padding: 25px; flex: 1; display: flex; flex-direction: column; }
.thx-card-title { 
    font-size: 20px; margin-bottom: 12px; line-height: 1.4; color: #2d3436; 
    display: block; overflow: visible; white-space: normal; height: auto; 
}
.thx-card-title a:hover { color: var(--thx-orange); }
.thx-card-meta { font-size: 14px; color: #636e72; margin-bottom: 15px; display: flex; align-items: center; gap: 5px; }
.thx-card-text { font-size: 15px; margin-bottom: 25px; flex: 1; color: #636e72; }

.thx-card-footer { 
    margin-top: auto; display: flex; justify-content: center; 
    padding-top: 20px; border-top: 1px solid #f1f5f9; flex-direction: column; gap: 10px;
    text-align: center;
}

/* =========================================
   6. SỰ KIỆN
   ========================================= */
.thx-event-header-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 15px; }
.thx-event-date-badge {
    background: var(--thx-blue-pastel); color: var(--thx-blue); 
    padding: 8px 12px; border-radius: 8px; font-size: 14px; font-weight: 600;
    flex: 1; display: flex; align-items: center; gap: 6px;
}
.thx-event-count-badge {
    background: var(--thx-green-pastel); color: var(--thx-green-dark);
    padding: 8px 12px; border-radius: 8px; font-size: 14px; font-weight: 700;
    white-space: nowrap; display: flex; align-items: center; gap: 4px;
}

/* =========================================
   7. THÀNH VIÊN
   ========================================= */
.thx-member-card {
    background: #fff; border: 1px solid var(--thx-border);
    border-radius: var(--thx-radius); padding: 25px;
    text-align: center; transition: 0.2s;
}
.thx-member-card:hover { transform: translateY(-3px); border-color: var(--thx-green); }
.thx-member-card img.avatar {
    width: 90px; height: 90px; border-radius: 50%; margin-bottom: 15px;
    border: 4px solid var(--thx-green-pastel);
}
.thx-role-badge { 
    background: var(--thx-orange-pastel); color: var(--thx-orange); 
    padding: 5px 12px; border-radius: 12px; font-size: 12px; font-weight: 700; text-transform: uppercase; 
}

/* =========================================
   8. BUTTONS & UTILS
   ========================================= */
.button-primary, .thx-button-primary { 
    background: var(--thx-green) !important; border-color: var(--thx-green) !important; 
    box-shadow: none !important; color: #fff !important; transition: 0.2s !important;
    font-size: 16px !important; padding: 10px 24px !important;
    border-radius: 8px !important; font-weight: 600 !important;
    text-decoration: none !important; display: inline-block; text-align: center;
}
.button-primary:hover, .thx-button-primary:hover { background: var(--thx-green-dark) !important; opacity: 1; }

.button-secondary, .thx-btn-outline, .thx-button-secondary {
    background: #fff !important; color: var(--thx-green-dark) !important;
    border: 1px solid var(--thx-border) !important;
    padding: 10px 24px !important; border-radius: 8px !important;
    font-weight: 600 !important; cursor: pointer;
    text-decoration: none !important; display: inline-block; text-align: center;
}
.button-secondary:hover, .thx-btn-outline:hover, .thx-button-secondary:hover {
    border-color: var(--thx-green) !important; background: var(--thx-green-pastel) !important;
}

.button-link-delete, .thx-button-link-delete { 
    color: var(--thx-red) !important; background: transparent !important; 
    border: 1px solid var(--thx-red) !important; padding: 8px 15px !important;
}
.button-link-delete:hover, .thx-button-link-delete:hover { background: var(--thx-red-pastel) !important; }

.button-small, .thx-button-small { padding: 6px 15px !important; font-size: 14px !important; min-width: auto !important; }

.thx-toolbar { display: flex; justify-content: space-between; margin-bottom: 25px; flex-wrap: wrap; gap: 15px; }
.thx-empty-state { text-align: center; padding: 60px; color: #636e72; background: #fff; border-radius: 12px; border: 1px dashed #b2bec3; font-size: 17px; }

/* =========================================
   9. RESPONSIVE BREAKPOINTS (MOBILE & TABLET)
   ========================================= */
@media (max-width: 992px) {
    .thx-grid-modern, .thx-member-grid, .thx-event-list-simple, .thx-survey-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 768px) {
    .thx-container, .thx-group-wrapper { padding: 0 15px; }
    
    /* 1. Dashboard Header: Stack dọc */
    .thx-header-dashboard { flex-direction: column; text-align: center; padding: 25px 15px; }
    .thx-welcome-section { width: 100%; margin-bottom: 10px; }
    .thx-user-card-modern { width: 100%; justify-content: center; }

    /* 2. Group Header: Ảnh nhỏ lại, info stack dọc */
    .thx-group-header .thx-cover-image { height: 180px; }
    .thx-group-logo { width: 80px; height: 80px; left: 50%; transform: translateX(-50%); bottom: -40px; margin-bottom: 0; }
    .thx-header-info {
        flex-direction: column; align-items: center; text-align: center; 
    }
    .thx-header-info.with-logo { 
        padding: 60px 20px 30px; /* Tăng padding top để tránh logo */
    }
    .thx-header-info h1 { font-size: 24px; min-width: auto; }
    
    .thx-cta-block { padding: 20px; }

    .thx-card-title.with-logo { 
        padding: 30px 0px 0px 0px;
    }
    .thx-action-buttons { width: 100%; justify-content: center; flex-direction: column; }
    .thx-action-buttons .button, .thx-action-buttons form { width: 100%; }
    .thx-action-buttons button { width: 100%; }

    /* 3. Tabs: Dropdown trên Mobile - Nổi bật hơn để dễ nhận diện */
    .thx-mobile-tab-toggle { 
        display: flex; justify-content: space-between; align-items: center; 
        padding: 15px 20px; background: linear-gradient(135deg, var(--thx-green-pastel) 0%, #fff 100%); 
        border: 1px solid var(--thx-green); border-radius: 12px; 
        font-weight: 400; color: var(--thx-green-dark); font-size: 15px;
        cursor: pointer; margin-bottom: 5px; margin-top: 15px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    }
    .thx-mobile-tab-toggle strong { font-weight: 700; font-size: 16px; color: var(--thx-primary, #27ae60); }
    .thx-tabs-container { position: relative; width: 100%; margin-bottom: 25px; }

    .thx-nav-tabs, .thx-group-tabs { 
        display: none; /* Ẩn mặc định trên mobile */
        flex-direction: column; background: #fff; border: 1px solid #eee; 
        border-radius: 8px; padding: 5px; position: absolute; z-index: 99;
        width: 100%; box-shadow: 0 5px 15px rgba(0,0,0,0.1); margin-bottom: 0;
    }
    .thx-group-tabs.show, .thx-nav-tabs.show { display: flex; }
    
    .thx-tab-link, .thx-tab-item { 
        margin-bottom: 0; flex-shrink: 1; flex-grow: 1; 
        justify-content: flex-start; text-align: left; 
        white-space: normal; padding: 12px 15px; font-size: 14px;
        border-bottom: 1px solid #f9f9f9; border-radius: 4px;
        border-left: 3px solid transparent; 
        /* Reset inline borders */
        border-right: none; border-top: none;
    }
    .thx-tab-link:last-child, .thx-tab-item:last-child { border-bottom: none; }
    .thx-tab-link.active, .thx-tab-item.active {
        border-bottom-color: #f9f9f9 !important; border-top: none !important;
        background: var(--thx-green-pastel); 
        border-left-color: var(--thx-green) !important;
        border-left-width: 3px !important; border-left-style: solid !important;
    }

    /* 4. Grid responsive */
    .thx-grid-modern, .thx-member-grid, .thx-event-list-simple, .thx-survey-grid { 
        grid-template-columns: 1fr; /* Full width */
        gap: 20px;
    }

    /* 5. Member Card: Dạng ngang (Avatar trái, Info phải) */
    .thx-member-card {
        display: flex; flex-direction: row; align-items: center; text-align: left;
        padding: 15px;
    }
    .thx-member-card img.avatar { width: 60px; height: 60px; margin-bottom: 0; margin-right: 15px; }
    .thx-member-card h4 { margin: 0; font-size: 16px; }
    .thx-member-card .thx-role-badge { margin-top: 5px; display: inline-block; }
    .thx-member-card form { margin-left: auto; }

    /* 6. Form inputs full width */
    .thx-group-content-body input[type="text"],
    .thx-group-content-body input[type="number"],
    .thx-group-content-body select,
    .thx-group-content-body textarea {
        width: 100% !important; max-width: 100%;
    }
}

/* =========================================
   10. STRETCHED LINK (Clickable Card)
   ========================================= */

/* Kỹ thuật kéo dãn link phủ trùm thẻ cha (thx-modern-card) */
.thx-stretched-link::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    content: "";
}

/* Đảm bảo thẻ Card cha có position relative (File gốc đã có, nhưng thêm cho chắc) */
.thx-modern-card {
    position: relative;
}

/* Đẩy các nút bấm và Form lên trên lớp link phủ để vẫn bấm được riêng biệt */
.thx-card-footer,
.thx-card-footer a,
.thx-card-footer button,
.thx-card-footer form {
    position: relative;
    z-index: 2; /* Cao hơn z-index: 1 của stretched-link */
}

/* Hiệu ứng hover cho cả Card khi rê vào bất cứ đâu */
.thx-modern-card:hover .thx-card-title a {
    color: var(--thx-orange); /* Đổi màu tiêu đề khi hover vào card */
}

/* =========================================
   11. MOBILE UTILITIES
   ========================================= */
.thx-table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.thx-table-responsive table {
    min-width: 600px; /* Đảm bảo table không bị thu nhỏ quá mức gãy layout */
    margin-bottom: 0;
}