/* =========================================================
   RESPONSIVE LAYOUT (NO OVERLAP / "KHÔNG AI CHẠM AI")
   ========================================================= */

/* Global fix to prevent horizontal scroll (khoảng dư bên phải) */
body {
    overflow-x: hidden !important;
    max-width: 100%;
    width: 100%;
}

/* Global Responsive Fixes (<= 1024px) */
@media (max-width: 1024px) {
    nav a.active::before {
        display: none !important;
    }
    
    .scroll-indicator {
        display: none !important;
    }
}

/* Hide Hamburger by Default */
.hamburger-btn {
    display: none;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 101;
}

/* Mobile Nav Overlay styling */
nav.mobile-open {
    display: flex !important;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    z-index: 100;
}

nav.mobile-open a {
    padding: 15px 20px;
    font-size: 1.1rem;
    width: 100%;
    text-align: center;
}

/* Mobile specific <= 768px layout */
@media (max-width: 768px) {
    .header-container {
        position: relative;
        display: grid !important;
        grid-template-columns: 1fr auto 1fr !important;
        align-items: center !important;
    }

    .hamburger-btn {
        display: block;
        justify-self: start;
    }

    .header-container > .logo {
        justify-self: center;
    }

    .header-actions {
        justify-self: end !important;
        display: flex;
    }


    /* Hide standard nav */
    nav:not(.mobile-open) {
        display: none !important;
    }
}

/* Medium Tablet / iPad (<= 820px) Tweaks */
@media (max-width: 820px) {
    /* Convert Discord btn to icon */
    .discord-btn span {
        display: none;
    }

    .discord-btn {
        padding: 0 !important;
        width: 36px !important;
        height: 36px !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    .discord-btn i {
        margin: 0 !important;
        font-size: 1.1rem;
    }
}

/* 1. Large Tablet / Small Desktop (821px - 1024px) */
@media (min-width: 821px) and (max-width: 1024px) {
    .container {
        padding: 0 15px;
    }

    nav {
        gap: 30px;
    }

    .hero-content {
        flex-direction: column;
        text-align: center;
        gap: 30px;
    }

    .hero-left {
        max-width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .hero-left h1 {
        font-size: 3.5rem;
    }

    .hero-buttons {
        justify-content: center;
    }

    .hero-3d-slider {
        width: 100%;
        height: 450px;
        margin-top: 20px;
    }

    .services-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .service-card.bento-featured {
        grid-column: 1 / -1;
        display: flex;
        flex-direction: row;
        align-items: stretch;
        text-align: left;
        width: 95%;
        justify-self: center;
    }

    .service-card.bento-featured .service-img {
        width: 40%;
        height: 100%;
        margin-bottom: 0;
        padding-right: 0px !important;
        display: flex;
        align-items: stretch;
    }

    .service-card.bento-featured .service-img img {
        width: 100%;
        object-fit: cover;
        border-radius: 0px;
        display: block;
    }

    .service-card.bento-featured .service-content {
        width: 50%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 20px 30px;
    }

    .service-card.bento-featured .service-title {
        margin-bottom: 10px;
        font-size: 1.5rem;
    }

    .service-card.bento-featured .service-desc {
        margin-bottom: 15px;
        font-size: 1rem;
    }

    .service-card.bento-featured .service-features {
        margin-bottom: 20px;
    }

    .service-card.bento-featured .service-features li {
        margin-bottom: 10px;
        font-size: 0.95rem;
    }

    .service-card.bento-featured .btn-wrapper {
        margin-top: 15px !important;
    }

    .benchmark-3d-wrapper {
        height: 400px;
    }

    .desc {
        font-size: 1.5rem !important;
    }
}

/* 2. Tablet (769px - 820px) */
@media (min-width: 769px) and (max-width: 820px) {
    .container {
        padding: 0 15px;
    }

    .header-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
    }

    nav {
        gap: 15px;
        flex-wrap: nowrap;
        justify-content: center;
    }

    nav a {
        font-size: 0.9rem;
    }

    .header-actions {
        gap: 10px;
        transform: scale(0.9); /* Slightly scale down buttons to save space */
    }

    .hero-content {
        flex-direction: column;
        text-align: center;
        margin-top: 40px;
    }

    .hero-left {
        max-width: 100%;
    }

    .hero-left h1 {
        font-size: 2.6rem;
    }

    .hero-buttons {
        justify-content: center;
    }

    .hero-3d-slider {
        width: 100%;
        height: 400px;
        margin-top: 40px;
    }

    .services-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .benchmark-3d-wrapper {
        height: 380px;
    }

    .footer-top {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        align-items: center;
        text-align: left;
    }

    .footer-actions {
        justify-content: flex-end;
    }

    .footer-actions {
        max-width: 250px;
    }

    .footer-top {
        gap: 90px !important;
    }
}

/* 3. Small Tablet & Large Mobile (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    header {
        padding: 15px 0;
    }

    .header-container {
        /* Layout handled by global mobile hamburger rules */
        gap: 10px;
    }

    nav {
        /* Layout handled by global mobile hamburger rules */
    }

    .header-actions {
        /* Layout handled by global mobile hamburger rules */
    }

    .hero-section {
        padding-top: 150px;
    }

    .hero-content {
        flex-direction: column;
        text-align: center;
    }

    .hero-left {
        max-width: 100%;
        text-align: center;
        left: 50%;
        right: 50%;
        justify-content: center;
    }

    .hero-left h1 {
        font-size: 2.2rem;
    }

    .hero-buttons {
        flex-direction: row;
        justify-content: center;
        gap: 15px;
        width: 100%;
    }

    .hero-buttons .btn {
        width: auto;
        margin-top: 0;
        font-size: 0.9rem;
        padding: 12px 20px;
        text-align: center;
        white-space: nowrap;
    }

    .hero-buttons .btn i {
        margin-right: 8px;
    }

    .hero-3d-slider {
        width: 100%;
        height: 350px;
        margin-top: 30px;
    }

    .services-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .benchmark-3d-wrapper {
        height: 320px;
        margin-bottom: 80px;
    }

    .slider-bottom-right {
        bottom: -80px;
        right: 0;
        align-items: center;
        width: 100%;
    }

    .footer-top {
        flex-direction: column;
        text-align: center;
        gap: 30px;
    }

    .footer-actions {
        flex-direction: column;
        align-items: center;
    }

    .service-card.bento-featured .service-content {
        padding: 40px 30px;
    }
}

