/**
 * EUC Client — Responsive (mobile / tablet / laptop)
 * Load sau euc-theme.css
 */

/* ── Offcanvas (Bootstrap theme cũ thiếu style) ── */
#eucMobileMenu.offcanvas {
    position: fixed;
    bottom: 0;
    z-index: 1045;
    display: flex;
    flex-direction: column;
    max-width: 100%;
    visibility: hidden;
    background-color: #fff;
    background-clip: padding-box;
    outline: 0;
    transition: transform 0.3s ease-in-out;
}

#eucMobileMenu.offcanvas-end {
    top: 0;
    right: 0;
    left: auto;
    width: min(320px, 88vw);
    height: 100%;
    height: 100dvh;
    transform: translateX(100%);
    border-left: 1px solid rgba(0, 0, 0, 0.08);
}

#eucMobileMenu.offcanvas.show {
    visibility: visible;
    transform: translateX(0);
}

.offcanvas-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
    background-color: rgba(0, 0, 0, 0.45);
    transition: opacity 0.15s linear;
}

.offcanvas-backdrop.fade {
    opacity: 0;
}

.offcanvas-backdrop.show {
    opacity: 1;
}

#eucMobileMenu .offcanvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #eee;
}

#eucMobileMenu .offcanvas-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

#eucMobileMenu .offcanvas-body {
    flex-grow: 1;
    padding: 1.25rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#eucMobileMenu .offcanvas-body a {
    color: #081828;
    text-decoration: none;
    font-weight: 500;
}

#eucMobileMenu .offcanvas-body a:hover {
    color: #417de6;
}

#eucMobileMenu .btn-close {
    box-sizing: content-box;
    width: 1em;
    height: 1em;
    padding: 0.25em;
    color: #000;
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") center / 1em auto no-repeat;
    border: 0;
    border-radius: 0.25rem;
    opacity: 0.6;
    cursor: pointer;
}

/* ── Base & viewport safety ── */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html,
body {
    overflow-x: hidden;
    max-width: 100%;
}

/* Header sticky — không cần padding-top giả (CSS cũ ecommerce) */
body {
    padding-top: 0 !important;
}

img,
video,
iframe,
svg,
table {
    max-width: 100%;
}

img,
video,
iframe {
    height: auto;
}

/* Tránh zoom iOS khi focus input */
@media (max-width: 767.98px) {
    input,
    select,
    textarea,
    .form-control {
        font-size: 16px !important;
    }
}

/* ── Container & spacing ── */
@media (max-width: 1199.98px) {
    .container {
        max-width: 100%;
        padding-left: 20px;
        padding-right: 20px;
    }
}

@media (max-width: 767.98px) {
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    .section {
        padding-top: 40px;
        padding-bottom: 40px;
    }

    .breadcrumbs {
        padding: 20px 0;
    }

    .breadcrumbs .page-title {
        font-size: 1.35rem !important;
        margin-bottom: 8px;
    }

    .breadcrumbs .breadcrumb-nav {
        justify-content: flex-start !important;
        flex-wrap: wrap;
        gap: 4px;
    }
}

/* ── Header: laptop (992–1366) ── */
@media (min-width: 992px) and (max-width: 1366px) {
    .euc-header__bar {
        gap: 0.65rem;
        min-height: 64px;
    }

    .euc-header__logo {
        height: 44px;
        max-width: 150px;
    }

    .euc-header__nav {
        flex-wrap: nowrap;
        gap: 0;
    }

    .euc-header__nav a {
        padding: 0.45rem 0.55rem;
        font-size: 0.86rem;
        white-space: nowrap;
    }

    .euc-header__nav a.is-active::after {
        left: 0.55rem;
        right: 0.55rem;
    }

    .euc-header__actions {
        gap: 0.4rem;
    }

    .euc-header__phone {
        padding: 0.35rem 0.6rem;
        font-size: 0.8rem;
    }

    .euc-header__btn {
        padding: 0.4rem 0.7rem !important;
        font-size: 0.82rem !important;
    }
}

/* Ẩn hotline trên laptop hẹp để tránh tràn */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .euc-header__phone {
        display: none !important;
    }

    .euc-header__btn-logout span {
        display: none;
    }

    .euc-header__btn-logout {
        padding: 0.4rem 0.55rem !important;
    }
}

