/* css/center_content_style.css */

/* Basic Reset (if not already in a global stylesheet) */
/* * { margin: 0; padding: 0; box-sizing: border-box; } */

/* CSS Variables for Dynamic Styling (Defaults, JS will override for specific sections) */
:root {
    /* Page Header Section (PM_1) */
    --page-header-bg-color: #e9ecef;
    --page-header-bg-image: none;
    --page-header-min-height: 200px; 
    --page-header-actual-height: auto; /* Set by JS from headerMediaHeight */
    --page-header-image-object-position: center center; 
    --page-header-text-color: #333;
    /* Header Button variables (defaults, JS will override) */
    --header-button-bg-color: #007bff;
    --header-button-text-color: #FFFFFF;
    --header-button-hover-bg-color: #0056b3;
    --header-button-hover-text-color: #FFFFFF;
    --header-button-border-radius: 5px;
    --header-button-padding: 0.6em 1.2em; 

    /* Center Text Content Section (PM_2) */
    --center-content-bg-color: #ffffff;
    --center-content-css-gradient: none;
    --center-content-height: auto;
    --center-content-width: auto;
    --center-content-padding-top: 20px;    
    --center-content-padding-bottom: 20px; 
    --center-content-padding-left: 20px;   
    --center-content-padding-right: 20px;  
    /* column-gap is applied directly by JS to the contentHolder */

    /* Footnote Section (PM_3) */
    --footnote-bg-color: #f9f9f9;
    --footnote-content-area-bg-color: #FFFFFF; 
    --footnote-font-family: Arial, sans-serif;
    --footnote-font-size: 14px;
    --footnote-font-color: #333333; 
    --footnote-section-height: 400px;
    --footnote-section-width-percent: 100%;
    /* Border for footnote-content-area will be set by JS */
    --footnote-item-spacing: 12px; /* Default spacing between items, JS can override */
    --footnote-item-corner-radius: 4px; /* Default corner radius for items, JS can override */
    /* --footnote-item-hover-bg is set by JS on each item wrapper */


    /* Glossary Popup (PM_4) */
    --glossary-popup-bg-color: #fefefe;
    --glossary-popup-bg-image: none;
    --glossary-popup-css-gradient: none;
    --glossary-term-text-color: #333333;    
    --glossary-desc-text-color: #555555;    
    --glossary-meta-text-color: #777777; 
    /* --glossary-term-hover-bg is set by JS on each glossary-link span */
}


/* Overall container for the dynamic content sections */
.center-content-section {
    /* max-width: 1100px; */
    /* margin: 20px auto; */
}

/* 1. Page Header Section */
.page-header-section {
    position: relative; 
    background-color: var(--page-header-bg-color); 
    background-image: var(--page-header-bg-image);
    background-size: cover;
    background-position: var(--page-header-image-object-position); 
    min-height: var(--page-header-min-height); 
    height: var(--page-header-actual-height); 
    display: flex;
    /* align-items is set by JS for vertical alignment of text overlay */
    justify-content: center; 
    text-align: center;
    color: var(--page-header-text-color);
    padding: 20px; 
    overflow: hidden; 
    margin-bottom: 0; 
}

.page-header-section .background-video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    z-index: 0; 
    transform: translateX(-50%) translateY(-50%);
    background-size: cover;
    opacity: 0.7; 
    object-fit: cover; 
}
.page-header-section img.background-image-element { 
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; 
    object-position: var(--page-header-image-object-position);
    z-index: 0;
}


.page-header-section .text-overlay {
    position: relative; 
    z-index: 1;
    display: flex; 
    flex-direction: column;
    align-items: center; 
    justify-content: center; 
}
.page-header-section .text-overlay h1,
.page-header-section .text-overlay h2,
.page-header-section .text-overlay h3,
.page-header-section .text-overlay h4,
.page-header-section .text-overlay p {
    margin: 0; 
    margin-bottom: 15px; 
}
.page-header-section .text-overlay *:last-child {
    margin-bottom: 0; 
}


