/* --- Global Resets & Full Width --- */
html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
    /* Prevent horizontal scroll */
}

.pkp_structure_page {
    width: 100%;
    margin: 0;
    padding: 0;
}

/* --- Custom Header Styles (Green Theme) --- */
.pkp_structure_head {
    background-color: #03a9f4;
    /* Light Blue */
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    background: radial-gradient(circle at top center, #4fc3f7 0%, #0288d1 70%);
    /* Sky to Deep Light Blue */
}

/* Force wrapper to lose all container constraints */
.pkp_head_wrapper {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}


.pkp_site_name_wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px;
    /* spacing from edges on small screens */
    background: transparent;
    color: white;
    max-width: 1130px;
    /* Constrain content width */
    margin: 0 auto;
    /* Center it */
}

/* Left: Logo - BIGGER */
.pkp_site_name {
    flex: 0 0 auto;
    margin-right: 30px;
    display: block !important;
}

.pkp_site_name a.is_img {
    display: block;
    background: transparent;
    border-radius: 0;
    padding: 0;
    width: 160px;
    height: 160px;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    /* Allow logo to spill out if scaled */
}

.pkp_site_name img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transform: scale(1.7);
}

/* Center: Title */
.custom-header-center {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.custom-journal-title {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 38px;
    /* Larger title */
    line-height: 1.1;
    font-weight: 500;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.custom-journal-subtitle {
    font-size: 15px;
    font-weight: normal;
    opacity: 0.9;
    letter-spacing: 0.5px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    padding-top: 5px;
    display: inline-block;
}

/* Right: ISSN */
.custom-header-right {
    flex: 0 0 auto;
    text-align: right;
    font-size: 15px;
    line-height: 1.4;
    margin-left: 20px;
}

/* --- Navigation Styles (Black Bar Full Width) --- */
.pkp_site_nav_menu {
    background: #000 !important;
    /* Solid Black */
    width: 100%;
    border-top: 1px solid #333;
    padding: 0;
}

/* Override OJS Theme Defaults for Nav */
.pkp_navigation_primary_wrapper {
    max-width: 100%;
    margin: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    /* This keeps the group centered */
    align-items: center;
}

/* Hide mobile toggle & mobile drawer by default (desktop) */
.header-mobile-toggle {
    display: none;
}

.mobile-nav-drawer {
    display: none;
}

.pkp_navigation_primary,
.pkp_nav_list {
    background: transparent !important;
    display: flex !important;
    /* Override OJS core inline-block on desktop */
    align-items: center !important;
    justify-content: flex-start !important;
    /* Change from center to flex-start or keep as needed */
    width: auto !important;
    max-width: 100% !important;
    margin: 0 !important;
    /* Removed auto to avoid pushing button too far */
    padding: 0 !important;
    text-align: left !important;
}

.pkp_navigation_primary>li>a {
    color: #fff !important;
    padding: 8px 16px !important;
    font-size: 15px !important;
    border: none !important;
    background: transparent !important;
    text-transform: capitalize !important;
    line-height: 1.3 !important;
}

.pkp_navigation_primary>li:hover>a,
.pkp_navigation_primary>li:focus>a,
.pkp_navigation_primary>li.current>a {
    background: #222 !important;
    color: white !important;
}

/* --- Blinking Submit Button in Nav --- */
.submit-paper-blink {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: #e74c3c;
    color: white !important;
    width: 140px;
    height: 36px;
    padding: 0 !important;
    margin-left: 10px !important;
    /* Tightened margin */
    border-radius: 4px;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 14px;
    text-decoration: none !important;
    border: 2px solid white;
    white-space: nowrap;
    line-height: normal !important;
    /* Reset line-height */
}

.submit-paper-blink:hover {
    background-color: #c0392b;
    /* Darker red on hover */
    color: white !important;
    text-decoration: none;
    animation: none;
    /* Stop blinking on hover */
}

@keyframes blinking {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 10px 10px rgba(231, 76, 60, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
    }
}

.pkp_navigation_user_wrapper {
    display: none !important;
}

.pkp_navigation_search_wrapper {
    display: none !important;
}

/* --- Homepage Layout --- */
/* Main Layout - Adjust Container to be fluid but constrained */
.pkp_structure_content {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
}

.pkp_structure_main {
    margin: 0 auto !important;
    width: 100% !important;
    max-width: 1130px !important;
    box-sizing: border-box;
}

.page_index_journal {
    background: #f4f6f9;
    /* Standard web light gray */
    padding: 30px 0;
    display: flex;
    justify-content: center;
    min-height: 80vh;
}

.custom-sidebar {
    width: 300px;
    background: white;
    padding: 20px;
    border-radius: 4px;
    margin-right: 20px;
    /* Reduced from 30px */
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.05);
    /* Match main content shadow */
    border: 1px solid #eee;
    box-sizing: border-box;
    /* Ensure padding includes width */
    flex-shrink: 0;
}

/* Sidebar Links - Mimic IJSR */
.custom-sidebar-link {
    color: #0056b3;
    /* Bootstrap primary dark blue */
    font-size: 14px;
    padding: 8px 0;
    /* Minimal padding */
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    background: transparent;
    transition: all 0.2s;
}

.custom-sidebar-link:hover {
    color: #003d80;
    background: transparent;
    text-decoration: underline;
    padding-left: 5px;
    /* Slight slide effect */
}

/* Add caret icon */
.custom-sidebar-link::before {
    content: "\f0da";
    /* FontAwesome caret right */
    font-family: FontAwesome;
    margin-right: 8px;
    color: #666;
}

/* Hide the icon I added in HTML to clean up */
.custom-sidebar-link i {
    display: none;
}

/* --- Floating/Side Social Icons (Desktop Default) --- */
.custom-social-side {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 40px;
    margin-left: 15px;
    /* Add spacing */
    flex-shrink: 0;
    /* Prevent shrinking */
    /* positioned by page layout usually, or we can leave it fixed if needed */
}

.social-icon-box {
    width: 40px;
    height: 40px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: opacity 0.2s;
    cursor: pointer;
}

.social-icon-box:hover {
    opacity: 0.8;
}


.custom-main-content {
    width: 750px;
    /* Reduced from 800px to fit social icons */
    background: white;
    padding: 40px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.05);
    /* Soft shadow */
    border: 1px solid #eee;
    text-align: center;
    border-radius: 4px;
    box-sizing: border-box;
}

