/* =========================================================
   ITforSociety — OJS visual polish v16
   FINAL LAYOUT FIX:
   - Keep main content/sidebar at 80/20
   - Move OJS's built-in vertical divider to the TRUE 80% boundary
   - Keep long article titles inside the content area
   - Preserve header, sidebar buttons, and account-page fixes
   ========================================================= */

/* ---------- HOMEPAGE ---------- */
.pkp_page_index .current_issue {
    display: none !important;
}

.pkp_page_index .additional_content {
    margin-top: 0 !important;
}

/* ---------- HEADER / LOGO ---------- */
.pkp_site_name {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.pkp_site_name .is_img {
    display: inline-block !important;
}

.pkp_site_name .is_img img {
    max-height: 80px !important;
    width: auto !important;
    max-width: 100% !important;
}

/* ---------- REGISTER / LOGIN / PASSWORD PAGES ---------- */
.pkp_page_user.pkp_op_register .pkp_structure_sidebar,
.pkp_page_user.pkp_op_login .pkp_structure_sidebar,
.pkp_page_user.pkp_op_lostPassword .pkp_structure_sidebar,
.pkp_page_user.pkp_op_resetPassword .pkp_structure_sidebar {
    display: none !important;
}

.pkp_page_user.pkp_op_register .pkp_structure_main,
.pkp_page_user.pkp_op_login .pkp_structure_main,
.pkp_page_user.pkp_op_lostPassword .pkp_structure_main,
.pkp_page_user.pkp_op_resetPassword .pkp_structure_main {
    float: none !important;
    width: auto !important;
    max-width: 1080px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 32px !important;
    padding-right: 32px !important;
    box-sizing: border-box !important;
}

.pkp_page_user.pkp_op_register form,
.pkp_page_user.pkp_op_login form,
.pkp_page_user.pkp_op_lostPassword form,
.pkp_page_user.pkp_op_resetPassword form {
    max-width: 820px !important;
}

/* ---------- DESKTOP MAIN CONTENT + SIDEBAR ---------- */
@media (min-width: 992px) {

    /* Actual column widths */
    .pkp_structure_main {
        width: 80% !important;
        box-sizing: border-box !important;
        min-width: 0 !important;
    }

    .pkp_structure_sidebar {
        width: 20% !important;
        box-sizing: border-box !important;
        padding-left: 20px !important;
        padding-right: 14px !important;
    }

    /* IMPORTANT:
       OJS draws the vertical divider with .pkp_structure_main::after.
       Its default position is based on the original fixed 300px sidebar.
       Because we changed the columns to 80/20, the divider must also move
       to exactly 80% of the content container. */
    .pkp_structure_main::after {
        left: 80% !important;
        right: auto !important;
    }
}

/* ---------- ARTICLE TITLE SAFETY ---------- */
.pkp_structure_main .obj_article_summary {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.pkp_structure_main .obj_article_summary > .title,
.pkp_structure_main .obj_article_summary > .title a {
    max-width: 100% !important;
    box-sizing: border-box !important;
    white-space: normal !important;
    overflow-wrap: break-word !important;
    word-break: normal !important;
}

.pkp_structure_main .obj_article_summary > .title a {
    display: block !important;
}

/* ---------- CUSTOM SIDEBAR BLOCKS ---------- */
#customblock-submission,
#customblock-template,
#customblock-statistic {
    min-height: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 14px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

#customblock-submission img,
#customblock-template img {
    display: none !important;
}

#customblock-submission p,
#customblock-template p,
#customblock-statistic p,
#customblock-submission div,
#customblock-template div,
#customblock-statistic div {
    min-height: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 5px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.pkp_structure_sidebar .pkp_block .title,
.pkp_structure_sidebar .pkp_block h2,
.pkp_structure_sidebar .pkp_block h3,
.pkp_structure_sidebar .pkp_block h4 {
    margin-top: 0 !important;
    margin-bottom: 7px !important;
    padding-top: 0 !important;
    line-height: 1.25 !important;
}

.pkp_structure_sidebar .pkp_block {
    margin-top: 0 !important;
    margin-bottom: 16px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Compact sidebar buttons */
#customblock-submission a,
#customblock-template a {
    display: inline-block !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 9px 12px !important;
    border: 1px solid #0b6f9e !important;
    border-radius: 4px !important;
    background: #0b6f9e !important;
    color: #ffffff !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    font-size: 0 !important;
    margin: 0 !important;
    white-space: normal !important;
}

#customblock-submission a::after {
    content: "Submit Manuscript";
    font-size: 14px !important;
}

#customblock-template a::after {
    content: "Download Article Template";
    font-size: 14px !important;
}

#customblock-submission a:hover,
#customblock-template a:hover {
    opacity: 0.9 !important;
}

.pkp_structure_sidebar p:empty,
.pkp_structure_sidebar div:empty {
    display: none !important;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
    .pkp_site_name .is_img img {
        max-height: 68px !important;
    }

    .pkp_page_user.pkp_op_register .pkp_structure_main,
    .pkp_page_user.pkp_op_login .pkp_structure_main,
    .pkp_page_user.pkp_op_lostPassword .pkp_structure_main,
    .pkp_page_user.pkp_op_resetPassword .pkp_structure_main {
        padding-left: 18px !important;
        padding-right: 18px !important;
    }
}