/* Page Header Button */
.page-header-button {
    display: inline-block;
    padding: var(--header-button-padding);
    background-color: var(--header-button-bg-color);
    color: var(--header-button-text-color);
    border-radius: var(--header-button-border-radius);
    text-decoration: none;
    font-weight: bold;
    margin-top: 20px; 
    transition: background-color 0.3s ease, color 0.3s ease;
    border: none; 
    cursor: pointer;
    font-size: 1em; 
}
.page-header-button:hover {
    background-color: var(--header-button-hover-bg-color);
    color: var(--header-button-hover-text-color);
}


/* 2. Center Text Content Section */
.center-text-section {
    background-color: var(--center-content-bg-color); 
    background-image: var(--center-content-css-gradient); 
    padding-top: var(--center-content-padding-top);    
    padding-bottom: var(--center-content-padding-bottom); 
    padding-left: var(--center-content-padding-left);   
    padding-right: var(--center-content-padding-right);  
    margin-top: 0; 
    margin-bottom: 0; 
    height: var(--center-content-height);
    width: var(--center-content-width);
    margin-left: auto; 
    margin-right: auto; 
    overflow: auto; 
    box-sizing: border-box;
}

.text-content-column-flow { 
    line-height: 1.7;
    word-wrap: break-word; 
    overflow-wrap: break-word;
    /* column-count and column-gap will be set by JS inline */
    /* column-rule: 1px solid #eee; */
}
.text-content-column-flow p { margin-bottom: 1em; }
.text-content-column-flow img { max-width: 100%; height: auto; margin: 10px 0; display: block; } 
.text-content-column-flow video,
.text-content-column-flow iframe { max-width: 100%; margin: 10px 0; display: block; }

.text-content-column-flow a:not(.glossary-term-link) { 
    color: var(--current-mega-menu-link-color, #007bff); 
    text-decoration: underline;
}
.text-content-column-flow a:not(.glossary-term-link):hover {
    color: var(--current-mega-menu-link-hover-color, #0056b3);
}
.text-content-column-flow strong, .text-content-column-flow b { font-weight: bold; }
.text-content-column-flow em, .text-content-column-flow i { font-style: italic; }
.text-content-column-flow u { text-decoration: underline; }

/* Glossary Term Styling (for clickable terms) */
span.glossary-link { 
    cursor: pointer;
    color: #0056b3; 
    text-decoration: underline;
    text-decoration-style: dotted;
    font-weight: bold; 
    padding: 1px 3px; 
    border-radius: 3px; 
    transition: background-color 0.2s ease, color 0.2s ease;
}
span.glossary-link:hover {
    background-color: var(--glossary-term-hover-bg, rgba(233, 245, 255, 0.7)); 
}

/* Glossary Popup Modal */
.glossary-popup-modal {
    display: none; 
    position: fixed;
    z-index: 2000; 
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6); 
    align-items: center; 
    justify-content: center; 
}
.glossary-popup-modal.active {
    display: flex; 
}

.glossary-popup-content {
    background-color: var(--glossary-popup-bg-color);
    background-image: var(--glossary-popup-bg-image, none);
    margin: auto; 
    padding: 25px;
    border: 1px solid #777;
    width: 90%;
    max-width: 650px;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
    position: relative;
    max-height: 85vh; 
}
.glossary-popup-content.with-scrollbar {
    overflow-y: auto;
}

.glossary-popup-close-btn {
    color: #777;
    position: absolute; 
    top: 10px;
    right: 15px;
    font-size: 30px;
    font-weight: bold;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
}
.glossary-popup-close-btn:hover,
.glossary-popup-close-btn:focus {
    color: #000;
    text-decoration: none;
}

.glossary-popup-content h3#glossaryPopupTerm { 
    margin-top: 0;
    color: var(--glossary-term-text-color); 
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
    margin-bottom: 15px;
    font-size: 1.4em;
}
.glossary-popup-content #glossaryPopupDescription {
    line-height: 1.6;
    margin-bottom: 20px;
    font-size: 0.95em;
    color: var(--glossary-desc-text-color); 
}
.glossary-popup-content #glossaryPopupDescription p {
    margin-bottom: 0.8em;
}
.glossary-popup-content #glossaryPopupMeta {
    font-size: 0.8em;
    color: var(--glossary-meta-text-color); 
    border-top: 1px dashed #eee;
    padding-top: 15px;
    margin-top: 15px;
    display: grid; 
    grid-template-columns: auto 1fr; 
    gap: 5px 10px;
}
.glossary-popup-content #glossaryPopupMeta p {
    margin-bottom: 3px;
    display: contents; 
    color: var(--glossary-meta-text-color); 
}
.glossary-popup-content #glossaryPopupMeta strong {
    grid-column: 1;
}
.glossary-popup-content #glossaryPopupMeta span {
    grid-column: 2;
}


