/* ============================================
   Modern OJS Theme - Custom Stylesheet
   For Bootstrap 3 Theme (Cerulean or similar)
   ============================================ */

/* Color Variables */
:root {
    --primary-blue: #1e3a5f;
    --primary-dark: #0d1b2a;
    --accent-orange: #e67e22;
    --accent-hover: #d35400;
    --text-light: #ffffff;
    --bg-subtle: #f8f9fa;
    --border-subtle: #e2e8f0;
    --bg-boxed: #f1f5f9;
    /* Background for outside the box */
}

/* ============================================
   BOXED LAYOUT
   ============================================ */
body {
    background-color: var(--bg-boxed) !important;
}

.pkp_structure_page {
    max-width: 1240px !important;
    margin: 0 auto !important;
    background: #ffffff !important;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.1);
    min-height: 100vh;
}

/* Ensure static elements align with the box */
.pkp_structure_head,
.pkp_structure_footer {
    max-width: 1240px !important;
    margin: 0 auto !important;
}

@media (max-width: 1240px) {

    .pkp_structure_page,
    .pkp_structure_head,
    .pkp_structure_footer {
        width: 100% !important;
        margin: 0 !important;
        box-shadow: none;
    }
}

/* ============================================
   LOGO - Left-aligned, Above Menu
   ============================================ */
.navbar-brand,
.navbar-brand-logo {
    display: block !important;
    float: left !important;
    text-align: left;
    padding: 10px 15px !important;
    margin: 0 !important;
    height: auto !important;
}

.navbar-brand img,
.navbar-brand-logo img {
    max-height: 70px;
    max-width: 100% !important;
    height: auto !important;
    display: block;
}

.navbar-header {
    float: none !important;
    width: 100%;
    padding: 10px 0;
    margin-bottom: 0;
}

/* Menu below logo */
.navbar-collapse {
    clear: both;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 10px;
}

.navbar-nav {
    float: none !important;
    margin: 0 !important;
}

.navbar-nav>li {
    float: left;
}

