/*
 Theme Name:   Astra Child
 Theme URI:    https://dieutute.omewa.vn
 Description:  Child theme cho Astra (dùng cho Gieo Hạt)
 Author:       Ban
 Author URI:   https://dieutute.omewa.vn
 Template:     astra
 Version:      1.0.10
*/

/* * ======================================================
 * CSS LƯỚI DỰ ÁN (V13 - Final Adjustments)
 * ======================================================
 */

/* 1) Bố cục full-width */
body.post-type-archive-project_seeding .widget-area {
    display: none !important;
}

body.post-type-archive-project_seeding #primary {
    width: 100% !important;
    max-width: 100% !important;
}

/* 2) Lưới 3-2-1 cột */
.projects-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px !important;
    margin-bottom: 30px !important;
}

@media (max-width: 1024px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .projects-grid {
        grid-template-columns: 1fr !important;
    }
}

/* 3) Card dự án */
.project-card {
    position: relative;
    padding: 0 !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 12px !important;
    background: #fff !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05) !important;
    overflow: hidden !important;
}

/* 4) Ảnh full-bleed */
.project-thumbnail {
    position: relative !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 0 !important;
    border: 0 !important;
}

.project-thumbnail a {
    display: block !important;
    line-height: 0 !important;
}

.project-thumbnail img {
    width: 100% !important;
    height: 260px !important;
    object-fit: cover !important;
    display: block !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

/* 5) Nội dung trong card */
.project-content {
    padding: 1px 10px !important;
}

/* 6) Khối Meta */
.project-top-meta {
    position: static !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    margin: 10px 0 !important;
    gap: 10px;
    pointer-events: auto;
}

/* 7) Badge & Status */
.project-badge {
    pointer-events: auto;
    background: #21409A;
    color: #fff;
    border-radius: 6px;
    font-weight: 700;
    font-size: 14px !important;
    padding: 8px 14px !important;
    line-height: 1.2;
}

.project-days {
    pointer-events: auto;
    color: #4a5568 !important;
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0;
    font-weight: 600;
    font-size: 13px !important;
    display: inline-flex;
    align-items: center;
}

.project-days .dashicons-clock {
    font-size: 1.1em;
    vertical-align: middle;
    margin-right: 5px;
    line-height: 1;
}

.project-status-completed {
    pointer-events: auto;
    background: #2da44e;
    color: #fff;
    border-radius: 6px;
    font-weight: 700;
    font-size: 14px !important;
    padding: 8px 14px !important;
    line-height: 1.2;
}

.project-badge+.project-status-completed {
    margin-left: -10px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.project-badge {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* 10) Tiêu đề Card & Excerpt */
.project-title {
    margin: 0px 0 4px 0 !important;
    line-height: 1.4 !important;
    height: auto !important;
    max-height: 4.2em !important;
    overflow: hidden;
}

.project-title a {
    color: #2f3e9d;
    text-decoration: none !important;
    font-weight: 700 !important;
    font-size: 1rem !important;
    text-transform: uppercase;
}

.project-title a:hover {
    opacity: .9;
}

.project-excerpt {
    color: #4a5568;
    margin-bottom: 12px;
    max-height: 4.5em;
    overflow: hidden;
    margin-top: 0 !important;
}

.project-raised-row {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
    margin-bottom: 8px;
}

.project-raised-row .raised-label {
    color: #718096;
}

.project-raised-row .raised-amount {
    font-weight: 600;
}

.project-raised-row .raised-percent {
    font-weight: 700;
}

.project-progress-bar {
    width: 100%;
    height: 10px;
    background: #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 14px;
    position: relative;
}

.project-progress-bar .project-progress-fill {
    display: block;
    height: 100%;
    background: #21d2b2;
}

.project-goal-line {
    display: flex;
    align-items: center;
    gap: 8px;
}

.project-goal-line .goal-label {
    color: #374151;
}

.project-goal-line .goal-amount {
    color: #2f3e9d;
    font-weight: 700;
    text-decoration: none;
}

.project-card.project-is-completed {
    opacity: 0.75;
    position: relative;
}

.project-card.project-is-completed .project-badge,
.project-card.project-is-completed .project-status-completed {
    pointer-events: auto;
}

/* * ======================================================
 * CSS TRANG CHI TIẾT (SINGLE) - UPDATED V5
 * ======================================================
 */

/* 1. Bố cục 2 cột Laptop */
body.single-project_seeding .project-layout-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
    max-width: 100%;
    box-sizing: border-box;
}

/* 2. Tiêu đề Dự án (Dưới ảnh) */
body.single-project_seeding .project-main-title {
    font-size: 1.5rem !important;
    /* Giảm 50% size */
    color: #21409A !important;
    /* Màu xanh */
    line-height: 1.3 !important;
    margin-bottom: 15px !important;
    margin-top: 10px !important;
    /* Cách ảnh một chút */
}

/* 3. Mô tả ngắn (Thay thế Excerpt) */
.project-short-description {
    margin-bottom: 25px;
    color: #333;
    line-height: 1.6;
    font-size: 1rem;
}

/* 4. Mobile Only / Desktop Only Utilities */
.mobile-only-block {
    display: none !important;
}

.desktop-only-block {
    display: block !important;
}

/* 5. Mobile Responsive */
@media (max-width: 992px) {

    /* Bật hiển thị cho Mobile Blocks */
    .mobile-only-block {
        display: block !important;
    }

    /* Ẩn các khối Desktop */
    .desktop-only-block {
        display: none !important;
    }

    /* Layout cột đơn */
    body.single-project_seeding .project-layout-grid {
        display: block !important;
        width: auto !important;
        margin-left: 15px !important;
        margin-right: 15px !important;
        overflow-x: hidden !important;
    }

    /* Trên Mobile, tiêu đề và mô tả ngắn cũng dùng chung class với Desktop
       nên không cần style riêng, nó sẽ tự flow theo thứ tự HTML mới 
    */
}

/* 6. Fix Khung Hình Ảnh */
.project-main-image {
    width: 100%;
    background-color: #f9f9f9;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
}

.project-main-image img {
    width: 100% !important;
    height: 400px !important;
    object-fit: contain !important;
    display: block;
}

@media (max-width: 600px) {
    .project-main-image img {
        height: 250px !important;
    }
}

/* 7. Bảng Danh Sách Gieo Hạt */
.seeders-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 14px;
}

