/* ==================== VARIABLES & GLOBALS ==================== */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text: #f1f5f9;
    --text-muted: #cbd5e1;
    --accent: #06b6d4;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
    /* Tối ưu performance: GPU acceleration */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--background) 0%, #1a1f35 100%);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    /* Tối ưu scroll animation */
    will-change: scroll-position;
}

/* ==================== UTILITY CLASSES ==================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.section-title {
    font-size: 3.5rem;
    text-align: center;
    margin-bottom: 4rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    letter-spacing: -2px;
}

/* ==================== NAVBAR ==================== */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
    padding: 1rem 0;
    transition: all 0.3s ease;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    position: relative;
    transition: color 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.3s ease;
}

.nav-link:hover {
    color: var(--text);
}

.nav-link:hover::after {
    width: 100%;
}

.nav-link.active {
    color: var(--text);
}

.nav-link.active::after {
    width: 100%;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: var(--text);
    margin: 5px 0;
    transition: 0.3s;
}

/* ==================== HERO SECTION ==================== */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-top: 60px;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

#canvas-3d {
    width: 100%;
    height: 100%;
    display: block;
}

.hero-content {
    text-align: center;
    z-index: 10;
    position: relative;
}

.hero-title {
    font-size: 5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.1;
    letter-spacing: -3px;
}

.hero-title .word {
    display: inline-block;
    margin: 0 10px;
    opacity: 0;
    animation: fadeInUp 1s ease forwards;
}

.hero-title .word:nth-child(1) { animation-delay: 0.2s; }
.hero-title .word:nth-child(2) { animation-delay: 0.4s; }
.hero-title .word:nth-child(3) { animation-delay: 0.6s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-subtitle {
    font-size: 1.3rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    animation: fadeInUp 1s ease 0.8s forwards;
    opacity: 0;
}

.cta-button {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    font-size: 1rem;
    animation: fadeInUp 1s ease 1s forwards;
    opacity: 0;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(99, 102, 241, 0.6);
}

.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    animation: bounce 2s infinite;
}

.mouse {
    width: 24px;
    height: 40px;
    border: 2px solid var(--primary);
    border-radius: 12px;
    margin: 10px auto;
    position: relative;
}

.mouse::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 8px;
    background: var(--primary);
    border-radius: 2px;
    animation: scroll 1.5s infinite;
}

@keyframes scroll {
    0% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(15px); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
    40% { transform: translateX(-50%) translateY(-10px); }
    60% { transform: translateX(-50%) translateY(-5px); }
}

/* ==================== ABOUT SECTION ==================== */
.about {
    padding: 6rem 0;
    background: rgba(20, 30, 48, 0.5);
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.about-text {
    animation: slideInLeft 0.8s ease forwards;
    opacity: 1 !important;
}

@keyframes slideInLeft {
    from {
        opacity: 1;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.about-paragraph {
    font-size: 1.15rem;
    margin-bottom: 1.5rem;
    color: var(--text);
    line-height: 1.8;
    font-weight: 400;
    letter-spacing: 0.3px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 2rem;
}

.stat {
    text-align: center;
    padding: 1.5rem;
    background: rgba(99, 102, 241, 0.15);
    border-radius: 10px;
    border: 1px solid rgba(99, 102, 241, 0.35);
    transition: all 0.3s ease;
    cursor: pointer;
    opacity: 1 !important;
    visibility: visible !important;
}

.stat:hover {
    background: rgba(99, 102, 241, 0.2);
    transform: translateY(-5px);
}

.stat h3 {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.stat p {
    color: var(--text);
    font-weight: 500;
}

.about-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.floating-card {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(236, 72, 153, 0.2));
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: float 6s ease-in-out infinite;
    backdrop-filter: blur(10px);
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotateZ(0deg); }
    50% { transform: translateY(-20px) rotateZ(3deg); }
}

.card-inner {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==================== SKILLS SECTION ==================== */
.skills {
    padding: 6rem 0;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.5), rgba(15, 23, 42, 0.5));
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.skill-card {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(99, 102, 241, 0.2);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

.skill-card:hover {
    background: rgba(30, 41, 59, 0.95);
    border-color: var(--primary);
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(99, 102, 241, 0.2);
}

.skill-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    color: var(--primary);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

.skill-card:hover .skill-icon {
    color: var(--secondary);
    transform: scale(1.2) rotate(360deg);
}

.skill-icon i {
    filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.5));
}

.skill-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.skill-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ==================== PROJECTS SECTION ==================== */
.projects {
    padding: 6rem 0;
    background: rgba(20, 30, 48, 0.5);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2.5rem;
}

.project-card {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

.project-card:hover {
    border-color: var(--primary);
    transform: translateY(-10px);
    box-shadow: 0 20px 50px rgba(99, 102, 241, 0.3);
}

.project-image {
    width: 100%;
    height: 250px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.project-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(99, 102, 241, 0.2) 100%);
    pointer-events: none;
}

.cube-3d, .sphere-3d, .torus-3d {
    width: 150px;
    height: 150px;
    position: relative;
    transform-style: preserve-3d;
    animation: rotate3d 8s infinite linear;
}

@keyframes rotate3d {
    from { transform: rotateX(0deg) rotateY(0deg); }
    to { transform: rotateX(360deg) rotateY(360deg); }
}

.cube-3d {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.6);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.sphere-3d {
    background: radial-gradient(circle at 30% 30%, rgba(236, 72, 153, 0.8), var(--primary));
    border-radius: 50%;
    box-shadow: 
        inset -20px -20px 40px rgba(0, 0, 0, 0.5),
        0 0 40px var(--secondary);
}

.torus-3d {
    background: conic-gradient(var(--primary), var(--secondary), var(--primary));
    border-radius: 50%;
    box-shadow: 0 0 30px var(--accent);
    clip-path: circle(50%);
}

.project-content {
    padding: 2rem;
}

.project-content h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.project-content p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.project-tags span {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--primary);
    transition: all 0.3s ease;
}

