/* ==========================================================================
   Responsive Adjustments for JA Opal Joomla 1.5 Template
   ========================================================================== */

/* Wide Desktop Screens (min-width: 1200px) */
@media screen and (min-width: 1200px) {
    .main {
        width: 1180px !important;
    }
    /* Keep slideshow container centered and at its original width to prevent breaking transitions */
    #ja-topsl .main {
        width: 960px !important;
    }
}

/* Extra Wide Desktop Screens (min-width: 1400px) */
@media screen and (min-width: 1400px) {
    .main {
        width: 1380px !important;
    }
    #ja-topsl .main {
        width: 960px !important;
    }
}

@media screen and (max-width: 980px) {
    /* Global box-sizing reset for consistent spacing */
    *, *:before, *:after {
        box-sizing: border-box !important;
    }

    .main {
        width: 100% !important;
        max-width: 960px !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    /* Header adjustments */
    #ja-header {
        height: auto !important;
        min-height: 140px;
        padding-bottom: 15px !important;
    }

    #ja-header .main {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
    }

    h1.logo, div.logo-text {
        float: none !important;
        margin: 15px auto 10px !important;
        text-align: center !important;
    }

    h1.logo a {
        margin: 0 auto !important;
        background-size: contain !important;
        max-width: 100% !important;
        width: 290px !important; /* Scaled down from 500px */
        height: 116px !important; /* Keep aspect ratio 2.5:1 */
    }

    #ja-banner {
        float: none !important;
        margin: 10px auto !important;
        text-align: center !important;
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
    }

    #ja-banner * {
        max-width: 100% !important;
        height: auto !important;
    }
}

@media screen and (max-width: 768px) {
    /* Layout columns conversion from floats to blocks */
    #ja-mainbody, 
    #ja-colwrap, 
    #ja-content, 
    #ja-col1, 
    #ja-col2,
    #ja-mainbodywrap {
        width: 100% !important;
        float: none !important;
        clear: both !important;
        padding: 0 !important;
        margin: 0 0 20px 0 !important;
    }

    #ja-colwrap .ja-innerpad {
        padding: 0 10px !important;
    }

    /* Pathway and Search form */
    #ja-pathway .inner {
        height: auto !important;
        padding: 10px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    #ja-pathway .ja-pathway-text {
        float: none !important;
        padding: 5px 0 !important;
    }

    #ja-search {
        position: relative !important;
        top: auto !important;
        right: auto !important;
        margin: 10px 0 0 0 !important;
        width: 100% !important;
        max-width: 320px !important;
        float: none !important;
    }

    #ja-search .inputbox {
        width: calc(100% - 100px) !important;
    }

    /* Slideshow and Highlights */
    #ja-slideshow {
        width: 100% !important;
        float: none !important;
        padding: 10px 0 !important;
        overflow: hidden !important;
    }

    #ja-slideshow * {
        max-width: 100% !important;
    }

    #ja-slideshow .ja-slide-item img {
        width: 100% !important;
        height: auto !important;
    }

    #ja-hl {
        width: 100% !important;
        float: none !important;
        margin-top: 15px !important;
    }

    /* Headtools (Login / Register module position) */
    #ja-headtools {
        position: relative !important;
        right: auto !important;
        top: auto !important;
        width: 100% !important;
        height: auto !important;
        margin: 10px auto !important;
        float: none !important;
        display: flex !important;
        justify-content: center !important;
        background: none !important;
    }

    #ja-headtools ul {
        float: none !important;
        margin: 0 auto !important;
        display: flex !important;
        justify-content: center !important;
    }

    /* Bottom spotlight modules (Force 100% width on mobile) */
    #ja-botsl .ja-box-left,
    #ja-botsl .ja-box-center,
    #ja-botsl .ja-box-right,
    #ja-botsl .ja-box-full,
    #ja-botsl [class*="ja-box"] {
        width: 100% !important;
        float: none !important;
        margin: 0 0 20px 0 !important;
        padding: 0 10px !important;
    }

    /* Main article area / responsive tables & images */
    #ja-current-content {
        padding: 10px !important;
        overflow-x: auto !important; /* Enable scroll container inside articles for safety */
    }

    #ja-current-content img {
        max-width: 100% !important;
        height: auto !important;
    }

    #ja-current-content table {
        width: 100% !important;
        max-width: 100% !important;
        display: block !important;
        overflow-x: auto !important;
        white-space: nowrap;
    }

    /* Footer styling */
    #ja-footer {
        text-align: center !important;
    }

    #ja-footer ul {
        float: none !important;
        margin: 15px auto 0 !important;
        padding: 0 !important;
        display: block !important;
    }

    #ja-footer li {
        display: inline-block !important;
        margin: 5px 10px !important;
    }

    /* Navigation - Mobile Hamburger Toggle */
    .menu-toggle {
        display: block !important;
        background: #111111;
        color: #FFFFFF;
        padding: 12px 15px;
        cursor: pointer;
        font-weight: bold;
        text-transform: uppercase;
        text-align: center;
        border-bottom: 2px solid #104F92; /* Match the theme's blue highlight color */
        margin: 0 5px;
    }

    .menu-toggle:hover {
        background: #222222;
        color: #D1E0EF;
    }

    .menu-toggle span:before {
        content: "☰ ";
        font-size: 1.2em;
        vertical-align: middle;
    }

    /* Mobilize CSS Dropdown Menu */
    #ja-cssmenu {
        display: none;
        margin: 0 5px !important;
        padding: 0 !important;
        width: calc(100% - 10px) !important;
        float: none !important;
        background: #222222 !important;
    }

    #ja-cssmenu.menu-open {
        display: block !important;
    }

    #ja-cssmenu li {
        float: none !important;
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
        border-bottom: 1px solid #333333 !important;
        background: none !important;
    }

    #ja-cssmenu li a {
        background: none !important;
        padding: 12px 15px !important;
        width: auto !important;
        display: block !important;
        color: #D1E0EF !important;
    }

    #ja-cssmenu li a:hover,
    #ja-cssmenu li a:focus {
        background: #0C3C71 !important;
        color: #FFFFFF !important;
    }

    /* Mobile submenus always visible and nested */
    #ja-cssmenu li ul {
        position: relative !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        display: block !important;
        border: none !important;
        background: #333333 !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding-left: 20px !important;
    }

    #ja-cssmenu li ul ul {
        margin: 0 !important;
        padding-left: 20px !important;
    }

    #ja-cssmenu li ul li {
        border-bottom: 1px solid #444444 !important;
    }

    #ja-cssmenu li ul a {
        color: #CCCCCC !important;
        padding: 8px 15px !important;
    }

    #ja-cssmenu li.active {
        background: #0C3C71 !important;
    }

    #ja-cssmenu li.active a {
        background: none !important;
        color: #FFFFFF !important;
    }
}
