/* --- Cấu hình chung & Reset --- */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', sans-serif; }
body { line-height: 1.6; overflow-x: hidden; }
.container { width: 90%; max-width: 1200px; margin: auto; }

/* --- Bài 1: Header Sticky & Navbar --- */
.sticky-header {
    position: sticky; top: 0; background: white; 
    z-index: 1000; box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.navbar {
    display: flex; justify-content: space-between; 
    align-items: center; padding: 15px 5%;
}
.nav-links { display: flex; list-style: none; }
.nav-links li a { 
    text-decoration: none; color: #333; padding: 10px 20px; 
    transition: 0.3s; font-weight: 500;
}
.nav-links li a.active { color: #007bff; border-bottom: 2px solid #007bff; }
.menu-toggle { display: none; cursor: pointer; font-size: 24px; }

/* --- Bài 1: Mobile Menu Animation --- */
@media (max-width: 768px) {
    .menu-toggle { display: block; }
    .nav-links {
        position: fixed; top: 70px; right: -100%; width: 70%; height: 100vh;
        background: white; flex-direction: column; align-items: center;
        transition: 0.5s ease; box-shadow: -5px 0 10px rgba(0,0,0,0.1);
    }
    .nav-links.active { right: 0; }
}

/* --- Bài 2: Hero & Button Animation --- */
.hero {
    height: 80vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('https://picsum.photos/1920/1080');
    background-size: cover; color: white; text-align: center;
}
.btn-animate {
    padding: 12px 30px; border: none; background: #007bff; color: white;
    cursor: pointer; transition: 0.4s; border-radius: 5px; overflow: hidden;
}
.btn-animate:hover { transform: scale(1.1); background: #0056b3; box-shadow: 0 5px 15px rgba(0,123,255,0.4); }

/* --- Bài 2: Card 3D Flip (Services) --- */
.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 30px; padding: 50px 0; }
.service-card { perspective: 1000px; height: 300px; }
.card-inner {
    position: relative; width: 100%; height: 100%; text-align: center;
    transition: transform 0.8s; transform-style: preserve-3d;
}
.service-card:hover .card-inner { transform: rotateY(180deg); }
.card-front, .card-back {
    position: absolute; width: 100%; height: 100%; backface-visibility: hidden;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    border-radius: 10px; padding: 20px; color: white;
}
.card-front { background: #333; }
.card-back { background: #007bff; transform: rotateY(180deg); }

/* --- Bài 4: Floating Label & Form --- */
.form-group { position: relative; margin-bottom: 25px; }
.form-group input, .form-group textarea { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 5px; outline: none; background: none; }
.form-group label { position: absolute; left: 12px; top: 12px; color: #999; transition: 0.3s ease all; pointer-events: none; }
.form-group input:focus ~ label, .form-group input:not(:placeholder-shown) ~ label { top: -20px; font-size: 12px; color: #007bff; font-weight: bold; }

/* --- Bài 5: Masonry & Slider --- */
.masonry-gallery { column-count: 3; column-gap: 15px; }
.masonry-item { display: inline-block; width: 100%; margin-bottom: 15px; border-radius: 8px; overflow: hidden; }
.masonry-item img { width: 100%; display: block; transition: 0.5s; }
.masonry-item:hover img { transform: scale(1.1); }

/* --- UI/UX: Toast & Loader --- */
.toast {
    position: fixed; bottom: -100px; left: 50%; transform: translateX(-50%);
    background: #28a745; color: white; padding: 15px 30px; border-radius: 5px;
    transition: 0.5s; z-index: 9999;
}
.toast.show { bottom: 30px; }
.loader {
    width: 20px; height: 20px; border: 3px solid #f3f3f3; border-top: 3px solid #007bff;
    border-radius: 50%; animation: spin 1s linear infinite; display: none; margin: auto;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
/* Style cho ô nội dung tin nhắn */
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    outline: none;
    background: none;
    resize: vertical; /* Cho phép người dùng kéo giãn chiều cao */
    min-height: 120px;
}

/* Hiệu ứng Floating Label cho cả input và textarea */
.form-group input:focus ~ label, 
.form-group input:not(:placeholder-shown) ~ label,
.form-group textarea:focus ~ label,
.form-group textarea:not(:placeholder-shown) ~ label {
    top: -20px;
    font-size: 12px;
    color: #007bff;
    font-weight: bold;
}/* --- Hiệu ứng Toast (Thông báo nổi) --- */
.toast {
    position: fixed;
    bottom: -100px; /* Ẩn dưới màn hình */
    left: 50%;
    transform: translateX(-50%);
    background-color: #28a745; /* Màu xanh thành công */
    color: white;
    padding: 16px 32px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 10000;
}

.toast.show {
    bottom: 30px; /* Hiện lên */
}

/* --- Hiệu ứng Loading trên nút bấm --- */
#submitBtn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
}

.loader {
    display: none; /* Mặc định ẩn */
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#submitBtn.loading .btn-text {
    display: none; /* Ẩn chữ khi đang load */
}

#submitBtn.loading .loader {
    display: block; /* Hiện vòng xoay */
}