/*
 * File: main.css
 * Theme: FKSE Block Theme
 * Description: Main stylesheet for the theme, handling layout, navigation, and responsive design.
 */

/* --- 1. General & Reset --- */
/*--------------------------------------------------------------*/
body {
    margin: 0;
    font-family: var(--wp--preset--font-family--roboto);
    background-color: #fff;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 15px;
}

a {
    text-decoration: none;
    color: var(--wp--preset--color--primary);
    transition: color 0.2s ease-in-out;
}

a:hover {
    color: var(--wp--preset--color--foreground);
}

* {
    box-sizing: border-box;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

main {
    min-height: 70vh;
}

/* --- 2. Header & Branding --- */
/*--------------------------------------------------------------*/
.site-header {
    background-color: var(--wp--preset--color--primary);
    padding: 20px 0; /* Padding mặc định lớn hơn */
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: padding 0.3s ease-in-out, box-shadow 0.3s ease-in-out; /* Thêm hiệu ứng chuyển động mượt */
}

/* Style cho header khi đã cuộn */
.site-header.scrolled {
    padding: 8px 0; /* Padding nhỏ hơn khi đã cuộn */
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); /* Thêm đổ bóng nhẹ */
}

/* Tương thích với thanh admin bar của WordPress khi đăng nhập */
.admin-bar .site-header {
    top: 32px;
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-branding a {
    color: var(--wp--preset--color--background);
    font-weight: bold;
    font-size: 32px;
    text-transform: uppercase;
}

/* --- 3. Main Navigation (Desktop) --- */
/*--------------------------------------------------------------*/
.main-navigation ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    gap: 30px;
}

.main-navigation li {
    position: relative;
}

.main-navigation li a {
    color: var(--wp--preset--color--background);
    font-weight: bold;
    font-size: 14px;
    text-transform: uppercase;
    display: block;
    padding: 10px 0;
}

.main-navigation .current-menu-item > a {
    text-decoration: underline;
}

/* --- 4. Dropdown Menu (Desktop) --- */
/*--------------------------------------------------------------*/
@media (min-width: 769px) {
    .main-navigation .sub-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        background-color: #ffffff;
        min-width: 220px;
        z-index: 1001;
        box-shadow: 0 3px 10px rgba(0,0,0,0.15);
        border-top: 3px solid var(--wp--preset--color--primary);
        list-style: none;
        padding: 0;
    }

    .main-navigation ul li:hover > .sub-menu {
        display: block;
    }

    .main-navigation .sub-menu li a {
        color: var(--wp--preset--color--foreground);
        padding: 12px 20px;
        text-transform: none;
        font-weight: 400;
        font-size: 14px;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .main-navigation .sub-menu li:last-child a {
        border-bottom: none;
    }

    .main-navigation .sub-menu li a:hover {
        background-color: #f5f5f5;
    }
    
    .main-navigation .menu-item-has-children > a {
        position: relative;
        padding-right: 15px;
    }
    .main-navigation .menu-item-has-children > a::after {
        content: '▼';
        font-size: 0.6em;
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        transition: transform 0.2s;
    }
    .main-navigation li:hover > a::after {
        transform: translateY(-50%) rotate(180deg);
    }
}

/* --- 5. Mobile Navigation --- */
/*--------------------------------------------------------------*/
.mobile-menu-toggle {
    display: none;
}

.submenu-toggle {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    width: 50px;
    height: 100%;
    background-color: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
}
.submenu-toggle::before {
    content: '+';
}
.submenu-is-open > .submenu-toggle::before {
    content: '–';
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
        background: transparent;
        border: 1px solid white;
        border-radius: 3px;
        padding: 8px 10px;
        cursor: pointer;
    }
    .mobile-menu-toggle .icon-bar {
        display: block;
        width: 22px;
        height: 2px;
        background-color: white;
        margin: 4px 0;
    }

    .main-navigation {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--wp--preset--color--primary);
    }

    .main-navigation.is-open {
        display: block;
    }

    .main-navigation ul {
        flex-direction: column;
        gap: 0;
    }
    .main-navigation li a {
        padding: 15px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .main-navigation .sub-menu {
        display: none;
        width: 100%;
        padding-left: 20px;
        background-color: rgba(0,0,0,0.1);
    }
    .main-navigation .menu-item-has-children {
        position: relative;
    }
    .submenu-toggle {
        display: block;
    }

    .admin-bar .site-header {
        top: 46px;
    }
}


/* --- 6. Footer --- */
/*--------------------------------------------------------------*/
.site-footer {
    background-color: var(--wp--preset--color--foreground);
    color: var(--wp--preset--color--secondary);
    padding: 20px 0;
    text-align: center;
    font-size: 13px;
}

