/* --- Reset & Basic Setup --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* --- Các biến màu --- */
:root {
    --primary-color: #4F46E5;
    --secondary-color: #eef2ff;

    --body-bg: #FFFFFF;
    --section-bg: #F9FAFB;
    --card-bg: #FFFFFF;

    --text-dark: #111827;
    --text-gray: #6B7280;
    --text-light: #FFFFFF;

    --border-color: #e0e0e0;
    --shadow-color: rgba(0, 0, 0, 0.05);
}

body[data-theme="dark"] {
    --secondary-color: #312e81;

    --body-bg: #111827;
    --section-bg: #1F2937;
    --card-bg: #374151;

    --text-dark: #F9FAFB;
    --text-gray: #9CA3AF;

    --border-color: #4B5563;
    --shadow-color: rgba(0, 0, 0, 0.2);
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    background-color: var(--body-bg);
    color: var(--text-dark);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style-type: none;
}

/* --- Header & Navbar --- */
.header {
    background-color: var(--primary-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar {
    display: flex;
    align-items: center;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-logo .logo-icon {
    stroke: var(--text-light);
}

.nav-logo svg.logo-icon {
    width: 160px;
    /* Điều chỉnh kích thước chiều rộng logo tại đây */
    height: auto;
    /* Tự động điều chỉnh chiều cao để giữ tỷ lệ */
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-grow: 1;
    justify-content: center;
}

.nav-item {
    position: relative;
}

.nav-link {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--text-light);
}

/* --- Các nút điều khiển mới --- */
.header-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    /* Đẩy về bên phải */
}

.theme-toggle-btn,
.login-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.85);
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle-btn:hover,
.login-btn:hover {
    color: var(--text-light);
}

.theme-toggle-btn .moon-icon {
    display: none;
}

.theme-toggle-btn .sun-icon {
    display: block;
}

body[data-theme="dark"] .theme-toggle-btn .moon-icon {
    display: block;
}

body[data-theme="dark"] .theme-toggle-btn .sun-icon {
    display: none;
}


.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-block;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--text-light);
}

.btn-primary:hover {
    background-color: #4338CA;
}

.hamburger {
    display: none;
    cursor: pointer;
    margin-left: 0.5rem;
}

.bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    transition: all 0.3s ease-in-out;
    background-color: var(--text-light);
}

/* --- Dropdown Menu Styles --- */
.dropdown-toggle {
    cursor: pointer;
}

.dropdown-menu {
    position: absolute;
    top: 150%;
    left: 0;
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 8px 24px var(--shadow-color);
    min-width: 180px;
    padding: 0.5rem 0;
    z-index: 101;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, top 0.3s ease, background-color 0.3s ease;
}