.seeders-table th,
.seeders-table td {
    padding: 10px;
    border-bottom: 1px solid #eee;
    text-align: left;
}

.seeders-table th {
    background-color: #f9f9f9;
    font-weight: 600;
    color: #21409A;
}

.seeders-table tr:hover {
    background-color: #f0f8ff;
}

.seeders-table .amount {
    color: #2a7c2a;
    font-weight: 700;
}

/* ... (Giữ nguyên các CSS Tabs, Stats, Widget, Button cũ) ... */
body.single-project_seeding .tabs-nav {
    display: flex;
    list-style: none;
    margin: 0 0 20px 0;
    padding: 0;
    border-bottom: 2px solid #e0e0e0;
}

body.single-project_seeding .tabs-nav li {
    margin: 0;
}

body.single-project_seeding .tabs-nav li a {
    display: block;
    padding: 12px 20px;
    text-decoration: none;
    color: #555;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
}

body.single-project_seeding .tabs-nav li a:hover {
    color: #000;
}

body.single-project_seeding .tabs-nav li a.active {
    color: #2f3e9d;
    font-weight: 600;
    border-bottom-color: #2f3e9d;
}

body.single-project_seeding .tab-pane {
    display: none;
    padding-top: 15px;
}

body.single-project_seeding .tab-pane.active {
    display: block;
}

body.single-project_seeding .project-stats-single {
    margin-bottom: 25px;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 20px;
    max-width: 100%;
    box-sizing: border-box;
}