#back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: none;
    background-color: #333;
    color: #fff;
    width: 40px;
    height: 40px;
    text-align: center;
    line-height: 40px;
    font-size: 20px;
    border-radius: 2px;
    z-index: 100;
}

#back-to-top:hover {
    opacity: 0.8;
}

/* ... (xóa đoạn code cũ từ .entry-content) ... */

/*
 * ===================================================================
 * 7. Gutenberg Block Layout & Alignment (QUAN TRỌNG)
 * ===================================================================
*/

/*
 * Quy tắc này áp dụng chiều rộng MẶC ĐỊNH cho TẤT CẢ các block cấp cao nhất
 * bên trong vùng chứa .site-content-container của chúng ta.
*/
.site-content-container > * {
    max-width: var(--wp--style--global--content-size, 800px); /* Lấy giá trị từ theme.json, dự phòng 800px */
    margin-left: auto;
    margin-right: auto;
    padding-left: 15px;
    padding-right: 15px;
}

/*
 * GHI ĐÈ quy tắc trên cho các block được căn chỉnh "Wide".
*/
.site-content-container > .alignwide {
    max-width: var(--wp--style--global--wide-size, 1140px); /* Lấy giá trị từ theme.json, dự phòng 1140px */
}

/*
 * GHI ĐÈ quy tắc trên cho các block được căn chỉnh "Full".
 * Đây là "phép màu" cho phép block tràn ra toàn màn hình.
*/
.site-content-container > .alignfull {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
}


/*
 * ===================================================================
 * 8. Block Pattern Styles
 * ===================================================================
*/

/* --- Custom class for icon with text (Updated) --- */
.icon-with-text {
    display: flex;
    align-items: center;
    gap: 20px;
}

.icon-with-text i {
    font-size: 22px;
    color: #67cce0;
    line-height: 1;
}

.icon-with-text span,
.icon-with-text strong {
    font-size: 16px;
    font-weight: bold;
}

/* --- Custom Styles for Block Separator --- */
.wp-block-separator:not(.is-style-dots),
hr.wp-block-separator:not(.is-style-dots) {
    border: none !important;
    height: 1px;
    background-color: #cbd5e1;
    width: 100%;
    margin: 2em auto;
}


/* --- Flexbox Text Divider (Aggressive Override) --- */
div.flex-text-divider.wp-block-group > .wp-block-group__inner-container {
    display: flex !important;
    flex-wrap: nowrap !important; /* The most important rule */
    align-items: center !important;
    gap: 1.5em !important;
}

div.flex-text-divider.wp-block-group .wp-block-heading,
div.flex-text-divider.wp-block-group .wp-block-paragraph {
    flex-grow: 0 !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    margin: 0 !important;
}

div.flex-text-divider.wp-block-group .wp-block-separator {
    flex-grow: 1 !important;
    width: auto !important;
}

/*
 * ===================================================================
 * 9. Typography Helpers
 * ===================================================================
*/

/* Improve readability for justified text by enabling hyphenation */
.has-text-align-justify {
    hyphens: auto;
    -webkit-hyphens: auto; /* For Safari */
    -ms-hyphens: auto;    /* For IE/Edge */
}

/*
 * ===================================================================
 * 10. Interactive Image & Gallery Effects
 * ===================================================================
*/

/* --- Hover Zoom Effect --- */

/* Áp dụng cho các ảnh trong block Gallery và block Image */
.wp-block-gallery .wp-block-image,
.wp-block-image {
    overflow: hidden; /* Quan trọng: Giữ cho ảnh không tràn ra ngoài khi zoom */
    border-radius: 4px; /* Thêm bo góc nhẹ cho đẹp mắt */
}

.wp-block-gallery .wp-block-image img,
.wp-block-image img {
    /* THAY ĐỔI DÒNG DƯỚI ĐÂY */
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Khi di chuột vào, phóng to ảnh lên 5% */
.wp-block-gallery .wp-block-image a:hover img,
.wp-block-image a:hover img {
    transform: scale(1.1);
}

/* --- Fancybox Lightbox Styles --- */

/* Tùy chỉnh nhỏ để đảm bảo Fancybox hiển thị đẹp */
.fancybox__container {
    z-index: 99999 !important; /* Đảm bảo lightbox luôn nằm trên cùng */
}

/* Custom CSS for both normal and hover states of the "Log In" button */

/* Normal state */
body .lwa-bones .pixelbones input[type="submit"].button-primary {
    background-color: #e48500 !important;
    color: #ffffff !important;
    border-color: #e48500 !important;
}

/* Hover and Focus state - This is the corrected part */
body .lwa-bones .pixelbones input[type="submit"].button-primary:hover:not([disabled]),
body .lwa-bones .pixelbones input[type="submit"].button-primary:focus:not([disabled]) {
    background-color: #d17a00 !important;
    border-color: #d17a00 !important;
}