/* ---------- ISSUE PAGE SPACING ---------- */
/* Reduce the excessive gap between the issue metadata
   (title / volume / published date) and the Articles section.
   Keep the section divider and left/right spacing intact. */

.obj_issue_toc .heading {
    min-height: 0 !important;
    height: auto !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.obj_issue_toc .sections {
    margin-top: 0 !important;
}

@media (min-width: 768px) {
    .obj_issue_toc .section {
        margin-top: 10px !important;
        margin-bottom: 18px !important;
        padding-top: 16px !important;
        padding-bottom: 18px !important;
    }

    /* Keep the horizontal line aligned with the section heading */
    .obj_issue_toc .section::before {
        top: 31px !important;
    }

    /* When a section has a heading (e.g. "Articles"),
       keep the article list close to that heading. */
    .obj_issue_toc .section > h2 + .articles,
    .obj_issue_toc .section > h3 + .articles {
        margin-top: 0 !important;
    }
}

/* ---------- STATISTIC BUTTON ---------- */
/* Make the journal statistics link match the other sidebar action buttons. */
#customblock-statistic a {
    display: inline-block !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 9px 12px !important;
    border: 1px solid #0b6f9e !important;
    border-radius: 4px !important;
    background: #0b6f9e !important;
    color: #ffffff !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    font-size: 14px !important;
    margin: 0 !important;
    white-space: normal !important;
}

#customblock-statistic a:hover {
    opacity: 0.9 !important;
}

/* ---------- SIDEBAR BUTTON SPACING FIX (v12) ---------- */
/* Force the three action blocks to use equal, compact spacing. */
#customblock-submission,
#customblock-template,
#customblock-statistic {
    margin-top: 0 !important;
    margin-bottom: 12px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Remove any hidden/legacy editor spacing inside the blocks. */
#customblock-submission .content,
#customblock-template .content,
#customblock-statistic .content {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

#customblock-submission p,
#customblock-template p,
#customblock-statistic p {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    min-height: 0 !important;
}

/* Old rich-text editors sometimes leave blank <br> lines. */
#customblock-submission br,
#customblock-template br,
#customblock-statistic br {
    display: none !important;
}

/* Specifically prevent an extra gap before Statistics. */
#customblock-template + #customblock-statistic {
    margin-top: 0 !important;
}

/* ---------- FINAL STATISTICS GAP FIX (v13) ---------- */
/* OJS leaves extra vertical space before the statistic custom block.
   Pull only this block upward on desktop so all three action buttons
   have visually equal spacing. */
@media (min-width: 769px) {
    #customblock-statistic {
        margin-top: -36px !important;
    }
}

/* Do not use the negative offset on phones/tablets. */
@media (max-width: 768px) {
    #customblock-statistic {
        margin-top: 0 !important;
    }
}

/* ---------- SIDEBAR VISUAL BALANCE FIX (v14) ---------- */
/* Move only the middle button downward visually so the gaps
   above and below it appear equal. This does not change the
   actual sidebar flow or divider position. */
@media (min-width: 769px) {
    #customblock-template {
        transform: translateY(15px) !important;
    }
}

/* Keep normal positioning on small screens. */
@media (max-width: 768px) {
    #customblock-template {
        transform: none !important;
    }
}

/* ---------- SMALLER SIDEBAR BUTTON TEXT (v15) ---------- */
/* Make all three action buttons visually lighter and more compact. */
#customblock-submission a::after,
#customblock-template a::after {
    font-size: 13px !important;
    line-height: 1.15 !important;
}

#customblock-statistic a {
    font-size: 13px !important;
    line-height: 1.15 !important;
}

/* Slightly reduce padding so the buttons match the smaller text. */
#customblock-submission a,
#customblock-template a,
#customblock-statistic a {
    padding: 8px 11px !important;
}

/* ---------- UNIFORM SIDEBAR BUTTONS (v16) ---------- */
/* Make all three sidebar action buttons visually identical. */
#customblock-submission a,
#customblock-template a,
#customblock-statistic a {
    width: 180px !important;
    min-height: 46px !important;
    padding: 8px 10px !important;
    box-sizing: border-box !important;
    text-align: center !important;
    font-family: inherit !important;
    font-weight: 600 !important;
    line-height: 1.15 !important;
    vertical-align: middle !important;
}

/* Submission/template use pseudo-text in the existing CSS. */
#customblock-submission a::after,
#customblock-template a::after {
    font-size: 12px !important;
    font-weight: 600 !important;
    line-height: 1.15 !important;
}

/* Statistics uses real link text. */
#customblock-statistic a {
    font-size: 12px !important;
    font-weight: 600 !important;
    line-height: 1.15 !important;
}

/* Center all three buttons within the sidebar column. */
#customblock-submission,
#customblock-template,
#customblock-statistic {
    text-align: center !important;
}
