/*
 * Phone & tablet fixes (Phase 5) — loaded only below 992px (see header.php).
 * Desktop styles are untouched.
 */

/* ---------- Page offset: start content below the fixed ribbon + header ---------- */
/* --site-header-h is measured by header.php (fitBelowHeader) whenever the header changes size. */
html body,
html body.banner-visible {
    padding-top: var(--site-header-h, 150px) !important;
}
.innerbanner_section {
    margin-top: 0 !important;
}
.mainbannerpt {
    top: 0 !important;
}

/* No sideways scrolling, ever. */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}
img, video, iframe, embed {
    max-width: 100%;
}

/* ---------- Offer ribbon: compact ---------- */
.sticky-alert-banner {
    padding: 6px 34px 6px 10px !important;
    font-size: 12px !important;
    line-height: 1.35 !important;
}
.sticky-alert-banner .thunder-icon {
    display: none !important;
}
.sticky-alert-banner #countdown {
    display: inline-flex !important;
    transform: scale(.85);
    transform-origin: left center;
    vertical-align: middle;
}
.sticky-alert-banner .close-alert-banner {
    right: 6px !important;
}

/* ---------- Header ---------- */
.header-container .top-links-wrapper {
    display: none !important; /* same links are in the slide-out menu (.mob-quick-links) */
}
.menu-bar {
    padding-top: 6px !important;
    padding-bottom: 6px !important;
}
.menu-bar .logo {
    max-height: 56px;
    width: auto;
}

/* Slide-out menu: Login / Register / quick links */
.mob-quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    padding: 16px 15px 24px;
    border-top: 1px solid #eee;
    margin-top: 10px;
}
.mob-quick-links .btn {
    flex: 1 1 40%;
    font-size: 14px;
    padding: 8px 10px;
}
.mob-quick-links .btn i {
    margin-right: 6px;
}
.mob-quick-links a:not(.btn) {
    flex: 1 1 100%;
    color: #222;
    font-size: 15px;
    text-decoration: none;
}
.mob-quick-links a:not(.btn) i {
    width: 22px;
    color: #f2761e;
}

/* ---------- Text ---------- */
/* Fully justified text leaves big gaps on narrow screens. */
p[style*="justify"],
li[style*="justify"],
div[style*="justify"],
.instructor-bio {
    text-align: left !important;
}
h1, h2, h3 {
    overflow-wrap: anywhere;
    word-break: normal;
}

/* ---------- Tables: scroll inside their own box instead of being cut off ---------- */
.cp-table-scroll {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}
.cp-table-scroll > table {
    margin-bottom: 0;
    min-width: 520px;
}
/* Course schedule tables stay compact */
.traningtable .cp-table-scroll > table,
.table-body-main .cp-table-scroll > table {
    min-width: 0;
}

/* ---------- Forms: 16px inputs stop iPhone from zooming in ---------- */
input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="search"],
input[type="password"], input[type="date"], select, textarea {
    font-size: 16px !important;
}
.modal-dialog {
    margin: 12px auto;
    max-width: calc(100% - 24px);
}

/* ---------- Floating WhatsApp / phone buttons: smaller, out of the way ---------- */
.btn-floating {
    width: 44px !important;
    height: 44px !important;
    right: 14px !important;
    animation: none !important;
}
.btn-floating img {
    width: 24px;
    height: 24px;
}
.btn-floating.phone {
    bottom: 88px !important;
}
.btn-floating.whatsapp {
    bottom: 140px !important;
}
.btn-floating:hover span {
    display: none !important; /* no hover on touch screens */
}

/* ---------- Course pages: schedule table + price box stack ---------- */
.enroll-details-row {
    flex-direction: column !important;
}
.enroll-details-row .table_section,
.enroll-details-row .payment_section {
    width: 100% !important;
    max-width: 100% !important;
}
.payment_section {
    margin-top: 16px;
}

/* ---------- Instructor page ---------- */
.instructor-profile {
    padding-left: 15px !important;
    padding-right: 15px !important;
}

/* ---------- Homepage slider on tablets: text must fit inside the image ---------- */
@media (min-width: 576px) {
    .mainbannerpt .banner_img img {
        height: 380px !important;
        object-fit: cover;
    }
    .mainbannerpt .carousel-caption {
        padding: 30px 40px 0 !important;
        margin-top: 0 !important;
        line-height: 1.5 !important;
    }
    .mainbannerpt .carousel-caption h1,
    .mainbannerpt .carousel-caption h3 {
        font-size: 28px !important;
        margin-bottom: 10px;
    }
    .mainbannerpt .carousel-caption ul li {
        font-size: 14px !important;
        line-height: 1.5 !important;
    }
    .mainbannerpt .carousel-caption ul li:nth-child(n+4) {
        display: none;
    }
    .mainbannerpt .banner_button {
        margin-top: 16px !important;
    }
}