/* 4. Mobile (361px - 480px) */
@media (min-width: 361px) and (max-width: 480px) {
    .container {
        padding: 0 10px;
    }

    header {
        padding: 10px 0;
    }

    .header-container {
        /* Handled by global */
    }

    nav {
        /* Handled by global */
    }

    .header-actions {
        /* Handled by global */
    }

    .header-actions .btn {
        width: auto;
    }

    .hero-section {
        padding-top: 160px;
    }

    .hero-content {
        flex-direction: column;
        text-align: center;
    }

    .hero-left {
        max-width: 100%;
    }

    .hero-left h1 {
        font-size: 1.8rem;
    }

    .hero-left .desc {
        font-size: 1rem;
    }

    .hero-buttons {
        flex-direction: row;
        justify-content: center;
        gap: 10px;
        width: 100%;
    }

    .hero-buttons .btn {
        width: auto;
        margin-top: 0;
        font-size: 0.8rem;
        padding: 10px 15px;
        text-align: center;
        white-space: nowrap;
    }

    .hero-3d-slider {
        width: 100%;
        height: 280px;
        margin-top: 20px;
    }

    .section-title h2 {
        font-size: 2rem;
    }

    .services-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .benchmark-3d-wrapper {
        height: 250px;
        margin-bottom: 80px;
    }

    .slider-bottom-right {
        bottom: -70px;
        right: 0;
        align-items: center;
        width: 100%;
    }

    .footer-top {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }

    .footer-actions {
        flex-direction: column;
        align-items: center;
    }

    .service-card.bento-featured .service-content {
        padding: 20px 0px;
    }
}

/* 5. Small Mobile (max-width: 360px) */
@media (max-width: 360px) {
    .container {
        padding: 0 10px;
    }

    header {
        padding: 10px 0;
    }

    .header-container {
        flex-direction: column;
        gap: 8px;
    }

    .logo-img {
        height: 30px;
    }

    .logo-text {
        font-size: 1.2rem;
    }

    nav {
        gap: 8px;
        flex-direction: column;
        align-items: center;
        font-size: 0.85rem;
    }

    .header-actions {
        flex-direction: column;
        width: 100%;
    }

    .header-actions .btn {
        width: 100%;
    }

    .hero-section {
        padding-top: 180px;
    }

    .hero-content {
        flex-direction: column;
        text-align: center;
    }

    .hero-left h1 {
        font-size: 1.5rem;
    }

    .hero-left .desc {
        font-size: 0.9rem;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }

    .hero-buttons .btn {
        width: 100%;
        margin-top: 10px;
        font-size: 0.9rem;
    }

    .hero-3d-slider {
        width: 100%;
        height: 220px;
        margin-top: 15px;
    }

    .section-title h2 {
        font-size: 1.8rem;
    }

    .services-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .benchmark-3d-wrapper {
        height: 200px;
        margin-bottom: 80px;
    }

    .slider-bottom-right {
        bottom: -70px;
        right: 0;
        align-items: center;
        width: 100%;
    }

    .footer-top {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }

    .footer-actions {
        flex-direction: column;
        align-items: center;
    }

    .cta-title {
        font-size: 1.8rem;
    }
}

/* 5. Extra Small Mobile (<= 460px) Tweaks */
@media (max-width: 460px) {
    .logo-img {
        width: 25px !important;
    }
    .logo-text {
        font-size: 1.1rem !important;
    }
    .logo {
        gap: 5px !important;
    }
    .header-actions {
        gap: 10px !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
    }
    .lang-btn {
        padding: 4px 6px !important;
        font-size: 0.75rem !important;
    }
}