/* ==========================================================================
   Global Mobile & Tablet Responsive Fixes
   Added to resolve overlaps and ensure a professional layout on small screens
   This file specifically targets screens below 1100px.
   ========================================================================== */

/* Professional Gallery Redesign CSS */
.professional-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    width: 100%;
}
.prof-gallery-item {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(13, 27, 42, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: #fff;
    border: 1px solid #dfe6e9;
    cursor: pointer;
}
.prof-gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(13, 27, 42, 0.2);
    border-color: #90E0EF;
}
.prof-gallery-item a {
    display: block;
    width: 100%;
    height: 100%;
}
.prof-gallery-item img {
    width: 100%;
    height: 250px !important;
    object-fit: cover !important;
    display: block;
    transition: transform 0.5s ease;
}
.prof-gallery-item:hover img {
    transform: scale(1.05);
}


/* Ensure content in speakers section is always on top of background & anim-icons overlays */
.speakers-section:before {
    z-index: 0 !important;
    pointer-events: none !important;
}
.anim-icons {
    z-index: 1 !important;
    pointer-events: none !important;
}
.speakers-section .auto-container,
.speakers-section .inner-page-content,
.speakers-grid,
.committee-sections-grid {
    position: relative !important;
    z-index: 3 !important;
}

/* Speaker & committee cards must never depend on scroll animations (WOW.js / AOS)
   or get hidden behind background overlays. Always show cards, images, and text. */
.speaker-card,
.speaker-card.wow,
.speaker-card[data-aos],
.committee-col,
.committee-col .speaker-card,
.advisory-grid,
.advisory-grid .speaker-card,
.loc-grid .speaker-card,
.speaker-block {
    position: relative !important;
    z-index: 4 !important;
    visibility: visible !important;
    opacity: 1 !important;
}
.speaker-card *,
.committee-col *,
.advisory-grid *,
.loc-grid *,
.speaker-block * {
    visibility: visible !important;
    opacity: 1 !important;
}
@media (max-width: 1100px) {
    .speaker-card,
    .speaker-card[data-aos],
    .speaker-card.wow,
    .committee-col .speaker-card,
    .advisory-grid .speaker-card,
    .speaker-block {
        transform: none !important;
        animation: none !important;
        visibility: visible !important;
        opacity: 1 !important;
        display: flex !important;
        flex-direction: column !important;
    }
}