.dropdown-menu li a {
    color: var(--text-gray);
    display: block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.dropdown-menu li a:hover {
    background-color: var(--secondary-color);
    color: var(--primary-color);
    transform: translateX(5px);
}

.dropdown.active>.dropdown-menu {
    opacity: 1;
    visibility: visible;
    top: 100%;
}

/* --- Hero Section --- */
.hero {
    padding: 6rem 0;
    background-color: var(--body-bg);
    overflow: hidden;
}

.hero-container {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.hero-text {
    flex: 1;
}

.hero-text h1 {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
}

.hero-text p {
    font-size: 1.1rem;
    color: var(--text-gray);
    margin-bottom: 2.5rem;
    max-width: 500px;
}

.hero-buttons {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.contact-info span {
    display: block;
    font-weight: 600;
    color: var(--text-dark);
}

.contact-info small {
    color: var(--text-gray);
}

.hero-image-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.hero-image {
    width: 450px;
    height: 450px;
    position: relative;
    z-index: 2;
}

.hero-image::before {
    content: '';
    position: absolute;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    background-color: var(--primary-color);
    border-radius: 45% 55% 60% 40% / 40% 45% 55% 60%;
    z-index: -1;
    animation: morph 8s ease-in-out infinite;
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

@keyframes morph {
    0% {
        border-radius: 45% 55% 60% 40% / 40% 45% 55% 60%;
    }

    50% {
        border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    }

    100% {
        border-radius: 45% 55% 60% 40% / 40% 45% 55% 60%;
    }
}

/* --- Services & Tools Section --- */
.services {
    padding: 5rem 0;
    background-color: var(--body-bg);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    margin-bottom: 5rem;
}

.service-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 4px 12px var(--shadow-color);
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.service-icon {
    height: 64px;
    width: 64px;
    margin-bottom: 1.5rem;
    transition: filter 0.3s ease, fill 0.3s ease;
}

.service-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    transition: color 0.3s ease;
}

.service-card p {
    color: var(--text-gray);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    transition: color 0.3s ease;
}

.read-more {
    color: var(--text-gray);
    font-weight: 500;
    text-decoration: underline;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.service-card:hover {
    transform: translateY(-5px);
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.service-card:hover .service-icon {
    filter: brightness(0) invert(1);
    fill: #FFFFFF;
}

.service-card:hover h3,
.service-card:hover p,
.service-card:hover .read-more {
    color: var(--text-light);
}


.tools-header {
    position: relative;
    background-color: #374151;
    color: var(--text-light);
    text-align: center;
    padding: 0.75rem;
    width: 300px;
    margin: 0 auto;
    font-weight: 600;
    z-index: 1;
}

.tools-header::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-top: 10px solid #1F2937;
}

.tools-header::before {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 0;
    width: 0;
    height: 0;
    border-right: 15px solid transparent;
    border-top: 10px solid #1F2937;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1px;
    background-color: var(--border-color);
    border: 1px solid var(--border-color);
    padding: 0;
    margin-top: -1px;
    border-radius: 8px;
    overflow: hidden;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.tool-item {
    background-color: var(--section-bg);
    padding: 1.5rem 0.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-gray);
    transition: background-color 0.3s ease, color 0.3s ease;
    cursor: pointer;

    /* --- ↓ Thêm các dòng này để căn chỉnh đồng bộ ↓ --- */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.tool-item img {
    height: 32px;
    margin-bottom: 0.5rem;
    transition: filter 0.3s ease;
}

.tool-item:hover {
    background-color: var(--primary-color);
    color: var(--text-light);
}

.tool-item:hover img {
    filter: brightness(0) invert(1);
}


/* --- Footer --- */
.footer {
    background-color: var(--section-bg);
    color: var(--text-gray);
    font-size: 0.95rem;
}

.footer-main {
    padding: 5rem 0;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 2fr;
    gap: 3rem;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.footer-logo svg.logo-icon {
    width: 120px;
    height: auto;
}

.footer-description {
    margin-bottom: 1.5rem;
}

.social-icons {
    display: flex;
    gap: 1rem;
}

.social-icons a {
    color: var(--text-gray);
    transition: color 0.3s ease;
}

.social-icons a:hover {
    color: var(--primary-color);
}

.footer-col h4 {
    color: var(--text-dark);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.footer-col ul li {
    margin-bottom: 0.75rem;
}

.footer-col ul a {
    transition: color 0.3s ease;
}

.footer-col ul a:hover {
    color: var(--primary-color);
}

.footer-col p {
    margin-bottom: 1.5rem;
}

.newsletter-form {
    position: relative;
}

.newsletter-form input {
    width: 100%;
    padding: 0.9rem 3rem 0.9rem 1rem;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    background-color: var(--body-bg);
    color: var(--text-dark);
}

.newsletter-form button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--primary-color);
    color: var(--text-light);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.footer-bottom {
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.footer-bottom-links {
    display: flex;
    gap: 1.5rem;
}

.footer-bottom-links a:hover {
    color: var(--primary-color);
}


/* --- Scroll Top Button --- */
.scroll-top-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    background-color: var(--primary-color);
    color: var(--text-light);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

.scroll-top-btn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}


/* --- Responsive Design --- */
@media(max-width: 992px) {
    .navbar {
        justify-content: space-between;
    }

    .header-controls {
        display: none;
    }

    .nav-menu {
        flex-grow: 0;
        justify-content: flex-start;
    }

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

    .hero-text h1 {
        font-size: 2.8rem;
    }

    .hero-text p {
        margin-left: auto;
        margin-right: auto;
    }

    .hero-buttons {
        justify-content: center;
        flex-direction: column;
        gap: 1.5rem;
    }

    .hero-image-wrapper {
        margin-top: 3rem;
    }

    .hero-image {
        width: 350px;
        height: 350px;
    }

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

    .tools-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media(max-width: 768px) {
    /* === START: CẢI THIỆN GIAO DIỆN MOBILE === */

    /* Giảm khoảng cách dọc của các section */
    .hero,
    .services {
        padding-top: 3.5rem;
        padding-bottom: 3.5rem;
    }

    .footer-main {
        padding: 3.5rem 0;
    }

    /* Tối ưu hóa phông chữ và khoảng cách cho Section Hero */
    .hero-text h1 {
        font-size: 2.5rem;
        /* Tăng kích thước để dễ đọc hơn */
        line-height: 1.3;
    }

    .hero-text p {
        font-size: 1rem;
        /* Giảm nhẹ để cân đối hơn */
        margin-bottom: 2rem;
    }

    .hero-image {
        width: 300px;
        height: 300px;
    }

    /* Điều chỉnh khoảng cách các card khi xếp chồng */
    .services-grid {
        gap: 1.5rem;
    }

    .services-grid {
        grid-template-columns: 1fr;
    }

    /* Điều chỉnh tiêu đề và lưới công cụ */
    .tools-header {
        width: 90%;
        /* Cho phép co giãn theo màn hình */
    }

    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Cải thiện footer trên mobile */
    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2.5rem;
    }

    .footer-col h4 {
        margin-bottom: 1rem;
    }

    .social-icons {
        justify-content: center;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
    }

    /* === END: CẢI THIỆN GIAO DIỆN MOBILE === */

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: var(--card-bg);
        width: 100%;
        text-align: left;
        transition: 0.3s;
        box-shadow: 0 10px 27px var(--shadow-color);
        gap: 0;
    }

    .nav-menu .nav-link {
        color: var(--text-gray);
    }

    .nav-menu .nav-link:hover {
        color: var(--primary-color);
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-item {
        width: 100%;
    }

    .nav-link {
        display: block;
        padding: 1.25rem 1.5rem;
    }

    .nav-link:hover {
        background-color: var(--section-bg);
    }

    .hamburger {
        display: block;
    }

    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        box-shadow: none;
        border-radius: 0;
        min-width: 100%;
        padding: 0;
        display: none;
    }

    .dropdown.active .dropdown-menu {
        display: block;
    }

    .dropdown-menu li a {
        padding-left: 3rem;
        background-color: var(--section-bg);
    }

    .dropdown-menu li a:hover {
        background-color: var(--secondary-color);
    }
}