/* 
 * CSS cho giao diện Shortcode - Full Width
 * File được load riêng khi chọn theme style "shortcode"
 * SỬA LẠI: Đảm bảo không reset quá mức, giữ cấu trúc layout
 */

/* ===== RESET CÓ CHỌN LỌC ===== */
body.page-template-front-page-shortcode .site {
    max-width: 100% !important;
    width: 100% !important;
}

/* CHỈ reset main content area */
body.page-template-front-page-shortcode #primary,
body.page-template-front-page-shortcode .content-area,
body.page-template-front-page-shortcode .site-main,
body.page-template-front-page-shortcode #main {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    display: block !important;
}

/* Đảm bảo site-content không bị ảnh hưởng */
body.page-template-front-page-shortcode .site-content {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
}

/* Chỉ reset container của content */
body.page-template-front-page-shortcode .site-content .grid-container,
body.page-template-front-page-shortcode #primary .grid-container {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Ẩn sidebar NHẸ NHÀNG, không làm hỏng layout */
body.page-template-front-page-shortcode #secondary,
body.page-template-front-page-shortcode .sidebar {
    display: none !important;
}

/* Shortcode container - QUAN TRỌNG: Hiển thị đầy đủ */
.shortcode-home-section {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    min-height: 300px; /* Đảm bảo có chiều cao tối thiểu */
}

/* Đảm bảo shortcode con hiển thị */
.shortcode-home-section > * {
    width: 100% !important;
    max-width: 100% !important;
}

/* Style for no shortcode notice */
.no-shortcode-notice {
    text-align: center;
    padding: 60px 20px;
    background: #f9f9f9;
    border-radius: 10px;
    margin: 40px auto;
    max-width: 600px;
}

.no-shortcode-notice h2 {
    color: #333;
    margin-bottom: 15px;
}

.no-shortcode-notice p {
    font-size: 16px;
    color: #666;
}

.no-shortcode-notice a {
    color: #4a6cf7;
    text-decoration: underline;
}

/* DEBUG: Thêm border để kiểm tra */
.shortcode-home-section.debug {
    border: 3px solid red !important;
    background: rgba(255,0,0,0.1) !important;
}

/* ===== ĐẢM BẢO RESPONSIVE ===== */
@media (max-width: 768px) {
    .shortcode-home-section {
        width: 100% !important;
    }
}
/* ===== FIX LAYOUT CHO SHORTCODE GIA PHẢ & ĐỒ THỊ ===== */

/* 1. Container chính - KHÔNG reset quá mức */
.shortcode-home-section {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 20px !important;
    background: #ffffff !important;
    box-sizing: border-box !important;
    position: relative !important;
    z-index: 10 !important;
}

/* 2. Đảm bảo shortcode giữ nguyên style riêng */
.shortcode-home-section * {
    /* KHÔNG reset toàn bộ - chỉ fix những thứ cần thiết */
    box-sizing: border-box !important;
    max-width: 100% !important;
}

/* 3. FIX cụ thể cho các layout phổ biến của shortcode gia phả */
/* Nếu shortcode dùng table layout */
.shortcode-home-section table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 2px !important;
    margin: 15px 0 !important;
}

.shortcode-home-section th,
.shortcode-home-section td {
    padding: 8px 12px !important;
    border: 1px solid #ddd !important;
    vertical-align: middle !important;
}

/* 4. FIX cho flex/grid layouts */
.shortcode-home-section .container,
.shortcode-home-section .row,
.shortcode-home-section .grid {
    display: flex !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    margin: 0 -10px !important;
}

.shortcode-home-section .col,
.shortcode-home-section [class*="col-"] {
    flex: 0 0 auto !important;
    padding: 0 10px !important;
    margin-bottom: 15px !important;
}

/* 5. FIX cho các phần tử gia phả đặc thù */
.shortcode-home-section .family-tree,
.shortcode-home-section .pedigree-chart,
.shortcode-home-section .genealogy-chart {
    width: 100% !important;
    min-height: 500px !important;
    background: #f9f9f9 !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
    padding: 20px !important;
    margin: 20px 0 !important;
    overflow: auto !important;
}

/* 6. FIX cho các node trong cây gia phả */
.shortcode-home-section .node,
.shortcode-home-section .person {
    display: inline-block !important;
    padding: 10px 15px !important;
    margin: 5px !important;
    background: #fff !important;
    border: 2px solid #4a6cf7 !important;
    border-radius: 6px !important;
    text-align: center !important;
    min-width: 120px !important;
}

/* 7. FIX cho các đường kết nối */
.shortcode-home-section .connector,
.shortcode-home-section .line {
    border: 1px solid #666 !important;
    margin: 10px 0 !important;
}

/* 8. FIX cho responsive */
@media (max-width: 768px) {
    .shortcode-home-section {
        padding: 10px !important;
        overflow-x: auto !important;
    }
    
    .shortcode-home-section table {
        font-size: 12px !important;
    }
    
    .shortcode-home-section .node,
    .shortcode-home-section .person {
        min-width: 90px !important;
        padding: 6px 10px !important;
        font-size: 12px !important;
    }
}

.newsletter-widget {
    background: unset !important;
    padding: unset !important;
    border-radius: unset !important;
    border: unset !important;
}

.footer-shortcode .newsletter-widget {
    background: unset !important;
    padding: unset !important;
    border-radius: unset !important;
    border: unset !important;
}