.project-card:hover .project-tags span {
    background: rgba(99, 102, 241, 0.3);
    border-color: var(--primary);
}

.project-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.project-link {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid var(--primary);
}

.project-link:hover {
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.4);
}

/* ==================== CONTACT SECTION ==================== */
.contact {
    padding: 6rem 0;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.5), rgba(15, 23, 42, 0.5));
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.contact-item {
    padding: 2rem;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.contact-item:hover {
    border-color: var(--primary);
    background: rgba(30, 41, 59, 0.95);
    transform: translateX(10px);
}

.contact-item h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.contact-item p {
    color: var(--text-muted);
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.contact-form input,
.contact-form textarea {
    padding: 1rem;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 10px;
    color: var(--text);
    font-family: inherit;
    transition: all 0.3s ease;
    resize: vertical;
}

.contact-form input::placeholder,
.contact-form textarea::placeholder {
    color: var(--text-muted);
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(30, 41, 59, 0.95);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.submit-button {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

.submit-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(99, 102, 241, 0.6);
}

.submit-button:active {
    transform: translateY(-1px);
}

/* ==================== FOOTER ==================== */
.footer {
    background: rgba(15, 23, 42, 0.95);
    border-top: 1px solid rgba(99, 102, 241, 0.2);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-muted);
    position: relative;
}

.footer p {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.footer strong {
    color: var(--primary);
    font-weight: 700;
}

.website-credit {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.website-link {
    color: var(--secondary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border-bottom: 2px solid var(--secondary);
}

.website-link:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.heart {
    color: var(--secondary);
    animation: heartbeat 1.2s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.social-link {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1.2rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1));
    border: 2px solid var(--primary);
    border-radius: 10px;
    color: var(--primary);
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.95rem;
}

.social-link i {
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.social-link:hover {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-color: transparent;
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

.social-link:hover i {
    transform: scale(1.3);
    animation: bounce 0.6s ease;
}

/* ==================== SCROLL ANIMATIONS ==================== */
[data-scroll] {
    opacity: 0;
    transform: translateY(50px);
}

[data-scroll].in-view {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.8s ease;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .section-title {
        font-size: 2rem;
        margin-bottom: 2rem;
    }

    .floating-card {
        width: 200px;
        height: 200px;
    }

    .card-inner {
        font-size: 1.5rem;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: var(--background);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        gap: 0;
    }

    .nav-menu.active {
        left: 0;
    }

    .hamburger {
        display: flex;
    }

    .about-content,
    .contact-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .skills-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1.5rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .stats {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.8rem;
    }

    .floating-card {
        width: 150px;
        height: 150px;
    }

    .card-inner {
        font-size: 1.2rem;
    }

    .nav-menu {
        gap: 0;
    }

    .nav-link {
        display: block;
        padding: 1rem 0;
    }

    .cta-button {
        padding: 0.8rem 2rem;
        font-size: 0.9rem;
    }

    .section-title {
        font-size: 1.5rem;
    }
}

/* ==================== DROPDOWN MENU ==================== */
.nav-dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 10px;
    list-style: none;
    min-width: 200px;
    margin-top: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
}

.nav-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    padding: 0;
}

.dropdown-menu a {
    display: block;
    padding: 0.8rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}

.dropdown-menu a:hover {
    background: rgba(99, 102, 241, 0.2);
    color: var(--text);
    padding-left: 2rem;
}

.dropdown-menu li:last-child a {
    border-bottom: none;
}

/* ==================== FOOTER QR CODE ==================== */
.footer-qr-box {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 100;
    cursor: pointer;
    transition: all 0.3s ease;
    group: true;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.footer-qr-code {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    border: 2px solid rgba(99, 102, 241, 0.5);
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.3);
}

.footer-qr-text {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
    margin: 0;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer-qr-box:hover .footer-qr-code {
    width: 120px;
    height: 120px;
    border-color: var(--secondary);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.5);
}

.footer-qr-box:hover .footer-qr-text {
    color: var(--secondary);
}

/* ==================== SNOW EFFECT ==================== */
.snowflake {
    position: fixed;
    top: -10px;
    z-index: 1;
    user-select: none;
    cursor: default;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.5em;
    font-family: Arial, sans-serif;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
    animation: snowfall linear infinite;
    pointer-events: none;
}

@keyframes snowfall {
    to {
        transform: translateY(100vh) translateX(0);
        opacity: 0;
    }
}

/* ==================== HEART ANIMATION ==================== */
.floating-heart {
    position: fixed;
    pointer-events: none;
    user-select: none;
    font-size: 2rem;
    color: #ec4899;
    text-shadow: 0 0 10px rgba(236, 72, 153, 0.8);
    z-index: 999;
    animation: float-up 3s ease-out forwards;
}

@keyframes float-up {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-150px) scale(0.5);
    }
}
