/* ============================================================
   CANON LAW (GIÁO LUẬT) PREMIUM STYLING
   ============================================================ */

:root {
    --gl-primary: #003366;
    --gl-secondary: #f5f5f5;
    --gl-text: #2c3e50;
    --gl-accent: #fff9c4; /* Yellow highlight */
}

/* 1. Layout & Typography */
.gl-single-container, .gl-archive-container {
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
}

.gl-content-body {
    font-family: 'Crimson Pro', 'Lora', serif;
    font-size: 19px;
    line-height: 1.8;
    color: var(--gl-text);
}
.gl-content-body p {
    margin-bottom: 19px;
}

.gl-main-title {
    font-family: sans-serif;
    color: var(--gl-primary);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 30px;
    text-align: center;
}

/* 2. Breadcrumbs & Badges */
.gl-breadcrumbs {
    font-size: 14px;
    color: #888;
    margin-bottom: 20px;
}
.gl-breadcrumbs a { color: var(--gl-primary); text-decoration: none; }

.gl-canon-block {
    margin-bottom: 19px;
    padding: 10px 0;
    transition: background-color 0.5s ease;
    text-align: left;
    scroll-margin-top: 90px; /* Cách mép trên một khoảng an toàn bằng chiều cao header */
}

.gl-canon-badge {
    display: block;
    width: fit-content;
    background-color: var(--bri-primary, #14599d);
    color: #ffffff !important;
    padding: 6px 20px;
    border-radius: 100px; /* Pill shape */
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 20px 0;
    box-shadow: 0 4px 12px rgba(20, 89, 157, 0.15);
    font-family: inherit;
}
.gl-canon-badge a {
    color: #ffffff !important;
    text-decoration: none;
}

.gl-point {
    display: block;
    padding-left: 20px;
    margin-top: 4px;
}
@media (max-width: 768px) {
    .gl-point {
        padding-left: 10px;
    }
}

/* Bilingual Layout */
.gl-bilingual-row {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    align-items: flex-start;
}

.gl-col-vi, .gl-col-en {
    flex: 1;
    min-width: 300px;
}

.gl-col-en {
    border-left: 1px solid #eee;
    padding-left: 40px;
    color: #555;
    font-size: 0.95em;
    font-style: italic;
}

/* Display Modes (Tabs) */
.gl-display-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 10px;
}