/* ── Header: tablet & mobile (<992) ── */
@media (max-width: 991.98px) {
    .euc-header__bar {
        min-height: 60px;
        gap: 0.75rem;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .euc-header__logo {
        height: 42px;
        max-width: 140px;
    }

    /* Ẩn menu ngang + nút đăng nhập desktop */
    .euc-header__nav {
        display: none !important;
    }

    .euc-header__actions .euc-header__desktop-auth {
        display: none !important;
    }

    .euc-header__menu-btn {
        display: inline-flex !important;
        width: 40px;
        height: 40px;
        min-height: 40px;
        padding: 0 !important;
    }
}

/* Khóa scroll khi mở menu mobile */
body.euc-menu-open {
    overflow: hidden;
}

@media (max-width: 575.98px) {
    .euc-header__bar {
        min-height: 56px;
        padding-top: 0.4rem;
        padding-bottom: 0.4rem;
    }

    .euc-header__logo {
        height: 38px;
        max-width: 120px;
    }

    .euc-header__phone {
        display: none !important;
    }
}

/* ── Footer ── */
@media (max-width: 767.98px) {
    .euc-footer__main {
        padding: 2.5rem 0 2rem;
    }

    .euc-footer__logo {
        height: 48px;
    }

    .euc-footer__bottom-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* ── Blog ── */
@media (max-width: 991.98px) {
    .blog-section.blog-list .col-lg-8 {
        margin-bottom: 8px;
    }

    .blog-section.blog-list .sidebar {
        margin-top: 8px;
    }

    .blog-section.blog-list .widget {
        padding: 20px;
    }
}

/* ── Liên hệ & giới thiệu ── */
@media (max-width: 767.98px) {
    .contact-hero:not(.euc-page-banner) {
        padding: 48px 0 56px !important;
    }

    .contact-hero h1 {
        font-size: 1.5rem !important;
    }

    .contact-hero .breadcrumb-nav {
        justify-content: flex-start !important;
        margin-top: 12px;
    }

    .contact-cards {
        margin-top: -24px !important;
    }

    .contact-hero.euc-page-banner + .contact-cards {
        margin-top: 0 !important;
    }

    .contact-form-box,
    .contact-map-wrap {
        padding: 20px 16px !important;
    }

    .contact-map-wrap iframe,
    .contact-map-placeholder {
        height: 260px !important;
    }

    .about-hero:not(.euc-page-banner),
    .euc-about-hero:not(.euc-page-banner),
    .euc-programs-hero:not(.euc-programs-hero--banner-only):not(.euc-page-banner),
    .euc-blog-hero:not(.euc-page-banner) {
        padding: 48px 0 56px !important;
    }

    .about-hero h1,
    .euc-about-hero__title {
        font-size: 1.5rem !important;
    }
}

/* ── Exam pages ── */
@media (max-width: 767.98px) {
    .euc-exam-take__top {
        position: sticky;
        top: 56px;
        z-index: 20;
        background: #f8f9fa;
        padding: 0.75rem 0;
        margin: 0 -16px 1rem;
        padding-left: 16px;
        padding-right: 16px;
        border-bottom: 1px solid #e5e7eb;
    }

    .euc-exam-take__timer {
        width: 100%;
        text-align: center;
    }

    .euc-page-hero {
        padding: 2rem 0 !important;
    }

    .euc-page-hero h1 {
        font-size: 1.45rem;
    }

    .euc-exam-submit-btn {
        width: 100%;
    }
}

/* ── Tables ── */
@media (max-width: 767.98px) {
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
    }

    .table-responsive .table {
        font-size: 13px;
        min-width: 480px;
    }

    .table-responsive .table th,
    .table-responsive .table td {
        padding: 10px 8px;
        white-space: nowrap;
    }
}

/* ── Touch targets & floating widgets ── */
@media (max-width: 767.98px) {
    .btn {
        min-height: 42px;
        padding: 10px 16px;
    }

    .scroll-top {
        width: 44px !important;
        height: 44px !important;
        line-height: 44px !important;
        bottom: 130px !important;
        right: 16px !important;
    }

    #chat-widget-container {
        bottom: 70px !important;
        right: 12px !important;
    }

    /* Mobile fullscreen chat do layout JS — không ép width nhỏ */
    #chat-btn {
        width: 52px !important;
        height: 52px !important;
    }

    #euc-support-widget,
    .euc-support {
        bottom: 12px !important;
        right: 12px !important;
    }

    .euc-support__toggle-text {
        display: none;
    }

    .euc-support__toggle {
        width: 52px;
        height: 52px;
        padding: 0 !important;
        justify-content: center;
        border-radius: 50% !important;
    }
}

/* ── Pagination & modal ── */
@media (max-width: 575.98px) {
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px;
    }

    .pagination .page-link {
        padding: 8px 12px;
        font-size: 13px;
    }

    .modal-dialog {
        margin: 12px;
        max-width: calc(100% - 24px);
    }
}

/* ── Carousel overflow ── */
@media (max-width: 991.98px) {
    .tns-outer {
        overflow: hidden;
    }
}

/* ── Landscape phone ── */
@media (max-height: 500px) and (orientation: landscape) {
    .euc-hero__carousel,
    .euc-hero__carousel .carousel-inner,
    .euc-hero__carousel .carousel-item,
    .euc-hero__slide {
        height: auto !important;
        min-height: 0 !important;
        max-height: 70vh;
    }

    .euc-hero__media {
        position: static !important;
        width: 100%;
        height: auto !important;
        max-height: 70vh;
        object-fit: contain;
    }

    .euc-header__bar {
        min-height: 48px;
        padding-top: 0.25rem;
        padding-bottom: 0.25rem;
    }
}