/* ---------- Phones only ---------- */
@media (max-width: 767.98px) {
    .commansection {
        padding-top: 30px;
        padding-bottom: 30px;
    }
    .section-heading h2 {
        font-size: 26px !important;
        line-height: 1.25;
    }
    .innerbanner_section {
        height: auto !important;
        min-height: 110px;
        padding: 28px 15px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .innerbanner_section h1,
    .innerbanner_section .subtitle_section {
        position: static !important;
        transform: none !important;
        font-size: 24px !important;
        line-height: 1.25 !important;
        margin: 0 !important;
    }

    /* Homepage slider: keep the text inside the image */
    .mainbannerpt .carousel-caption {
        padding: 12px 15px 0 !important;
        line-height: 1.4 !important;
    }
    .mainbannerpt .carousel-caption ul li:nth-child(n+4) {
        display: none; /* first 3 points only on phones */
    }
    .mainbannerpt .banner_button {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    .mainbannerpt .banner_button .btn {
        font-size: 12px !important;
        padding: 6px 10px !important;
    }
    .mainbannerpt .carousel-indicators {
        margin-bottom: 0;
        padding-bottom: 6px !important;
    }

    /* Course batch tables become one card per batch (tap the card to choose it) */
    .table-body-main table,
    .table-body-main tbody,
    .table-body-main tr,
    .table-body-main td {
        display: block;
        width: 100% !important;
    }
    .table-body-main table {
        min-width: 0 !important;
        border: 0;
    }
    .table-body-main thead {
        display: none;
    }
    .table-body-main tbody tr {
        border: 1px solid #e6e6e6;
        border-radius: 10px;
        padding: 12px 14px;
        margin-bottom: 12px;
        background: #fff;
        box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
        cursor: pointer;
    }
    .table-body-main tbody tr.cp-batch-selected {
        border-color: #f2761e;
        box-shadow: 0 0 0 2px rgba(242, 118, 30, .25);
    }
    .table-body-main tbody td {
        border: 0 !important;
        padding: 3px 0 !important;
        text-align: left !important;
    }
    .table-body-main tbody td:first-child {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
    }
    .table-body-main tbody td:first-child input[type="radio"] {
        width: 20px;
        height: 20px;
        margin: 0;
    }
    .table-body-main tbody td:first-child .sold_out {
        display: inline-block;
        width: auto !important;
        height: auto !important;
        margin: 0 !important;
        padding: 2px 10px !important;
        font-size: 12px !important;
        line-height: 1.6 !important;
        border-radius: 20px;
        white-space: nowrap;
    }
    .table-body-main tbody tr:has(.sold_out) {
        opacity: .7;
        cursor: default;
    }
    .table-body-main tbody td:first-child .filling_fast img {
        width: 110px !important;
    }
    .table-body-main tbody td:empty {
        display: none;
    }
    .table-body-main tbody td[colspan] {
        text-align: center !important;
    }

    /* Forms that are 75% wide on desktop (contact, enquire...) use the full width */
    .big-container.w-75,
    .responsive-container-block.w-75 {
        width: 100% !important;
    }
    .form-box {
        width: 100% !important;
    }

    /* Support page timeline cards */
    .timeline-content {
        min-width: 0;
        overflow-wrap: anywhere; /* long email addresses */
    }
    .timeline-box {
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
        flex: 1 1 auto;
    }

    /* Awards ticker: picture on top, text below */
    .rewards-card {
        width: 80vw !important;
        min-width: 80vw !important;
    }
    .rewards-card .panel-body .row {
        flex-direction: column;
        text-align: center;
    }
    .rewards-card .col-sm-4,
    .rewards-card .col-sm-8 {
        max-width: 100%;
        flex: 0 0 100%;
        padding: 0 !important;
    }
    .rewards-card .col-sm-4 {
        margin-bottom: 10px;
    }
    .rewards-card .panel-body img {
        max-height: 120px !important;
    }

    /* Buttons and cards */
    .btn {
        white-space: normal;
    }
    .cp-upcoming-slide {
        padding: 8px 4px;
    }
}