/* Search bar - inside navbar, right side */
.pull-md-right {
    float: right !important;
    margin: 0 !important;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.navbar-collapse {
    position: relative;
}

.navbar-form.navbar-left {
    float: none !important;
    display: inline-block;
    margin: 0 !important;
    padding: 0 !important;
}

.navbar-form .form-group {
    display: inline-block;
    margin: 0;
}

.navbar-form .form-control {
    display: inline-block;
    width: 160px;
    vertical-align: middle;
    border-radius: 20px 0 0 20px;
    border-right: none;
    height: 34px;
    background: #ffffff !important;
    color: #333333 !important;
}

.navbar-form .btn {
    border-radius: 0 20px 20px 0;
    margin-left: -5px;
    height: 34px;
    padding: 6px 15px;
    background: #e67e22 !important;
    color: #ffffff !important;
    border: none;
}

/* ============================================
   HEADER / NAVBAR
   ============================================ */
.navbar,
.navbar-default,
.navbar-inverse {
    background: linear-gradient(135deg, #1e3a5f, #0d1b2a) !important;
    border: none !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.navbar-default .navbar-nav>li>a,
.navbar-inverse .navbar-nav>li>a,
.navbar-brand,
.navbar-default .navbar-brand,
.navbar-inverse .navbar-brand {
    color: #ffffff !important;
}

.navbar-default .navbar-nav>li>a:hover,
.navbar-inverse .navbar-nav>li>a:hover,
.navbar-default .navbar-nav>li>a:focus,
.navbar-inverse .navbar-nav>li>a:focus {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
}

.navbar-default .navbar-nav>.active>a,
.navbar-inverse .navbar-nav>.active>a {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
}

/* Dropdown menus */
.navbar .dropdown-menu {
    background: #1e3a5f;
    border: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.navbar .dropdown-menu>li>a {
    color: #ffffff !important;
    padding: 10px 20px;
}

.navbar .dropdown-menu>li>a:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

/* ============================================
   BUTTONS - Orange Accent
   ============================================ */
.btn-primary,
.btn-default,
.btn-info {
    background: #e67e22 !important;
    border-color: #e67e22 !important;
    color: #ffffff !important;
    border-radius: 6px;
    font-weight: 600;
    padding: 10px 24px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary:hover,
.btn-default:hover,
.btn-info:hover,
.btn-primary:focus,
.btn-default:focus,
.btn-info:focus {
    background: #d35400 !important;
    border-color: #d35400 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(230, 126, 34, 0.4);
}

/* Galley/PDF buttons */
a.galley-link,
.galleys a,
.galley_link {
    background: linear-gradient(135deg, #e67e22, #d35400) !important;
    color: #ffffff !important;
    border-radius: 6px;
    padding: 8px 20px;
    display: inline-block;
    font-weight: 600;
    text-decoration: none !important;
    transition: all 0.3s ease;
    margin: 4px;
}

a.galley-link:hover,
.galleys a:hover,
.galley_link:hover {
    background: linear-gradient(135deg, #d35400, #c0392b) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(230, 126, 34, 0.4);
}

/* ============================================
   ARTICLE CARDS / LISTINGS
   ============================================ */
.article-summary,
.media,
.list-group-item,
.obj_article_summary {
    background: #ffffff;
    border-radius: 12px !important;
    padding: 24px !important;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.article-summary:hover,
.media:hover,
.list-group-item:hover,
.obj_article_summary:hover {
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
    transform: translateY(-4px);
    border-color: #1e3a5f !important;
}

/* Article titles */
.article-summary .title,
.media-heading,
.article-title a {
    color: #1e3a5f !important;
    font-weight: 700;
    font-size: 1.25em;
    line-height: 1.4;
}

.article-summary .title:hover,
.media-heading:hover,
.article-title a:hover {
    color: #e67e22 !important;
}

/* Author names */
.article-summary .authors,
.meta .authors {
    color: #64748b;
    font-size: 0.95em;
    margin-top: 8px;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1,
h2,
h3,
h4,
h5,
h6,
.page-header,
.panel-title {
    color: #1e3a5f !important;
    font-weight: 700;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

a {
    color: #e67e22;
    transition: color 0.2s ease;
}

a:hover {
    color: #d35400;
    text-decoration: none;
}

/* ============================================
   PANELS / SIDEBARS
   ============================================ */
.panel {
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.panel-heading {
    background: linear-gradient(135deg, #1e3a5f, #0d1b2a) !important;
    color: #ffffff !important;
    border: none !important;
    font-weight: 600;
    padding: 15px 20px;
}

.panel-heading a,
.panel-title a {
    color: #ffffff !important;
}

.panel-body {
    padding: 20px;
}

/* ============================================
   MAKE A SUBMISSION BLOCK
   ============================================ */
.pkp_block.block_make_submission {
    background: linear-gradient(135deg, #1e3a5f, #0d1b2a) !important;
    border-radius: 12px;
    padding: 25px !important;
    text-align: center;
    color: #ffffff !important;
    border: none !important;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    margin-bottom: 30px;
    transition: all 0.3s ease;
}

.pkp_block.block_make_submission:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.pkp_block.block_make_submission .title {
    display: none;
    /* Hide standard block title if it exists */
}

/* Style the text inside the block */
.pkp_block.block_make_submission h2,
.pkp_block.block_make_submission p,
.pkp_block.block_make_submission div {
    color: #ffffff !important;
    margin-bottom: 20px;
    font-size: 1.1em;
    font-weight: 400;
}

/* Enhancement for the actual link/button */
.pkp_block.block_make_submission a {
    background: #e67e22 !important;
    color: #ffffff !important;
    padding: 12px 30px !important;
    border-radius: 50px !important;
    text-transform: uppercase !important;
    font-weight: 700 !important;
    letter-spacing: 1px;
    display: inline-block !important;
    text-decoration: none !important;
    transition: all 0.3s ease;
    border: 2px solid #e67e22 !important;
    box-shadow: 0 4px 15px rgba(230, 126, 34, 0.3);
}

.pkp_block.block_make_submission a:hover {
    background: transparent !important;
    color: #e67e22 !important;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(230, 126, 34, 0.4);
}

.well {
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: none;
}

/* ============================================
   TEXT VISIBILITY FIXES - Blue Background Areas
   ============================================ */
/* Ensure ALL text in blue backgrounds is white */
.panel-heading *,
.panel-heading h1,
.panel-heading h2,
.panel-heading h3,
.panel-heading h4,
.panel-heading h5,
.panel-heading h6,
.panel-heading p,
.panel-heading span,
.panel-heading li,
.panel-heading label,
.panel-heading strong {
    color: #ffffff !important;
}

.navbar *,
.navbar h1,
.navbar h2,
.navbar h3,
.navbar h4,
.navbar h5,
.navbar h6,
.navbar p,
.navbar span,
.navbar li {
    color: #ffffff !important;
}

/* Article page specific fixes */
.article-header,
.article-full-header,
.page-header-article {
    background: linear-gradient(135deg, #1e3a5f, #0d1b2a) !important;
    padding: 30px !important;
    border-radius: 12px;
    margin-bottom: 30px;
}

.article-header *,
.article-full-header *,
.page-header-article *,
.article-header h1,
.article-header h2,
.article-header h3,
.article-full-header h1,
.article-full-header h2,
.article-full-header h3,
.article-header p,
.article-header span,
.article-header a,
.article-full-header p,
.article-full-header span,
.article-full-header a {
    color: #ffffff !important;
}

/* Article details section */
.article-details .panel-heading *,
.article-sidebar .panel-heading * {
    color: #ffffff !important;
}

/* Jumbotron / Hero areas */
.jumbotron {
    background: linear-gradient(135deg, #1e3a5f, #0d1b2a) !important;
}

.jumbotron *,
.jumbotron h1,
.jumbotron h2,
.jumbotron h3,
.jumbotron p,
.jumbotron a {
    color: #ffffff !important;
}

/* Alert boxes */
.alert-info {
    background: #1e3a5f !important;
    border-color: #1e3a5f !important;
    color: #ffffff !important;
}

.alert-info * {
    color: #ffffff !important;
}

/* ============================================
   FOOTER
   ============================================ */
footer,
.footer,
.pkp_structure_footer {
    background: #0d1b2a !important;
    color: #ffffff;
    padding: 40px 0;
}

footer a,
.footer a,
.pkp_structure_footer a {
    color: rgba(255, 255, 255, 0.8) !important;
}

footer a:hover,
.footer a:hover,
.pkp_structure_footer a:hover {
    color: #e67e22 !important;
}

/* Footer Image Responsiveness */
.pkp_brand_footer img,
.pkp_structure_footer img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 10px auto;
}

/* ============================================
   FORMS
   ============================================ */
.form-control {
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    padding: 12px 16px;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    border-color: #1e3a5f;
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

/* Search form */
.search-form .btn,
.navbar-form .btn {
    background: #e67e22 !important;
    border-color: #e67e22 !important;
    color: #ffffff !important;
    border-radius: 8px;
}

/* ============================================
   BREADCRUMBS
   ============================================ */
.breadcrumb {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px 20px;
}

.breadcrumb>li+li::before {
    color: #64748b;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination>li>a,
.pagination>li>span {
    color: #1e3a5f;
    border-radius: 8px !important;
    margin: 0 4px;
    border: 1px solid #e2e8f0;
}

.pagination>li>a:hover {
    background: #1e3a5f;
    color: #ffffff;
    border-color: #1e3a5f;
}

.pagination>.active>a,
.pagination>.active>span {
    background: #1e3a5f !important;
    border-color: #1e3a5f !important;
}

/* ============================================
   ISSUE COVERS / IMAGES
   ============================================ */
.cover img,
.issue-cover img {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 768px) {
    .navbar-nav {
        background: #0d1b2a;
    }

    .article-summary,
    .media {
        padding: 16px !important;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    /* Responsive Logo */
    .navbar-brand,
    .navbar-brand-logo {
        float: none !important;
        text-align: center;
        width: 100%;
        padding: 10px 0 !important;
    }

    .navbar-brand img,
    .navbar-brand-logo img {
        margin: 0 auto;
        max-height: 60px;
        /* Slightly smaller for mobile if needed */
    }

    /* Responsive search bar */
    .pull-md-right {
        position: static !important;
        float: none !important;
        width: 100%;
        margin: 5px 0 !important;
        /* Reduced vertical space */
        transform: none;
        text-align: center;
    }

    .navbar-form.navbar-left {
        width: 100%;
        display: block;
        padding: 5px 10px !important;
        /* Slightly more compact */
        margin: 0 !important;
    }

    .navbar-form .form-control {
        width: calc(100% - 100px) !important;
        background: #ffffff !important;
        color: #333333 !important;
        margin: 0 !important;
        height: 38px !important;
        /* Ensure consistent height */
    }

    .navbar-form .btn {
        width: 90px !important;
        margin: 0 !important;
        font-weight: 700;
        vertical-align: top;
        height: 38px !important;
    }

    /* Floating galley link fix in header on mobile */
    .pkp_structure_head .galley_link,
    .pkp_structure_head a.pdf,
    .pkp_structure_head .pdf_galley_link {
        position: relative !important;
        float: none !important;
        display: inline-block !important;
        margin: 10px auto !important;
        top: auto !important;
        right: auto !important;
        transform: none !important;
    }

    /* Small icons alignment in top bar */
    .navbar-text.navbar-right {
        float: none !important;
        text-align: center;
        width: 100%;
        display: block;
        margin: 10px 0;
    }

    /* Hide OJS branding in footer on mobile */
    .pkp_brand_footer,
    .pkp_structure_footer .pkp_brand_footer,
    .pkp_structure_footer img[src*="ojs_brand"] {
        display: none !important;
    }

    /* Increase space before authors section on mobile */
    .article-details .authors,
    .article-main .authors,
    .authors {
        margin-top: 30px !important;
        display: block;
    }
}

/* ============================================
   HIDE SIDEBAR ON ARTICLE VIEW PAGE
   ============================================ */
.article-view .sidebar,
.article-view aside,
.article-view .pkp_structure_sidebar,
body.article .sidebar,
body.article aside,
.page_article .sidebar,
.page_article aside,
.article-details aside {
    display: none !important;
}

/* Make article content full width when sidebar is hidden */
.article-view .main-content,
.article-view .pkp_structure_main,
body.article .main-content,
body.article .pkp_structure_main,
.page_article .main-content,
.page_article .pkp_structure_main,
.article-details .col-md-8,
.article-details .col-sm-8 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    margin-top: -4rem;
}

/* Mobile reset for article content margin */
@media (max-width: 768px) {

    .article-view .main-content,
    .article-view .pkp_structure_main,
    body.article .main-content,
    body.article .pkp_structure_main,
    .page_article .main-content,
    .page_article .pkp_structure_main,
    .article-details .col-md-8,
    .article-details .col-sm-8 {
        margin-top: 10px !important;
        /* Stop overlap with sidebar */
    }
}

/* ============================================
   RESPONSIVE TABLES - Article Content
   ============================================ */
.article-full-text table,
.article-details table,
.article-main table,
.article-abstract table,
.obj_article_details table {
    width: 100% !important;
    max-width: 100%;
    margin-bottom: 2rem;
    background-color: transparent;
    border-collapse: collapse;
    display: block;
    overflow-x: auto;
    /* Makes tables scrollable on mobile */
    border: 1px solid var(--border-subtle);
}

.article-full-text table th,
.article-full-text table td,
.article-details table th,
.article-details table td {
    padding: 12px 15px;
    vertical-align: top;
    border-top: 1px solid var(--border-subtle);
    text-align: left;
}

.article-full-text table thead th,
.article-details table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid var(--border-subtle);
    background-color: var(--primary-blue);
    color: #ffffff;
    font-weight: 600;
}

.article-full-text table tbody tr:nth-of-type(odd),
.article-details table tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.03);
    /* Striped rows */
}

.article-full-text table tbody tr:hover,
.article-details table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.07);
}

/* Ensure table captions are styled */
table caption {
    padding: 10px;
    font-weight: 700;
    color: var(--primary-blue);
    text-align: left;
    caption-side: top;
}

/* ============================================
   RESPONSIVE IMAGES - Article Content
   ============================================ */
.article-full-text img,
.article-details img,
.article-main img,
.article-abstract img,
.obj_article_details img,
.item.abstract img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 8px auto;
}

/* Figure and Table Captions */
figure {
    margin: 1.5rem 0;
    display: block;
    text-align: center;
}

figcaption,
.figure .label,
.caption,
table caption,
.table .label,
.article-full-text .label,
.article-details .label {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-size: 1.2rem !important;
    line-height: 1.5 !important;
    color: var(--primary-dark) !important;
    font-weight: 700 !important;
    margin-top: 5px !important;
    text-align: center !important;
    background: #f8f9fa !important;
    border-radius: 4px !important;
    caption-side: top !important;
}

/* Ensure figure and table numbers (Figure 1, Table 1, etc.) are bold and visible */
figcaption strong,
table caption strong,
.label strong {
    color: var(--primary-blue) !important;
    font-weight: 700 !important;
}

/* ============================================
   ARTICLE METADATA LAYOUT - 3 Columns
   Download buttons, Published, Keywords
   ============================================ */

/* Show sidebar as full width row instead of side column */
.article-sidebar {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    order: -1;
    margin-bottom: 30px;
}

/* Make list-group horizontal */
.article-sidebar .list-group {
    display: flex !important;
    flex-wrap: wrap;
    gap: 20px;
    background: transparent;
    border: none;
    align-items: stretch;
}

/* Download buttons column */
.article-sidebar .download {
    flex: 1;
    min-width: 200px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    flex-wrap: wrap;
}

/* Published date column */
.article-sidebar .list-group-item.date-published {
    flex: 0 0 auto;
    width: 180px;
    max-width: 180px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: none;
    border-left: 4px solid #1e3a5f;
}

/* Keywords column */
.article-sidebar .list-group-item.keywords {
    flex: 3;
    min-width: 350px;
    max-height: 9.4rem;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: none;
    border-left: 4px solid #e67e22;
    overflow: hidden;
}

/* Labels styling */
.list-group-item strong {
    display: block;
    color: #1e3a5f;
    margin-bottom: 5px;
    font-size: 0.9em;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 600;
}

/* Keywords value - same line-height as published */
.list-group-item.keywords .value {
    line-height: 1.5;
    font-size: 1em;
}

/* Responsive adjustment */
@media (max-width: 768px) {
    .article-sidebar .list-group {
        flex-direction: column !important;
        gap: 8px !important;
        /* Reduced from 15px */
    }

    .article-sidebar .download,
    .article-sidebar .list-group-item.date-published,
    .article-sidebar .list-group-item.keywords {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        flex: 1 1 auto !important;
    }

    /* Remove keyword height limit on mobile to see all content */
    .article-sidebar .list-group-item.keywords {
        max-height: none !important;
        overflow: visible !important;
        margin-bottom: 8px !important;
        /* Reduced from 20px */
    }

    .article-sidebar .list-group-item.date-published {
        margin-bottom: 8px !important;
        /* Reduced from 20px */
    }

    /* Further increase space before authors */
    .article-details .authors,
    .article-main .authors,
    .authors {
        margin-top: 50px !important;
        padding-top: 20px !important;
        border-top: 1px solid #eee;
    }
}