body.single-project_seeding .project-meta {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

body.single-project_seeding .project-meta span {
    flex-basis: auto;
}

body.single-project_seeding .project-meta span strong {
    display: block;
    font-size: 1.2em;
}

body.single-project_seeding .project-progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

body.single-project_seeding .project-stats-single .project-progress-bar {
    flex-grow: 1;
    width: auto;
    height: 14px;
    background: #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    margin-bottom: 0;
}

body.single-project_seeding .project-stats-single .project-progress-bar .project-progress-percent {
    display: block;
    height: 100%;
    background: #21d2b2;
    font-size: 0;
    line-height: 0;
}

body.single-project_seeding .project-progress-text {
    font-size: 1.25em;
    font-weight: bold;
    color: var(--color-fg-default);
    flex-shrink: 0;
}

.project-is-completed-widget {
    background: #f6f8fa;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.project-is-completed-widget h3 {
    margin-top: 0;
    color: #2da44e;
}

.gh-submit-button,
.gh-confirm-button {
    width: 100%;
    padding: 12px;
    border-radius: 4px;
    font-size: 16px;
}

.project-thumbnail-strip {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 10px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.project-thumbnail-item {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 2px solid transparent;
    border-radius: 4px;
    opacity: 0.8;
    transition: all 0.2s;
}

.project-thumbnail-item.active {
    opacity: 1;
    border-color: #2a7c2a;
}

/* ======================================================
 * [FIX HÓA GIẢI] CSS CHO BẢNG & THẺ (MOBILE)
 * ====================================================== 
 */

/* 1. CẤU HÌNH CHUNG */
.gh-history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 14px;
    background: #fff;
}
.gh-history-table th, .gh-history-table td {
    border: 1px solid #eee;
    padding: 10px;
    vertical-align: middle;
}

/* 2. MOBILE RESPONSIVE (< 768px) */
@media (max-width: 768px) {
    
    /* --- PHẦN A: BẢNG "DANH SÁCH GIEO HẠT" (Có class gh-scroll-table) --- */
    /* Đây là đoạn CSS sẽ làm cho bảng của bạn KHÔNG bị vỡ và TRƯỢT ĐƯỢC */
    
    /* Hiện dòng chữ hướng dẫn */
    .gh-mobile-scroll-hint {
        display: block !important;
        font-size: 11px;
        color: #888;
        font-style: italic;
        margin-bottom: 5px;
        text-align: right;
    }

    /* Khung bao ngoài cho phép trượt */
    .gh-table-responsive {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 20px;
        border: 1px solid #eee;
    }

    /* Ép bảng rộng ra 700px để có chỗ hiển thị cột */
    table.gh-scroll-table {
        display: table !important;
        width: 100%;
        min-width: 700px !important; 
    }
    table.gh-scroll-table thead { display: table-header-group !important; }
    table.gh-scroll-table tbody { display: table-row-group !important; }
    table.gh-scroll-table tr { display: table-row !important; }
    table.gh-scroll-table th, table.gh-scroll-table td { 
        display: table-cell !important; 
        white-space: normal;
        text-align: left;
    }
    /* Ẩn các label giả (để không bị hiển thị chồng chéo) */
    table.gh-scroll-table td::before { display: none !important; }


    /* --- PHẦN B: BẢNG "LỊCH SỬ CỦA TÔI" (Không có class gh-scroll-table) --- */
    /* Đoạn này giữ cho bảng Dashboard hiển thị dạng Thẻ đẹp mắt */
    
    table.gh-history-table:not(.gh-scroll-table),
    table.gh-history-table:not(.gh-scroll-table) tbody,
    table.gh-history-table:not(.gh-scroll-table) tr,
    table.gh-history-table:not(.gh-scroll-table) td {
        display: block !important;
        width: 100% !important;
    }

    table.gh-history-table:not(.gh-scroll-table) thead { display: none !important; }

    table.gh-history-table:not(.gh-scroll-table) tr {
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 15px;
        background: #fff;
    }

    table.gh-history-table:not(.gh-scroll-table) td {
        display: flex !important;
        justify-content: space-between;
        border: none !important;
        border-bottom: 1px dashed #eee !important;
    }
    
    table.gh-history-table:not(.gh-scroll-table) td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #555;
    }
}

/* Ẩn chỉ dẫn trên Desktop */
@media (min-width: 769px) {
    .gh-mobile-scroll-hint { display: none !important; }
}

/* =========================================
   CUSTOM: Ẩn tiêu đề trang (Page Title)
   ========================================= */

/* 1. Ẩn tiêu đề trên tất cả các trang tĩnh (Page) */
.page .entry-header .entry-title {
    display: none !important;
}

/* 2. (Tùy chọn) Ẩn luôn khu vực header chứa tiêu đề để tránh khoảng trắng thừa */
.page .entry-header {
    display: none;
}

/* LƯU Ý: Code này sẽ không ảnh hưởng đến trang bài viết (Single Post) 
   hoặc trang chi tiết dự án (Project) vì chúng có class khác (.single-post, .single-project_seeding) */

   /* --- FIX CHAT PAGE MOBILE --- */
@media (max-width: 767px) {
    /* Khi ở trang chat, body không cần padding-bottom quá nhiều vì chat box đã tính toán */
    body.page-template-page-tro-chuyen {
        padding-bottom: 60px !important; /* Bằng chiều cao menu */
        height: 100vh;
        overflow: hidden; /* Chặn cuộn trang web, chỉ cuộn nội dung chat */
    }
    
    /* Đảm bảo Menu Bottom luôn nổi trên khung chat */
    .gh-mobile-nav {
        z-index: 9999999 !important;
    }
}
