/* ==========================================================================
   ĐÔNG Y GIA TRUYỀN THẾ LONG - RESPONSIVE STYLESHEET
   Tối ưu hiển thị hoàn hảo trên Tablet, iPad và Điện thoại thông minh
   ========================================================================== */

/* --- 1. TABLET & IPAD (Max width: 992px) --- */
@media (max-width: 992px) {
    .section {
        padding: 38px 0;
    }

    .section-title {
        font-size: 2rem;
    }

    /* Topbar */
    .topbar-container {
        flex-direction: column;
        gap: 6px;
        text-align: center;
    }

    .topbar-left, .topbar-right {
        justify-content: center;
        flex-wrap: wrap;
        gap: 12px;
    }

    /* Navigation Mobile Drawer */
    .mobile-toggle {
        display: block;
    }

    .btn-search-header {
        padding: 8px 14px;
        font-size: 0.88rem;
    }

    .navbar {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--bg-white);
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
        padding: 80px 24px 30px 24px;
        transition: right 0.35s ease;
        z-index: 999;
        overflow-y: auto;
        visibility: hidden;
        pointer-events: none;
    }

    .navbar.active {
        right: 0 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    .navbar .nav-list {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        width: 100%;
    }

    .navbar .nav-item {
        width: 100%;
    }

    .navbar .nav-link {
        width: 100%;
        padding: 12px 16px;
        border-radius: var(--radius-md);
        font-size: 1.05rem;
    }

    /* Hero Banner Slider Tablet */
    .hero {
        padding: 30px 0 0 0;
    }

    .hero-slide {
        padding: 20px 0 40px 0;
    }

    .hero-container {
        grid-template-columns: 1fr;
        gap: 35px;
        text-align: center;
    }

    .hero-badge {
        margin-left: auto;
        margin-right: auto;
    }

    .hero-desc {
        margin-left: auto;
        margin-right: auto;
    }

    .hero-title .highlight-gold-frame {
        padding: 6px 28px;
        margin: 8px auto 0 auto;
    }

    .hero-buttons {
        justify-content: center;
    }

    .hero-visual {
        max-width: 520px;
        margin: 0 auto;
        text-align: left;
    }

    .hero-bottom-container {
        flex-direction: column;
        gap: 18px;
    }

    .hero-stats {
        justify-content: center;
        flex-wrap: wrap;
        width: 100%;
        gap: 18px;
    }

    .hero-nav-arrow {
        width: 40px;
        height: 40px;
        font-size: 0.95rem;
    }

    .hero-prev-arrow {
        left: 8px;
    }

    .hero-next-arrow {
        right: 8px;
    }

    /* About Section */
    .about-grid {
        grid-template-columns: 1fr;
        gap: 50px;
    }

    .about-images {
        max-width: 500px;
        margin: 0 auto;
    }

    .about-text {
        text-align: justify;
        text-justify: inter-word;
    }

    /* Contact Section */
    .contact-box {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    /* Gallery Split Layout Tablet */
    .gallery-split-layout {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .media-prev-arrow {
        left: 8px;
    }

    .media-next-arrow {
        right: 8px;
    }

    .img-box {
        height: 240px;
    }

    .video-box {
        height: 300px;
    }

    /* Testimonials Slider Tablet */
    .testimonial-slide {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .testimonial-slider-wrapper {
        padding: 0 35px;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
    }
}

/* --- 2. MOBILE PHONE (Max width: 768px) --- */
@media (max-width: 768px) {
    .section {
        padding: 32px 0;
    }

    .topbar {
        display: none; /* Ẩn topbar trên mobile để màn hình gọn gàng */
    }

    .logo-title {
        font-size: 0.98rem;
        white-space: nowrap;
    }

    .logo-icon {
        width: 38px;
        height: 38px;
        font-size: 1.2rem;
    }

    .logo-subtitle {
        font-size: 0.6rem;
    }

    /* Hero Banner Slider Mobile */
    .hero {
        padding: 20px 0 0 0;
    }

    .hero-slide {
        padding: 10px 0 35px 0;
    }

    .hero-title {
        font-size: 1.55rem;
        line-height: 1.25;
        text-align: center;
        margin-left: auto;
        margin-right: auto;
    }

    .hero-title-top {
        font-size: 1.55rem;
        white-space: normal;
        text-align: center;
    }

    .hero-title .highlight-gold-frame {
        padding: 6px 22px;
        margin: 8px auto 0 auto;
        max-width: 95%;
    }

    .hero-title .highlight-gold-frame::before {
        left: 8px;
        font-size: 0.8rem;
    }

    .hero-title .highlight-gold-frame::after {
        right: 8px;
        font-size: 0.8rem;
    }

    .hero-title .highlight-gold {
        font-size: 1.25rem;
        white-space: normal;
        text-align: center;
    }

    .hero-badge {
        font-size: 1.05rem;
        padding: 8px 18px;
        margin-bottom: 16px;
    }

    .hero-desc {
        font-size: 0.95rem;
        line-height: 1.65;
        margin-bottom: 24px;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .hero-buttons .btn {
        width: 100%;
        justify-content: center;
    }

    .hero-card-featured {
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.35);
    }

    .hero-card-img {
        height: 190px;
    }

    .hero-card-body {
        padding: 18px;
    }

    .hero-card-body h4 {
        font-size: 1.15rem;
    }

    .hero-nav-arrow {
        display: none; /* Trên mobile người dùng lướt vuốt tay mượt mà */
    }

    .hero-bottom-bar {
        padding: 14px 0;
    }

    .hero-bottom-container {
        gap: 14px;
    }

    .hero-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        width: 100%;
    }

    .stat-item {
        gap: 8px;
    }

    .stat-icon {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }

    .stat-number {
        font-size: 1.15rem;
    }

    .stat-label {
        font-size: 0.68rem;
    }

    .stat-divider {
        display: none;
    }

    /* About Section */
    .img-wrapper.main-img {
        width: 100%;
    }

    .img-wrapper.main-img img {
        height: 320px;
    }

    .img-wrapper.sub-img {
        display: none; /* Ẩn ảnh nhỏ để layout đơn giản, nhẹ nhàng hơn */
    }

    .about-highlights {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .about-action {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Media Set Slider Mobile */
    .media-slider-wrapper {
        padding: 0;
    }

    .media-slider-viewport {
        padding: 0;
    }

    .slide-badge-topic {
        padding: 10px 14px;
        font-size: 0.85rem;
    }

    .slide-top-images {
        gap: 4px;
        padding: 4px 4px 0 4px;
    }

    .slide-bottom-video {
        padding: 4px;
    }

    .img-box {
        height: 165px;
    }

    .video-box {
        height: 220px;
    }

    .media-nav-arrow {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }

    .media-prev-arrow {
        left: 6px;
    }

    .media-next-arrow {
        right: 6px;
    }

    /* Grid Sections */
    .remedies-grid,
    .why-grid,
    .news-grid {
        grid-template-columns: 1fr;
    }

    /* Testimonial Slider Mobile */
    .testimonial-slide {
        flex: 0 0 100%;
        max-width: 100%;
        padding: 0 8px;
    }

    .testimonial-slider-wrapper {
        padding: 0 5px;
    }

    .slider-arrow {
        width: 38px;
        height: 38px;
        font-size: 0.9rem;
    }

    .prev-arrow {
        left: -10px;
    }

    .next-arrow {
        right: -10px;
    }

    .testi-customer-img-box {
        height: 160px;
    }

    .contact-form-wrap {
        padding: 26px 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 35px;
    }

    .footer-bottom-flex {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    /* Floating action buttons */
    .floating-actions {
        bottom: 20px;
        right: 15px;
        gap: 10px;
    }

    .float-btn {
        width: 46px;
        height: 46px;
        font-size: 1.15rem;
    }

    .float-tooltip {
        display: none;
    }
}

/* --- 3. SMALL MOBILE (Max width: 480px) --- */
@media (max-width: 480px) {
    .section-title {
        font-size: 1.75rem;
    }

    .hero-title {
        font-size: 1.45rem;
    }

    .hero-title .highlight-gold-frame {
        padding: 5px 14px;
        border-width: 1.5px;
    }

    .hero-title .highlight-gold-frame::before,
    .hero-title .highlight-gold-frame::after {
        display: none;
    }

    .hero-title .highlight-gold {
        font-size: 1.15rem;
        white-space: normal;
    }

    .hero-badge {
        font-size: 0.95rem;
        padding: 7px 16px;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }

    .hero-buttons .btn {
        width: 100%;
    }

    .modal-box {
        padding: 24px 18px;
    }

    .gallery-action-btns {
        flex-direction: column;
        gap: 10px;
    }

    .gallery-action-btns .btn {
        width: 100%;
    }

    .remedy-filters {
        gap: 6px;
    }

    .filter-btn {
        padding: 8px 14px;
        font-size: 0.82rem;
    }

    .logo-title {
        font-size: 0.86rem;
    }

    .logo-icon {
        width: 34px;
        height: 34px;
        font-size: 1.05rem;
    }
}

/* ==========================================================================
   TỐI ƯU HÓA RESPONSIVE DI ĐỘNG TOÀN DIỆN (CHỐNG TRÀN VIỀN 100%)
   ========================================================================== */
html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    position: relative;
}

/* Đảm bảo hình ảnh và video không bao giờ vượt quá kích thước màn hình */
img, video, iframe, canvas, svg {
    max-width: 100% !important;
    height: auto;
}

/* Đảm bảo bảng không bao giờ tràn màn hình điện thoại */
table {
    max-width: 100% !important;
}

/* Đảm bảo kích thước tối thiểu cho nút bấm trên màn hình cảm ứng di động (Touch Target) */
button, .btn, .nav-link, .float-btn {
    min-height: 40px;
    touch-action: manipulation;
}

@media (max-width: 768px) {
    .header-action {
        gap: 8px;
    }
    .btn-search-header {
        width: 38px;
        height: 38px;
        min-height: 38px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
    }
    .btn-search-header span {
        display: none !important;
    }
    .mobile-toggle {
        width: 38px;
        height: 38px;
        min-height: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding-left: 14px !important;
        padding-right: 14px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .header-container {
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .logo {
        gap: 8px;
        max-width: calc(100% - 90px);
        overflow: hidden;
    }

    .logo-icon {
        width: 34px !important;
        height: 34px !important;
        font-size: 1rem !important;
        flex-shrink: 0;
    }

    .logo-text {
        overflow: hidden;
    }

    .logo-title {
        font-size: 0.88rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        line-height: 1.2;
    }

    .logo-motto {
        font-size: 0.58rem !important;
        letter-spacing: 0.3px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    
    .hero-title-main, .hero-title {
        font-size: 1.4rem !important;
        line-height: 1.3 !important;
    }
    
    .hero-buttons {
        flex-direction: column !important;
        width: 100% !important;
    }
    
    .hero-buttons .btn {
        width: 100% !important;
        justify-content: center !important;
    }
    
    .topbar-left span {
        display: block;
        margin-bottom: 4px;
    }

    .hero-slider-container,
    .media-slider-container,
    .testimonial-slider-container {
        overflow: hidden !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .hero-container,
    .media-container,
    .testimonial-container {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Tối ưu toast social proof trên di động: không che nút bấm, tự ẩn khi mở modal */
    #thelong-social-proof-toast {
        left: 12px !important;
        right: 12px !important;
        bottom: 85px !important;
        max-width: calc(100% - 24px) !important;
        font-size: 0.82rem !important;
        padding: 8px 12px !important;
    }
}

/* Ẩn toast khi mở bất kỳ modal nào để không che form */
body.modal-open #thelong-social-proof-toast,
body.modal-open .toast {
    display: none !important;
}

/* Viewport siêu nhỏ (320px - iPhone 5/SE gen 1) */
@media (max-width: 340px) {
    .logo-title {
        font-size: 0.78rem !important;
    }
    .hero-title-main, .hero-title {
        font-size: 1.25rem !important;
    }
    .btn {
        padding: 8px 12px !important;
        font-size: 0.85rem !important;
    }
}

/* ==========================================================================
   RESPONSIVE FIX: Trust Badge Bar, Floating Buttons, Header
   ========================================================================== */

/* --- Trust Badge Bar: Thu gọn trên Tablet --- */
@media (max-width: 992px) {
    #trust-badge-bar {
        font-size: 12px !important;
    }
    #trust-badge-bar div {
        gap: 16px !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
    #trust-badge-bar span[style*="font-size:15px"],
    #trust-badge-bar span[style*="font-size: 15px"] {
        font-size: 13px !important;
    }
    #trust-badge-bar span[style*="font-size:14px"],
    #trust-badge-bar span[style*="font-size: 14px"] {
        font-size: 12px !important;
    }
}

/* --- Trust Badge Bar: Thu gọn tối đa trên Mobile --- */
@media (max-width: 768px) {
    #trust-badge-bar {
        font-size: 11.5px !important;
    }
    #trust-badge-bar > div {
        gap: 10px !important;
        padding: 7px 10px !important;
        flex-wrap: wrap;
        justify-content: center;
    }
    #trust-badge-bar span[style*="opacity:0.35"] {
        display: none !important; /* Ẩn dấu | phân cách trên mobile để tiết kiệm chỗ */
    }
    #trust-badge-bar span[style*="border-radius:20px"] {
        padding: 4px 12px !important;
        font-size: 11.5px !important;
    }
}

/* --- Floating Buttons (Zalo, Phone, Chat): Không đè lên nội dung --- */
@media (max-width: 768px) {
    /* Đẩy sticky CTA bar lên đủ cao để floating buttons không bị che */
    .sticky-cta-bar {
        padding: 8px 12px !important;
        gap: 8px !important;
    }
    .sticky-cta-bar .btn {
        font-size: 0.82rem !important;
        padding: 9px 12px !important;
        flex: 1;
        text-align: center;
        justify-content: center;
    }
    /* Thu nhỏ floating action buttons trên mobile */
    .fab-wrapper,
    .floating-actions,
    [class*="float-btn"],
    [class*="fab-"] {
        bottom: 75px !important;
    }
}

/* --- Header: Ẩn text "Tìm Kiếm" trên màn hình rất nhỏ, chỉ giữ icon --- */
@media (max-width: 480px) {
    .btn-search-header span {
        display: none;
    }
    .btn-search-header {
        padding: 8px 12px !important;
        min-width: unset;
    }
    /* Tăng kích thước hamburger để dễ bấm hơn */
    .mobile-toggle {
        width: 42px !important;
        height: 42px !important;
        font-size: 1.2rem !important;
    }
}

/* --- Đường kẻ vàng trang trí: Full width trên mọi thiết bị --- */
@media (max-width: 992px) {
    .hero-bottom-bar {
        padding: 4px 0 0 0 !important;
    }
}