.impact-factor-box {
    margin-bottom: 20px;
    font-size: 15px;
    color: #333;
    font-weight: bold;
}

/* Submit Button - IJSR Style */
.submit-btn {
    display: inline-block;
    background: #000;
    /* Solid Black */
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 8px;
    padding: 15px 40px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    margin: 20px 0;
    border: 1px solid #444;
    text-align: center;
    line-height: 1.4;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    background: #222;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.submit-subtext {
    display: block;
    font-size: 11px;
    font-weight: normal;
    opacity: 0.8;
    margin-top: 4px;
}

/* Hide default site name */
.pkp_site_name_wrapper .pkp_site_name {
    display: block !important;
}

/* --- Custom Footer Styles --- */
.pkp_structure_footer_wrapper {
    background: #111;
    /* Dark Background */
    color: #ccc;
    padding: 0;
    margin: 0;
    width: 100%;
}

.custom-footer {
    background: #0277bd;
    /* Match header blue base */
    background: linear-gradient(to top, #01579b 0%, #0288d1 100%);
    border-top: 5px solid #03a9f4;
    padding-top: 25px;
    /* Reduced from 50px */
    font-size: 14px;
}

.custom-footer-container {
    max-width: 1130px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 0 20px 20px;
    /* Reduced bottom padding */
}

.footer-col {
    flex: 1;
    min-width: 250px;
    margin-right: 20px;
    margin-bottom: 30px;
}

.footer-col h3 {
    color: white;
    font-size: 18px;
    margin-bottom: 20px;
    border-bottom: 2px solid white;
    padding-bottom: 10px;
    display: inline-block;
}

.footer-col p {
    line-height: 1.6;
    color: #ddd;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
}

.footer-links li a {
    color: #ccc;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links li a:hover {
    color: white;
    padding-left: 5px;
}

.footer-social a {
    display: inline-block;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-align: center;
    line-height: 36px;
    margin-right: 10px;
    border-radius: 4px;
    transition: background 0.3s;
}

.footer-social a:hover {
    background: #fff;
    color: #01579b;
}

.custom-copyright {
    background: #000;
    padding: 5px 10px;
    /* Extremely minimal padding */
    text-align: center;
    color: #888;
    font-size: 12px;
    border-top: 1px solid #111;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    height: auto;
    /* Allow shrink */
    min-height: 0;
}

.custom-copyright p {
    margin: 0;
    line-height: normal;
}

.pkp_brand_footer {
    margin: 0;
    opacity: 0.5;
    line-height: 0;
}

.pkp_brand_footer img {
    height: 14px;
    /* Tiny logo */
    width: auto;
    display: block;
}

/* --- Mobile Responsive Styles --- */
@media (max-width: 991px) {

    /* FIX: Force header to expand and not overlap content */
    .pkp_structure_head,
    .pkp_head_wrapper,
    .pkp_head_wrapper {
        height: auto !important;
        min-height: 0 !important;
    }

    .pkp_site_name_wrapper {
        height: auto !important;
        min-height: 0 !important;
    }

    /* GRID Layout: Explicit columns to prevent overlap */
    .pkp_site_name_wrapper {
        display: grid !important;
        grid-template-columns: 130px 1fr !important;
        /* Use 85px col */
        grid-template-rows: auto auto;
        align-items: center !important;
        /* Y-Axis Center for Grid */
        padding: 10px 0 10px 0 !important;
        /* Zero padding on edges of screen */
        gap: 5px;
        text-align: left !important;
    }

    /* Logo: Cell 1 */
    .pkp_site_name {
        grid-column: 1;
        grid-row: 1 / span 2;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        display: flex;
        justify-content: flex-start !important;
        /* Align Left */
        align-self: center !important;
        /* Strict Y-Axis Center */
    }

    /* Logo Image */
    .pkp_site_name a.is_img {
        width: 150px !important;
        height: 150px !important;
        margin-left: -50px !important;
        overflow: visible !important;
    }

    .pkp_site_name img {
        width: 100% !important;
        height: auto !important;
        object-fit: contain;
    }

    /* Center Text (Title): Cell 2, Row 1 */
    .custom-header-center {
        grid-column: 2;
        grid-row: 1;
        width: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        text-align: left !important;
        display: block !important;
    }

    .custom-journal-title {
        font-size: 18px !important;
        /* Slightly bigger text */
        line-height: 1.1;
        color: white;
        display: block;
        width: 100%;
        margin-bottom: 5px;
    }

    /* ISSN: Cell 2, Row 2 */
    .custom-header-right {
        grid-column: 2;
        grid-row: 2;
        width: auto !important;
        text-align: left !important;
        font-size: 12px !important;
        margin: 0 !important;
        opacity: 0.9;
    }

    /* Hide subtitle completely */
    .custom-journal-subtitle {
        display: none !important;
    }

    /* Navigation - Ensure it hits a new line */
    .pkp_site_nav_menu {
        display: block !important;
        /* Override OJS core nav-toggle.less which sets display:none on mobile */
        position: relative;
        width: 100%;
        background: #000 !important;
        min-height: 50px;
        margin-top: 0;
        padding: 0;
        border-top: 1px solid #333;
    }

    /* Mobile Toggle Button */
    .header-mobile-toggle {
        display: block !important;
        position: absolute;
        top: 8px;
        /* Inside the black bar */
        right: 15px;
        background: transparent;
        border: 2px solid white;
        /* Thicker white border */
        border-radius: 4px;
        color: white;
        /* White icon */
        font-size: 24px;
        /* Larger icon */
        padding: 6px 15px;
        /* Bigger touch target */
        cursor: pointer;
        z-index: 99999;
        /* Super high z-index */
        transition: all 0.2s;
        line-height: 1;
        opacity: 1 !important;
        visibility: visible !important;
    }

    .header-mobile-toggle span {
        display: block !important;
        color: white !important;
        visibility: visible !important;
        line-height: 1;
    }

    .header-mobile-toggle:hover {
        background: #333;
        border-color: #999;
    }

    .header-mobile-toggle[aria-expanded="true"] {
        background: #fff;
        color: #000;
        border-color: #fff;
    }

    /* Hide Navigation Row by Default on Mobile */
    .pkp_navigation_primary_row {
        display: none;
        width: 100%;
        background: #111;
        /* Dark background for dropdown */
        padding: 10px 0;
        border-top: 1px solid #333;
        position: absolute;
        /* Float over content */
        top: 50px;
        /* Below the bar */
        left: 0;
        z-index: 1000;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    }

    /* Class used by JS to show it */
    /* Class used by JS to show it */
    .pkp_navigation_primary_row.active {
        display: block !important;
        animation: fadeInSlide .2s ease-out;
    }

    @keyframes fadeInSlide {
        from {
            opacity: 0;
            transform: translateY(-5px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .pkp_navigation_primary,
    .pkp_nav_list {
        flex-direction: column;
        /* Stack menu items vertically */
        width: 100%;
        padding: 0;
        margin: 0;
    }

    .pkp_navigation_primary>li {
        width: 100%;
        text-align: left;
        /* Left align text */
        border-bottom: 1px solid #222;
        display: block;
    }

    .pkp_navigation_primary>li>a {
        padding: 12px 20px;
        font-size: 15px;
        display: block;
        width: 100%;
        box-sizing: border-box;
        color: #ddd !important;
    }

    .pkp_navigation_primary>li>a:hover {
        background: #222 !important;
        color: #fff !important;
    }

    /* Submit Button - Center and Spacing */
    .submit-paper-blink {
        margin: 20px auto;
        /* Center it */
        width: 80%;
        /* Wide button */
        /* Reset any flex alignment from desktop if needed */
    }

    /* Main Layout - Stack Content */
    .page_index_journal {
        flex-direction: column;
        padding: 20px 10px;
    }

    .custom-sidebar {
        width: 100% !important;
        max-width: 100% !important;
        margin-right: 0;
        margin-bottom: 30px;
        order: 3;
        /* Sidebar at bottom */
    }

    /* Social Icons Horizontal on Mobile */
    .custom-social-side {
        width: 100% !important;
        flex-direction: row !important;
        justify-content: center !important;
        margin: 20px 0 !important;
        gap: 15px !important;
        order: 2;
        /* Social between Content and Sidebar */
        position: static !important;
        /* Not fixed */
    }

    .custom-main-content {
        width: 100% !important;
        max-width: 100% !important;
        padding: 20px 15px !important;
        margin-bottom: 30px;
        order: 1;
        /* Content first */
        box-sizing: border-box !important;
    }

    /* Specific Fix for Inner Content Box (Certificate/Track) */
    .custom-main-content>div[style*="border-left"] {
        padding: 15px !important;
        /* Override inline 25px */
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .custom-main-content h1 {
        font-size: 22px !important;
        /* Smaller heading */
        margin-top: 0 !important;
    }

    .custom-main-content ol,
    .custom-main-content ul {
        margin-left: 0 !important;
        padding-left: 20px !important;
    }

    /* Footer - Full width columns */
    .footer-col {
        min-width: 100%;
        margin-right: 0;
        flex: 1 1 100%;
        text-align: center;
    }

    .custom-footer-container {
        padding: 0 15px 20px;
        flex-direction: column;
    }

    .custom-copyright {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }

    /* Global Mobile Fixes - Essential for "Complete App Responsiveness" */
    img,
    iframe,
    .pkp_structure_main img {
        max-width: 100% !important;
        height: auto !important;
    }

    table {
        display: block;
        overflow-x: auto;
        width: 100%;
        -webkit-overflow-scrolling: touch;
    }

    /* Fix Forms on Mobile */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea,
    select {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* =========================================
       MOBILE NAV DRAWER
       ========================================= */

    /* Hide the desktop nav row completely on mobile */
    .pkp_navigation_primary_row {
        display: none !important;
    }

    /* ---- Mobile submenu collapse ---- */
    /* Sub-menus inside the drawer are hidden until parent is clicked */
    .mobile-nav-drawer li ul.mobile-submenu {
        display: none;
    }

    .mobile-nav-drawer li ul.mobile-submenu.open {
        display: block !important;
    }

    /* Parent item that has a submenu gets an arrow indicator (handled by JS now) */
    .mobile-nav-drawer li.has-submenu>a::after {
        display: none !important;
    }

    .mobile-nav-drawer li.has-submenu.open>a::after {
        display: none !important;
    }

    /* Show the hamburger button */
    .header-mobile-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 0;
        right: 0;
        width: 50px;
        height: 50px;
        background: transparent;
        border: none;
        color: #fff;
        font-size: 26px;
        cursor: pointer;
        z-index: 99999;
        padding: 0;
        line-height: 1;
    }

    .header-mobile-toggle:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    /* Mobile nav drawer — hidden by default */
    .mobile-nav-drawer {
        display: block;
        max-height: 0;
        overflow: hidden;
        background: #111;
        width: 100%;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
        transition: max-height 0.3s ease, opacity 0.3s ease;
        opacity: 0;
        /* Sits below the black nav bar */
        position: relative;
        z-index: 9000;
    }

    /* When .open is added by JS, drawer slides down */
    .mobile-nav-drawer.open {
        max-height: 600px;
        opacity: 1;
    }

    /* Nav items inside the drawer */
    .mobile-nav-drawer ul {
        list-style: none !important;
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
        width: 100% !important;
    }

    .mobile-nav-drawer li {
        display: block !important;
        width: 100% !important;
        border-bottom: 1px solid #2a2a2a !important;
    }

    .mobile-nav-drawer li a,
    .mobile-nav-drawer li>a {
        display: block !important;
        padding: 14px 20px !important;
        color: #e0e0e0 !important;
        font-size: 15px !important;
        text-decoration: none !important;
        background: transparent !important;
        border: none !important;
        transition: background 0.2s, color 0.2s;
    }

    .mobile-nav-drawer li a:hover {
        background: #222 !important;
        color: #fff !important;
        padding-left: 28px !important;
    }

    /* Nested sub-menus inside the drawer */
    .mobile-nav-drawer li ul {
        background: #0a0a0a;
    }

    .mobile-nav-drawer li ul li a {
        padding-left: 35px !important;
        font-size: 14px !important;
        color: #aaa !important;
    }

    /* Submit Paper button inside drawer */
    .mobile-nav-submit {
        display: block !important;
        margin: 12px 16px !important;
        padding: 12px 20px !important;
        background: #e74c3c !important;
        color: #fff !important;
        text-align: center !important;
        border-radius: 5px !important;
        font-weight: bold !important;
        font-size: 14px !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
        text-decoration: none !important;
        border: 2px solid #fff !important;
        transition: background 0.2s;
    }

    .mobile-nav-submit:hover {
        background: #c0392b !important;
    }
}