:root {
    --primary: #2563eb;
    --dark: #0f172a;
    --accent: #ef4444;
    --white: #ffffff;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }
body { overflow-x: hidden; background: #f8fafc; opacity: 0; transition: opacity 1s ease; }
body.fade-in { opacity: 1; }

/* --- Bài 2: Preloader --- */
#loader {
    position: fixed; top: 0; width: 100%; height: 100%;
    background: var(--dark); z-index: 9999;
    display: flex; flex-direction: column; justify-content: center; align-items: center; color: white;
}
.spinner {
    width: 40px; height: 40px; border: 4px solid #333;
    border-top: 4px solid var(--primary); border-radius: 50%;
    animation: spin 1s linear infinite; margin-bottom: 10px;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

/* --- Chữ chạy báo giảm giá --- */
.discount-bar { background: var(--accent); color: white; padding: 10px 0; overflow: hidden; white-space: nowrap; }
.marquee-text {
    display: inline-block; animation: marquee 15s linear infinite; font-weight: bold;
}
@keyframes marquee { 0% { transform: translateX(100%); } 100% { transform: translateX(-100%); } }

/* --- Bài 1: Sticky Header & Active Underline --- */
.main-header { position: sticky; top: 0; background: white; z-index: 1000; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
.nav-container { display: flex; justify-content: space-between; padding: 1.2rem 5%; align-items: center; max-width: 1200px; margin: 0 auto; }
.nav-links { display: flex; list-style: none; gap: 2rem; }
.nav-links a { 
    text-decoration: none; color: var(--dark); font-weight: 600; 
    position: relative; padding: 5px 0; transition: 0.3s;
}
.nav-links a::after {
    content: ''; position: absolute; bottom: 0; left: 0;
    width: 0; height: 2px; background: var(--primary); transition: 0.3s;
}
.nav-links a.active::after { width: 100%; }
.nav-links a.active { color: var(--primary); }

/* --- Bài 2: 3D Flip Card --- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 2rem; padding: 2rem 0; }
.pc-card { height: 400px; perspective: 1000px; }
.card-inner {
    position: relative; width: 100%; height: 100%;
    transition: transform 0.8s; transform-style: preserve-3d;
}
.pc-card:hover .card-inner { transform: rotateY(180deg); }
.card-front, .card-back {
    position: absolute; width: 100%; height: 100%;
    backface-visibility: hidden; border-radius: 15px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px;
}
.card-front { background: white; box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
.card-back { background: var(--primary); color: white; transform: rotateY(180deg); text-align: center; }
.card-front img { width: 100%; height: 200px; object-fit: cover; border-radius: 10px; margin-bottom: 15px; }

/* --- Bài 3: Scroll Reveal --- */
.reveal { opacity: 0; transform: translateY(40px); transition: all 0.8s ease-out; }
.reveal.active { opacity: 1; transform: translateY(0); }

.hero { height: 60vh; background: var(--dark); color: white; display: flex; align-items: center; justify-content: center; text-align: center; }
/* Layout cho trang liên hệ */
.contact-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 50px;
}

/* Floating Label Logic */
.form-group { position: relative; margin-bottom: 30px; }
.form-group input, .form-group textarea {
    width: 100%; padding: 15px; border: 1px solid #ddd; border-radius: 8px;
    outline: none; background: transparent; transition: 0.3s;
}
.form-group label {
    position: absolute; left: 15px; top: 15px; color: #999;
    transition: 0.3s; pointer-events: none;
}
.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: -12px; left: 10px; font-size: 12px; color: var(--primary);
    background: #fff; padding: 0 5px; font-weight: bold;
}

/* Validation Style */
.error-msg { color: #ef4444; font-size: 11px; display: none; margin-top: 5px; }
input:invalid:not(:placeholder-shown) { border-color: #ef4444; }
input:invalid:not(:placeholder-shown) ~ .error-msg { display: block; }

/* Nút Submit & Loading */
.btn-submit {
    width: 100%; padding: 15px; background: var(--dark); color: white;
    border: none; border-radius: 8px; cursor: pointer; font-weight: bold;
    position: relative; overflow: hidden; transition: 0.3s;
}
.btn-submit:hover { background: var(--primary); transform: translateY(-3px); }

.loading span { opacity: 0; }
.loading::after {
    content: ""; position: absolute; width: 20px; height: 20px;
    top: 50%; left: 50%; margin: -10px;
    border: 3px solid rgba(255,255,255,0.3); border-top-color: #fff;
    border-radius: 50%; animation: spin 0.8s linear infinite;
}
/* --- TRẠNG THÁI MẶC ĐỊNH (ẨN) --- */
.reveal-product {
    opacity: 0;
    transform: translateY(50px) scale(0.9); /* Đẩy xuống 50px và thu nhỏ 90% */
    transition: all 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
    visibility: hidden;
}

/* --- TRẠNG THÁI KHI CUỘN TỚI (HIỆN) --- */
.reveal-product.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
}

/* --- HIỆU ỨNG ĐUỔI NHAU (STAGGER DELAY) --- */
/* Sản phẩm thứ 1 hiện ngay lập tức */
.reveal-product.active:nth-child(1) { transition-delay: 0.1s; }
/* Sản phẩm thứ 2 trễ 0.2s */
.reveal-product.active:nth-child(2) { transition-delay: 0.2s; }
/* Sản phẩm thứ 3 trễ 0.3s */
.reveal-product.active:nth-child(3) { transition-delay: 0.3s; }
/* Sản phẩm thứ 4 trễ 0.4s */
.reveal-product.active:nth-child(4) { transition-delay: 0.4s; }
/* ... bạn có thể thêm tiếp n-child nếu có nhiều sản phẩm hơn */

/* Hiệu ứng bổ sung khi hover vào card đã hiện */
.pc-card:hover {
    box-shadow: 0 20px 40px rgba(37, 99, 235, 0.2);
    border: 1px solid var(--primary);
}
/* --- FOOTER STYLES --- */
.main-footer {
    background: var(--dark);
    color: #cbd5e1;
    padding: 70px 0 20px;
    margin-top: 80px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
}

.footer-col .logo {
    color: var(--white);
    display: block;
    margin-bottom: 20px;
}

.footer-col h4 {
    color: var(--white);
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 10px;
}

.footer-col h4::after {
    content: '';
    position: absolute;
    left: 0; bottom: 0;
    width: 40px; height: 2px;
    background: var(--primary);
}

.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 12px; }

.footer-col ul li a {
    color: #94a3b8;
    text-decoration: none;
    transition: 0.3s;
}

.footer-col ul li a:hover {
    color: var(--primary);
    padding-left: 5px;
}

/* Form đăng ký ở Footer */
.footer-subscribe {
    display: flex;
    margin-top: 15px;
}

.footer-subscribe input {
    padding: 10px;
    border: none;
    border-radius: 4px 0 0 4px;
    outline: none;
    width: 100%;
}

.footer-subscribe button {
    padding: 10px 15px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-weight: bold;
}

/* Footer Bottom */
.footer-bottom {
    text-align: center;
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid #1e293b;
    font-size: 13px;
    color: #64748b;
}

/* Social Icons Placeholder */
.social-links { display: flex; gap: 15px; margin-top: 20px; }
.social-links a {
    width: 35px; height: 35px;
    background: #1e293b;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; color: white; text-decoration: none;
    transition: 0.3s;
}
.social-links a:hover { background: var(--primary); transform: translateY(-3px); }