/* 3. Footnote – Cross-Reference Section */
.footnote-crossref-section {
    margin-top: 0; 
    padding: 20px;
    background-color: var(--footnote-bg-color); 
    font-family: var(--footnote-font-family);
    font-size: var(--footnote-font-size);
    color: var(--footnote-font-color);
    border-top: 1px solid #ddd; 
}
.footnote-crossref-section h3 { 
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.4em;
    color: inherit; 
}
.footnote-content-area {
    height: var(--footnote-section-height); 
    width: var(--footnote-section-width-percent); 
    overflow-y: auto;
    padding: 15px;
    /* Background, border, radius set by JS inline */
}
.footnote-item-wrapper { 
    display: block; 
    text-decoration: none; 
    color: inherit; 
    transition: background-color 0.2s ease;
    /* border-radius will be set by JS */
    /* margin-bottom will be set by JS */
    overflow: hidden; /* **FIX for rounded corners with inner div bg** */
}
.footnote-item-wrapper:last-child {
    margin-bottom: 0 !important; 
}
.footnote-item-wrapper:hover {
    background-color: var(--footnote-item-hover-bg, transparent); 
}
/* If hover is on wrapper, make inner item's specific bg transparent */
.footnote-item-wrapper:hover .footnote-item {
    background-color: transparent !important; /* This might be too aggressive if hover is transparent */
}


.footnote-item {
    padding: 10px; 
    border-bottom: 1px dotted #eee; 
    /* Background and text color will be set by JS inline on this element */
    /* Ensure it doesn't obscure wrapper's hover if wrapper has hover bg */
    /* background-color: inherit; /* This might be needed if wrapper has hover */
}
.footnote-item:last-child {
    border-bottom: none;
}
.footnote-item .ref-number {
    font-weight: bold;
    margin-right: 8px;
}
.footnote-item .ref-description {
    display: inline; 
}
.footnote-item .ref-sources {
    display: block; 
    font-style: italic;
    font-size: 0.9em;
    margin-top: 4px;
    padding-left: 20px; 
}
.footnote-item sup, .footnote-item sub {
    line-height: 0; 
}

/* Responsive for Center Content */
@media (max-width: 768px) {
    .text-content-column-flow { 
    column-count: 1 !important; /* Ensure this overrides inline style */
        column-gap: 0 !important; /* Also ensure gap is reset */
    }
    /* ... other mobile styles ... */
    .page-header-section {
        padding: 15px;
        min-height: 150px; 
    }
    .page-header-section .text-overlay h1,
    .page-header-section .text-overlay h2 {
        font-size: 1.8em; 
    }
    .footnote-crossref-section {
        margin-top: 0; 
        padding: 15px;
    }
    .footnote-content-area {
        height: var(--footnote-section-height, 300px); 
    }
}