@media (max-width: 1100px) {
    /* Base resets to prevent horizontal scroll and overlaps */
    html, body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }

    /* Fluid media to prevent overflowing, without breaking specific sizes */
    img, video, iframe, canvas {
        max-width: 100%;
        height: auto;
    }

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

    /* Responsive Grid & Flex Containers */
    /* Many grid systems break if they try to hold too many columns on mobile */
    .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    .container {
        padding-left: 15px !important;
        padding-right: 15px !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Prevent text from overflowing */
    p, h1, h2, h3, h4, h5, h6, span, a, div {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* Generic padding/margin reductions for sections on tablet/mobile */
    section {
        padding-top: 40px !important;
        padding-bottom: 40px !important;
}
@media (max-width: 991px) {
    .committee-sections-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 36px !important;
    }
    .committee-col {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        min-height: 0 !important;
        width: 100% !important;
    }
    .committee-col .speaker-card {
        height: auto !important;
        max-width: 280px !important;
        margin: 0 auto !important;
    }
    .committee-col .speaker-card-body {
        height: auto !important;
        flex: 1 1 auto !important;
    }
}

@media (max-width: 768px) {
    /* Smooth mobile scrolling & interaction */
    html {
        scroll-behavior: smooth;
    }
    html, body {
        -webkit-overflow-scrolling: touch;
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }
    button, a, input, select, textarea {
        touch-action: manipulation;
    }

    /* Header/Logo safety */
    .icbtm-logo img, .navbar-2027 .logo img {
        max-width: 190px !important;
        height: auto !important;
    }

    /* Inner page banners & titles */
    .page-title h1, .sec-title h2 {
        font-size: 26px !important;
        line-height: 1.25 !important;
    }
    .page-banner {
        padding: 40px 0 !important;
    }

    /* Typography scaling */
    h1 { font-size: 28px !important; line-height: 1.2 !important; }
    h2 { font-size: 24px !important; line-height: 1.3 !important; }
    h3 { font-size: 20px !important; line-height: 1.4 !important; }
    
    /* Hero section specifics */
    .hero-2027 {
        min-height: auto !important;
        padding: 46px 16px 36px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
    }
    .hero-2027 .hero-content {
        width: 100% !important;
        max-width: 520px !important;
        padding: 0 !important;
        margin: 0 auto !important;
        text-align: center !important;
    }
    .hero-2027 h1 {
        font-size: clamp(24px, 6.8vw, 34px) !important;
        line-height: 1.2 !important;
        margin: 0 auto 12px !important;
        max-width: 100% !important;
        word-break: normal !important;
        overflow-wrap: normal !important;
    }
    .hero-2027 .hero-sub {
        font-size: 13.5px !important;
        line-height: 1.5 !important;
        color: rgba(255, 255, 255, 0.85) !important;
        max-width: 440px !important;
        margin: 0 auto 14px !important;
    }
    .hero-2027 .hero-venue {
        justify-content: center !important;
        text-align: center !important;
        font-size: 12.5px !important;
        margin: 0 auto 22px !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
    }
    .hero-btns {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        width: 100% !important;
        max-width: 320px !important;
        margin: 0 auto !important;
    }
    .btn-primary-2027, .btn-outline-2027 {
        padding: 12px 20px !important;
        font-size: 14px !important;
        width: 100% !important;
        justify-content: center !important;
        text-align: center !important;
    }

    /* Pre-conference button on mobile flows cleanly without blocking UI */
    .pre-conf-floating-btn {
        position: static !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        max-width: 320px !important;
        margin: 14px auto 0 !important;
        padding: 11px 18px !important;
        font-size: 13px !important;
        animation: none !important;
        box-shadow: 0 6px 20px rgba(255, 107, 53, 0.35) !important;
        border-radius: 50px !important;
        box-sizing: border-box !important;
    }

    /* Countdown Timer */
    .countdown-2027 {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 8px !important;
        max-width: 360px !important;
        width: 100% !important;
        margin: 0 auto 24px !important;
    }
    .cd-box {
        min-width: 0 !important;
        padding: 10px 4px !important;
        border-radius: 10px !important;
        text-align: center !important;
        background: rgba(255, 255, 255, 0.12) !important;
    }
    .cd-box .num {
        font-size: clamp(20px, 5.5vw, 24px) !important;
        line-height: 1.1 !important;
    }
    .cd-box .label {
        font-size: 9.5px !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: clip !important;
        display: block !important;
    }

    /* Break any complex flex rows into columns */
    .d-flex, .flex-row {
        flex-wrap: wrap !important;
    }
    
    /* Ensure Speaker Grid is balanced & touch-friendly on mobile */
    .speakers-grid {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 20px !important;
        margin-top: 24px !important;
    }
    .committee-sections-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 36px !important;
    }
    .committee-col {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        min-height: 0 !important;
        width: 100% !important;
    }
    .committee-sec-title {
        margin-bottom: 16px !important;
    }
    .committee-col[style*="margin-top"] {
        margin-top: 15px !important;
    }
    .advisory-grid, .loc-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }
    
    /* Ensure Speaker & Committee Cards Render Proportioned on Mobile */
    .speaker-card, .committee-col .speaker-card, .advisory-grid .speaker-card, .loc-grid .speaker-card {
        flex: 0 1 260px !important;
        width: 100% !important;
        max-width: 270px !important;
        margin: 0 auto !important;
        height: auto !important;
        background: #ffffff !important;
        display: flex !important;
        flex-direction: column !important;
        visibility: visible !important;
        opacity: 1 !important;
        border: 1px solid #dfe6e9 !important;
        box-shadow: 0 4px 16px rgba(13,27,42,0.1) !important;
        border-radius: 12px !important;
        transform: none !important;
        animation: none !important;
        position: relative !important;
        z-index: 5 !important;
        overflow: hidden !important;
    }
    .committee-col .speaker-card {
        max-width: 260px !important;
        margin: 0 auto !important;
        height: auto !important;
    }
    .committee-col .speaker-card-body {
        height: auto !important;
        flex: 1 1 auto !important;
    }
    .advisory-grid .speaker-card, .loc-grid .speaker-card {
        padding: 16px 14px !important;
    }
    .speaker-card img {
        display: block !important;
        width: 100% !important;
        height: 240px !important;
        object-fit: cover !important;
        object-position: top !important;
        visibility: visible !important;
        opacity: 1 !important;
        background-color: #e9ecef !important;
        position: relative !important;
        z-index: 6 !important;
    }
    .speaker-card-body {
        padding: 12px 8px !important;
        background: #ffffff !important;
        position: relative !important;
        z-index: 6 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        flex: 1 1 auto !important;
    }
    .speaker-card h4 {
        font-family: 'Outfit', sans-serif !important;
        font-size: 13.5px !important;
        font-weight: 700 !important;
        color: #0D1B2A !important;
        margin: 0 0 3px 0 !important;
        line-height: 1.3 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        width: 100% !important;
        text-align: center !important;
    }
    .speaker-card .affil {
        font-size: 11px !important;
        color: #636e72 !important;
        line-height: 1.3 !important;
        margin: 0 0 3px 0 !important;
        display: block !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        width: 100% !important;
        text-align: center !important;
    }
    .speaker-card .country {
        font-size: 11px !important;
        font-weight: 600 !important;
        color: #0077b6 !important;
        line-height: 1.3 !important;
        margin: 0 !important;
        display: block !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        width: 100% !important;
        text-align: center !important;
    }
    
    /* Cards and containers spacing */
    .card, .box, .panel {
        padding: 15px !important;
        margin-bottom: 20px !important;
    }
    
    /* Fix About page logos overflowing on mobile - KEEP ON SAME ROW */
    .about-logos-top {
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        gap: 12px !important;
    }
    .about-logos-top img {
        height: auto !important;
        max-height: 80px !important;
        max-width: 48% !important;
        object-fit: contain !important;
    }

    /* Tables smooth touch scroll */
    table, .table-responsive {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
}
