/* ==========================================================================
   Mediplus Fixed ISO Certification Marquee Bar & Detail Modal
   Scoped with .mp-iso-* prefix to avoid conflicts with Bootstrap/theme CSS.
   ========================================================================== */

:root {
    --mp-iso-height: 46px;
    --mp-iso-top-offset: 0px;
    --mp-iso-duration: 34s;
}

@media (max-width: 767px) {
    :root {
        --mp-iso-height: 40px;
    }
}

/* Ẩn ngay nếu người dùng đã đóng thanh trên trình duyệt */
html.mp-iso-bar-hidden .mp-iso-bar {
    display: none !important;
}

/* Chừa khoảng trống đầu trang & đồng bộ header sticky hiện có của theme */
body.has-mp-iso-bar {
    padding-top: var(--mp-iso-height);
}

@media (min-width: 768px) {
    body.has-mp-iso-bar .mediHeader {
        top: calc(var(--mp-iso-height) + var(--mp-iso-top-offset));
    }
}

@media (max-width: 767px) {
    body.has-mp-iso-bar .mediHeader.show {
        top: calc(var(--mp-iso-height) + var(--mp-iso-top-offset));
    }
}

/* Khi mở menu trượt mobile, đảm bảo menu phủ lên trên thanh thông báo */
body.has-mp-iso-bar .menuMobile.open {
    z-index: 1060;
}

/* Thanh thông báo fixed đầu trang (Gradient xanh đồng bộ màu Mediplus & ISOCERT) */
.mp-iso-bar {
    position: fixed;
    top: var(--mp-iso-top-offset);
    left: 0;
    right: 0;
    z-index: 1050;
    height: var(--mp-iso-height);
    display: flex;
    align-items: center;
    overflow: hidden;
    background: linear-gradient(90deg, #132A63 0%, #173874 35%, #005594 72%, #1A6AA6 100%);
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 3px 14px rgba(19, 42, 99, 0.24);
    font-family: 'Roboto', 'Bai Jamjuree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.3;
    box-sizing: border-box;
}

.mp-iso-bar *,
.mp-iso-modal * {
    box-sizing: border-box;
}

/* Vùng chạy chữ */
.mp-iso-viewport {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 22px, #000 calc(100% - 22px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 22px, #000 calc(100% - 22px), transparent);
}

.mp-iso-viewport:focus-visible {
    outline: 2px solid #5AB6E7;
    outline-offset: -2px;
}

.mp-iso-track {
    display: flex;
    align-items: center;
    width: max-content;
    will-change: transform;
    animation: mpIsoMarqueeScroll var(--mp-iso-duration) linear infinite;
}

.mp-iso-bar:hover .mp-iso-track,
.mp-iso-bar:focus-within .mp-iso-track {
    animation-play-state: paused;
}

@keyframes mpIsoMarqueeScroll {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(-50%, 0, 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .mp-iso-track {
        animation-duration: 90s;
    }
}

.mp-iso-group {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 20px;
    padding-right: 20px;
    white-space: nowrap;
}

/* Badge nền trắng đảm bảo khoảng trống nhận diện (clear space) cho logo ISO */
.mp-iso-logo {
    background-color: #ffffff;
    border-radius: 5px;
    padding: 3px 7px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.16);
    border: 1px solid rgba(23, 56, 116, 0.14);
}

.mp-iso-logo img {
    height: 22px;
    width: auto;
    max-width: none;
    display: block;
    object-fit: contain;
}

@media (max-width: 767px) {
    .mp-iso-group {
        gap: 14px;
        padding-right: 14px;
    }
    .mp-iso-logo {
        height: 26px;
        padding: 2px 6px;
    }
    .mp-iso-logo img {
        height: 19px;
    }
}

.mp-iso-text {
    font-size: 13.5px;
    letter-spacing: 0.01em;
    white-space: nowrap;
    color: #ffffff;
}

.mp-iso-text--primary {
    font-weight: 500;
}

.mp-iso-text--secondary {
    font-weight: 400;
    opacity: 0.94;
}

.mp-iso-highlight {
    font-weight: 700;
    color: #ffffff;
    text-decoration: underline;
    text-decoration-color: #5AB6E7;
    text-underline-offset: 3px;
    text-decoration-thickness: 1.5px;
}

.mp-iso-sep {
    opacity: 0.55;
    user-select: none;
    font-size: 12px;
}

@media (max-width: 767px) {
    .mp-iso-text {
        font-size: 12.5px;
    }
}

/* Khu vực nút bên phải thanh chạy */
.mp-iso-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px 0 8px;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.mp-iso-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.mp-iso-cta:hover,
.mp-iso-cta:focus-visible {
    background-color: rgba(255, 255, 255, 0.26);
    border-color: rgba(255, 255, 255, 0.5);
    color: #ffffff;
    outline: none;
}

.mp-iso-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.mp-iso-close:hover,
.mp-iso-close:focus-visible {
    background-color: rgba(0, 0, 0, 0.22);
    color: #ffffff;
    outline: none;
}

@media (max-width: 575px) {
    .mp-iso-cta {
        display: none;
    }
    .mp-iso-actions {
        padding: 0 8px 0 4px;
    }
}

/* ==========================================================================
   Modal chi tiết chứng nhận ISO (độc lập, không phụ thuộc Bootstrap JS)
   ========================================================================== */
.mp-iso-modal {
    position: fixed;
    inset: 0;
    z-index: 1070;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background-color: rgba(15, 23, 42, 0.62);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    font-family: 'Roboto', 'Bai Jamjuree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.mp-iso-modal.is-open {
    display: flex;
}

.mp-iso-modal__dialog {
    background-color: #ffffff;
    border-radius: 20px;
    width: 100%;
    max-width: 780px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.32);
    border: 1px solid #e2e8f0;
    color: #1e293b;
}

