/* ═══════════════════════════════════════════════════════
   GLOBAL MOBILE FIXES — Professional & Fluid on all devices
   ═══════════════════════════════════════════════════════ */

/* ── Prevent horizontal overflow on all pages ── */
html, body {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

/* ── Smooth scrolling & tap highlight ── */
html {
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

/* Ensure all images and embeds respect container */
img, video, iframe, embed, object {
    max-width: 100%;
}

/* ═══════════════════════════════════
   TABLET — max-width: 992px
   ═══════════════════════════════════ */
@media only screen and (max-width: 992px) {

    /* Top row: flexible height, all links visible */
    .header-style3 .toprow {
        height: auto !important;
        min-height: 36px;
        padding: 4px 0;
    }
    .header-style3 .toprow .row {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0;
    }
    .header-style3 .toprow .col-md-6,
    .header-style3 .toprow .col-sm-6 {
        width: auto;
        float: none;
        flex: 0 1 auto;
    }
    .header-style3 .toprow .top-menus {
        float: none !important;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
    }
    .header-style3 .toprow .top-menus ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        padding: 0;
        margin: 0;
    }

    /* Footer columns stack nicely */
    .site-footer .col-md-4 {
        margin-bottom: 30px;
    }
}

/* ═══════════════════════════════════
   MOBILE — max-width: 768px
   ═══════════════════════════════════ */
@media only screen and (max-width: 768px) {

    /* Top row: icons only, hide text */
    .toplink-text {
        display: none !important;
    }
    .header-style3 .toprow .top-menus a {
        font-size: 0;
        padding: 0 10px;
    }
    .header-style3 .toprow .top-menus a i {
        font-size: 14px;
    }
    .header-style3 .toprow .top-menus .dropdown-toggle strong {
        font-size: 0;
    }
    .header-style3 .toprow .top-menus .dropdown-toggle .caret {
        display: none;
    }
    .header-style3 .toprow .top-menus .dropdown-toggle::before {
        content: '\f007';
        font-family: FontAwesome;
        font-size: 14px;
    }

    /* Main content prevent overflow */
    .main, #main-content, .content, .container {
        overflow-x: hidden;
    }

    /* Better container padding */
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Footer — map responsive */
    .site-footer .map-width {
        width: 100% !important;
        height: 180px !important;
    }

    /* Footer text spacing */
    .site-footer .footer-widget {
        margin-bottom: 24px;
    }
    .site-footer .footer-widget p {
        font-size: 13px;
        line-height: 1.7;
    }
    .site-footer .footer-widget h4 {
        font-size: 15px;
    }
    .site-footer .footer-widget ul li a {
        font-size: 13px;
        padding: 5px 0;
    }

    /* Bottom footer */
    .site-footer-bottom .copyrights-col-left,
    .site-footer-bottom .copyrights-col-right {
        text-align: center;
        float: none;
        width: 100%;
    }
    .site-footer-bottom .copyrights-col-left p {
        font-size: 12px;
        margin-bottom: 8px;
    }
    .site-footer-bottom .social-icons {
        text-align: center;
        float: none;
    }

    /* User dropdown menu positioning */
    .top-menus .dropdown-menu {
        position: absolute;
        right: 0;
        left: auto;
        min-width: 180px;
    }

    /* Global headings scale */
    h1 { font-size: 26px; }
    h2 { font-size: 22px; }
    h3 { font-size: 18px; }

    /* Services grid — 2 columns on tablet, 1 on phone */
    .services-grid .col-md-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* ═══════════════════════════════════
   SMALL MOBILE — max-width: 576px
   ═══════════════════════════════════ */
@media only screen and (max-width: 576px) {

    /* Container tighter padding */
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }

    /* Footer logo image */
    .site-footer .footer-widget img {
        max-width: 180px;
    }

    /* Services grid — single column */
    .services-grid .col-md-4,
    .services-grid .col-sm-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .service-card {
        padding: 16px 14px;
    }

    /* Parole forte slider mobile */
    .parole-forte-slider {
        padding: 24px 20px;
    }
    .parole-forte-header h2 {
        font-size: 15px;
    }
    .parole-forte-text {
        font-size: 14px;
        line-height: 1.7;
    }

    /* Flash info widget */
    .flash-info-widget {
        font-size: 12px;
    }
    .flash-info-item {
        padding: 10px 12px;
        font-size: 12px;
    }

    /* Event banner mobile */
    .evt-banner-inner {
        padding: 10px 0;
    }
    .evt-banner-name {
        font-size: 13px;
    }
    .evt-timer-box {
        min-width: 36px;
        padding: 4px 6px;
    }
    .evt-timer-num {
        font-size: 14px;
    }

    /* Side cards (sidebar) */
    .side-card-img-wrap {
        height: 150px;
    }

    /* Sidebar collapses */
    .col-md-4.col-sm-6 .side-card {
        margin-bottom: 16px;
    }
}

/* ═══════════════════════════════════
   VERY SMALL — max-width: 400px
   ═══════════════════════════════════ */
@media only screen and (max-width: 400px) {
    .container {
        padding-left: 8px;
        padding-right: 8px;
    }

    h1 { font-size: 22px; }
    h2 { font-size: 20px; }
    h3 { font-size: 16px; }

    /* Footer map */
    .site-footer .map-width {
        height: 150px !important;
    }

    /* Parole forte slider */
    .parole-forte-slider {
        padding: 20px 16px;
        min-height: 160px;
    }
}

/* ═══════════════════════════════════
   CONTENT OVERFLOW PREVENTION
   ═══════════════════════════════════ */

/* Ensure tables in article content scroll horizontally, not break layout */
.rd-body table,
.dtl-body table,
.bib-art-body table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

/* Ensure pre/code blocks don't overflow */
.rd-body pre,
.dtl-body pre,
.bib-art-body pre {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Long URLs / words don't break layout */
.rd-body,
.dtl-body,
.bib-art-body {
    word-break: break-word;
    overflow-wrap: break-word;
}

/* ═══════════════════════════════════
   SIDEBAR — Mobile stacking for list pages
   ═══════════════════════════════════ */
@media only screen and (max-width: 768px) {
    /* Bootstrap col-md-9/col-md-3 stack — add spacing */
    .col-md-3.sidebar {
        margin-top: 30px;
    }
}