.gl-tab-btn {
    padding: 8px 20px;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.gl-tab-btn:hover {
    border-color: var(--bri-primary, #14599d);
    color: var(--bri-primary, #14599d);
}

.gl-tab-btn.active {
    background: var(--bri-primary, #14599d);
    color: #fff;
    border-color: var(--bri-primary, #14599d);
}

/* Visibility Logic based on Body/Article class */
.view-vi .gl-col-en { display: none; }
.view-en .gl-col-vi { display: none; }

.view-en .gl-col-en {
    border-left: none;
    padding-left: 0;
    font-style: normal;
    color: var(--gl-primary);
    font-size: 1.1rem;
}

.view-both .gl-bilingual-row {
    flex-direction: row;
}

@media (max-width: 991px) {
    .view-both .gl-bilingual-row {
        flex-direction: column;
    }
}

.gl-canon-badge.en {
    background-color: #666; /* Gray for English badge */
    box-shadow: none;
}

.gl-en-content {
    line-height: 1.7;
}

@media (max-width: 991px) {
    .gl-bilingual-row {
        flex-direction: column;
        gap: 20px;
    }
    .gl-col-en {
        border-left: none;
        border-top: 2px dashed #eee;
        padding-left: 0;
        padding-top: 20px;
    }
}

.gl-highlight {
    background-color: var(--gl-accent) !important;
}

/* 3. Navigation Buttons */
.gl-navigation {
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}
.gl-nav-links {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}
.gl-nav-links a {
    flex: 1;
    padding: 20px;
    background: var(--gl-secondary);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}
.gl-nav-links a:hover { background: #e0e0e0; transform: translateY(-3px); }
.gl-nav-label { font-size: 12px; color: #888; text-transform: uppercase; margin-bottom: 5px; }
.gl-nav-title { font-weight: 600; color: var(--gl-primary); }
.gl-nav-next { text-align: right; }

/* 4. Archive Header Hero */
.gl-header-hero {
    text-align: center;
    margin-bottom: 50px;
}
.gl-hero-title {
    font-family: 'Lora', serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gl-primary);
    margin-bottom: 30px;
}

.gl-search-wrapper {
    max-width: 600px;
    margin: 0 auto 20px;
}
.gl-search-form {
    display: flex;
    background: #fff;
    padding: 0;
    border-radius: 100px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}
.gl-search-form:focus-within {
    outline: 2px solid var(--bri-primary, #14599d);
    outline-offset: 2px;
}
.gl-search-input {
    flex: 1;
    border: none;
    padding: 12px 24px;
    border-radius: 100px 0 0 100px;
    font-size: 1rem;
    outline: none;
    color: var(--gl-text);
}
.gl-search-submit {
    background: transparent;
    color: #64748b;
    border: none;
    width: 60px;
    border-radius: 0 100px 100px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}
.gl-search-submit:hover {
    color: var(--bri-primary, #14599d);
}

/* 5. Floating Action Buttons (FABs) */
.gl-fab-container {
    position: fixed;
    bottom: 60px;
    right: calc(50% - 450px - 80px);
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 1000;
}

.gl-fab-btn {
    width: 55px;
    height: 55px;
    background: var(--gl-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    box-shadow: 0 5px 15px rgba(0,51,102,0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}
.gl-fab-btn:hover {
    transform: scale(1.1);
    background: #004080;
}

/* 6. Responsive < 1000px */
@media (max-width: 1000px) {
    .gl-single-container, .gl-archive-container {
        max-width: 100%;
        margin: 20px auto;
    }
    .gl-fab-container {
        right: 20px;
        bottom: 120px;
    }
    .gl-nav-links { flex-direction: column; }
}


/* =========================================
   HIERARCHICAL ACCORDION TOC DRAWER
========================================= */
.gl-toc-trigger-wrap {
    margin-top: 20px;
}
.gl-toc-btn {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    color: #1a1a1a;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 100px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.gl-toc-btn:hover {
    border-color: var(--bri-primary, #14599d);
    color: var(--bri-primary, #14599d);
    background-color: #f0f7ff;
}

/* Drawer Container */
.gl-toc-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 500px;
    height: 100vh;
    z-index: 99999;
    background: #ffffff;
    box-shadow: -5px 0 25px rgba(0,0,0,0.1);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}
.gl-toc-drawer.active {
    right: 0;
}
.gl-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.gl-drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}
.gl-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}
.gl-drawer-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--bri-text-main, #1a1a1a);
}
.gl-drawer-close {
    background: transparent;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #64748b;
    line-height: 1;
}
.gl-drawer-close:hover {
    color: #dc2626;
}
.gl-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

/* Drawer Tree Logic */
.gl-tree-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}
.gl-submenu-list {
    list-style: none;
    padding-left: 20px;
    margin: 0;
    border-left: 1px dashed #cbd5e1;
    margin-left: 10px;
    margin-top: 8px;
}
.gl-submenu-wrap {
    display: none;
}
li.has-children.expanded > .gl-submenu-wrap {
    display: block;
}
.gl-tree-item {
    margin-bottom: 5px;
}
.gl-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0;
    transition: background 0.2s;
}
.gl-item-header:hover {
    background: #f0f7ff;
}
.gl-item-link {
    flex: 1;
    padding: 12px 16px;
    color: var(--bri-text-main, #1a1a1a);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.4;
}
.gl-tree-item.is-leaf > .gl-item-link {
    display: block;
    padding: 10px 16px;
    color: #475569;
    text-decoration: none;
    font-size: 0.9rem;
    border-left: 2px solid transparent;
}
.gl-tree-item.is-leaf > .gl-item-link:hover {
    color: var(--bri-primary, #14599d);
    border-left-color: var(--bri-primary, #14599d);
    background: #f8fafc;
}
.gl-toggle-btn {
    background: transparent;
    border: none;
    padding: 12px;
    cursor: pointer;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}
li.has-children.expanded > .gl-item-header .gl-toggle-btn {
    transform: rotate(180deg);
}

/* Levels Indentation & Typography */
.gl-tree-list.level-1 > li > .gl-item-header > .gl-item-link {
    text-transform: uppercase;
    color: var(--bri-primary, #14599d);
    font-weight: 700;
}

/* =========================================
   FAB MODALS FOR ARCHIVE
========================================= */
.gl-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 51, 102, 0.6);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
}

.gl-modal.active {
    display: flex;
}

.gl-modal-content {
    background: #fff;
    padding: 40px;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: glModalIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes glModalIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.gl-modal-close {
    position: absolute;
    right: 25px;
    top: 25px;
    font-size: 32px;
    color: #999;
    cursor: pointer;
    transition: color 0.3s;
}

.gl-modal-close:hover {
    color: #003366;
}

.gl-modal-title {
    color: #003366;
    margin-top: 0;
    margin-bottom: 25px;
    font-family: 'Lora', serif;
    font-weight: 700;
    text-align: left;
}

.gl-search-form-modal {
    display: flex;
    gap: 10px;
}

.gl-search-input-modal {
    flex-grow: 1;
    padding: 15px 25px;
    border: 2px solid #eef2f6;
    border-radius: 12px;
    font-size: 1.1rem;
    outline: none;
    transition: border-color 0.3s;
}

.gl-search-input-modal:focus {
    border-color: #003366;
}

.gl-search-submit-modal {
    background: #003366;
    color: #fff;
    border: none;
    padding: 0 30px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.gl-search-submit-modal:hover {
    background: #002244;
}

/* 7. Additional Modal Styles for TOC & Jump */
.gl-modal-body-scroll {
    max-height: 70vh;
    overflow-y: auto;
    padding: 10px 5px;
}
.gl-modal-body-scroll::-webkit-scrollbar { width: 6px; }
.gl-modal-body-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

.gl-jump-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
    gap: 12px;
    margin-top: 15px;
}
.gl-jump-item {
    background: #f1f5f9;
    color: #003366;
    padding: 12px 5px;
    text-align: center;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    border: 1px solid #e2e8f0;
    font-size: 0.9rem;
}
.gl-jump-item:hover {
    background: #003366;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,51,102,0.2);
}

.gl-modal-tree ul { list-style: none; padding-left: 15px; border-left: 1px solid #eef2f6; }
.gl-modal-tree > ul { padding-left: 0; border-left: none; }
.gl-modal-tree li { margin: 10px 0; }
.gl-modal-tree .gl-tree-link {
    color: #2c3e50;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
    display: block;
    padding: 4px 0;
}
.gl-modal-tree .gl-tree-link:hover { color: #003366; text-decoration: underline; }
.gl-modal-tree .gl-tree-folder { 
    font-weight: 700; 
    color: #003366; 
    display: block; 
    margin-top: 15px; 
    font-size: 1.1rem;
    border-bottom: 2px solid #eef2f6;
    padding-bottom: 5px;
    text-align: left;
}
.gl-modal-tree .gl-tree-link.active {
    color: #003366;
    font-weight: 700;
}

/* Sub-FAB Styles */
.gl-fab-btn.gl-fab-sub {
    width: 48px;
    height: 48px;
    background: #fff;
    color: #003366;
    border: 1px solid #003366;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.gl-fab-btn.gl-fab-sub svg { stroke: #003366; }
.gl-fab-btn.gl-fab-sub:hover { background: #003366; }
.gl-fab-btn.gl-fab-sub:hover svg { stroke: #fff; }