.mp-iso-modal__header {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: rgba(255, 255, 255, 0.96);
    padding: 18px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.mp-iso-modal__eyebrow {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #005594;
    margin-bottom: 2px;
}

.mp-iso-modal__title {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    color: #173874;
    line-height: 1.3;
}

.mp-iso-modal__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.mp-iso-modal__close:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}

.mp-iso-modal__body {
    padding: 22px 24px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

@media (max-width: 767px) {
    .mp-iso-modal__header {
        padding: 14px 18px;
    }
    .mp-iso-modal__title {
        font-size: 16px;
    }
    .mp-iso-modal__body {
        grid-template-columns: 1fr;
        padding: 16px 18px;
        gap: 16px;
    }
}

.mp-iso-cert-card {
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 18px;
    background-color: #f8fafc;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
}

.mp-iso-cert-card__logo-box {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-bottom: 14px;
}

.mp-iso-cert-card__logo-box img {
    height: 62px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

.mp-iso-cert-card__meta {
    margin-top: 10px;
    font-size: 12px;
    color: #475569;
    line-height: 1.45;
}

.mp-iso-cert-card__meta strong {
    color: #173874;
}

.mp-iso-cert-card__submeta {
    font-size: 11px;
    color: #64748b;
}

.mp-iso-cert-card__heading {
    margin: 0 0 8px;
    font-size: 15.5px;
    font-weight: 700;
    color: #173874;
    line-height: 1.35;
}

.mp-iso-cert-card__desc {
    margin: 0;
    font-size: 13px;
    color: #475569;
    line-height: 1.6;
}

.mp-iso-cert-card__verify {
    font-size: 12px;
    color: #475569;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    line-height: 1.5;
}

.mp-iso-modal__footer {
    padding: 14px 24px;
    background-color: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
}

.mp-iso-modal__btn {
    padding: 9px 20px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(90deg, #173874 0%, #005594 100%);
    color: #ffffff;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.mp-iso-modal__btn:hover {
    opacity: 0.92;
}
