body {
    font-family: 'Poppins', sans-serif;
    background-color: #0f172a;
    color: #e2e8f0;
    overflow-x: hidden;
}

.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(139, 92, 246, 0.3), 0 10px 10px -5px rgba(139, 92, 246, 0.2);
}

/* Enhanced gradient text with animation */
.gradient-text {
    background: linear-gradient(90deg, #8b5cf6, #ec4899, #f59e0b, #10b981, #8b5cf6);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient 6s ease infinite, text-glow 3s ease-in-out infinite alternate;
}

@keyframes gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(45deg, #8b5cf6, #ec4899);
    opacity: 0.7;
    animation: float 8s ease-in-out infinite;
}

.nav-link {
    position: relative;
    overflow: hidden;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #8b5cf6, #ec4899);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

.skill-bar {
    height: 8px;
    border-radius: 4px;
    background: #334155;
    overflow: hidden;
}

.skill-progress {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, #8b5cf6, #ec4899);
    transition: width 1.5s ease-in-out;
    width: 0%;
}

.anime-character {
    filter: drop-shadow(0 10px 15px rgba(139, 92, 246, 0.3));
}

.heart-beat {
    animation: heartBeat 1.5s ease-in-out infinite;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@keyframes glow {
    0% { box-shadow: 0 0 5px #8b5cf6, 0 0 10px #8b5cf6, 0 0 15px #8b5cf6; }
    100% { box-shadow: 0 0 10px #8b5cf6, 0 0 20px #8b5cf6, 0 0 30px #8b5cf6; }
}

@keyframes slideIn {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Project Items Styles */
.project-item {
    transition: all 0.4s ease;
}

.project-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px -12px rgba(139, 92, 246, 0.25);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.8);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #7c3aed, #db2777);
}

/* Modal Styles */
#project-modal {
    opacity: 0;
    transition: opacity 0.3s ease;
}

#project-modal.show {
    opacity: 1;
}

.modal-content {
    transform: scale(0.7);
    transition: transform 0.3s ease;
}

#project-modal.show .modal-content {
    transform: scale(1);
}

.sticky-image {
    position: sticky;
    top: 0;
    height: 100vh;
}

/* ... các style cũ giữ nguyên ... */

/* ... các style cũ giữ nguyên ... */

/* Modal Styles - COMPLETELY REWRITTEN */
#project-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    display: none;
}

#project-modal.show {
    display: block;
}

#project-modal .modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

#project-modal .modal-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

#project-modal .modal-content {
    background: #1f2937;
    border-radius: 1.5rem;
    max-width: 1200px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s ease;
}

#project-modal.show .modal-content {
    transform: scale(1);
    opacity: 1;
}

#project-modal .modal-scrollable {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    max-height: 90vh;
}

#project-modal .modal-image-container {
    flex: 1;
    background: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border-left: 1px solid #374151;
}

#project-modal .modal-image {
    max-width: 100%;
    max-height: 100%;
    border-radius: 1rem;
    object-fit: contain;
}

#modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

#modal-close:hover {
    background: #ef4444;
    transform: scale(1.1);
}

/* Scrollbar styling */
.modal-scrollable::-webkit-scrollbar {
    width: 6px;
}

.modal-scrollable::-webkit-scrollbar-track {
    background: rgba(139, 92, 246, 0.1);
    border-radius: 3px;
}

.modal-scrollable::-webkit-scrollbar-thumb {
    background: #8b5cf6;
    border-radius: 3px;
}

.modal-scrollable::-webkit-scrollbar-thumb:hover {
    background: #7c3aed;
}

/* Modal content styling */
.modal-section {
    margin-bottom: 2rem;
}

.modal-section h2 {
    color: #8b5cf6;
    font-size: 2rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #8b5cf6;
    padding-bottom: 0.5rem;
}

.modal-section h3 {
    color: #ec4899;
    font-size: 1.5rem;
    margin: 1.5rem 0 1rem 0;
}

.modal-feature {
    background: rgba(139, 92, 246, 0.1);
    padding: 1.25rem;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    border-left: 4px solid #8b5cf6;
}

.modal-feature h4 {
    color: #f59e0b;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-feature p {
    color: #d1d5db;
    line-height: 1.6;
}

.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

.tech-tag {
    background: rgba(139, 92, 246, 0.2);
    color: #8b5cf6;
    padding: 0.5rem 1rem;
    border-radius: 1rem;
    font-size: 0.9rem;
    border: 1px solid rgba(139, 92, 246, 0.3);
    font-weight: 500;
}

.testimonial {
    background: rgba(236, 72, 153, 0.1);
    padding: 1.25rem;
    border-radius: 0.75rem;
    margin: 1rem 0;
    border-left: 4px solid #ec4899;
    font-style: italic;
    color: #d1d5db;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}

.stat-item {
    text-align: center;
    padding: 1.5rem;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 0.75rem;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #8b5cf6;
    display: block;
}

.stat-label {
    color: #9ca3af;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.code-block {
    background: #111827;
    padding: 1.25rem;
    border-radius: 0.75rem;
    margin: 1rem 0;
    overflow-x: auto;
    border: 1px solid #374151;
}

.code-block code {
    color: #e5e7eb;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Responsive design */
@media (max-width: 1024px) {
    #project-modal .modal-content {
        flex-direction: column;
        max-height: 95vh;
    }
    
    #project-modal .modal-image-container {
        border-left: none;
        border-top: 1px solid #374151;
        min-height: 300px;
    }
    
    #project-modal .modal-scrollable {
        max-height: 50vh;
    }
}

@media (max-width: 768px) {
    #project-modal .modal-container {
        padding: 1rem;
    }
    
    #project-modal .modal-scrollable {
        padding: 1.5rem;
        max-height: 60vh;
    }
    
    #project-modal .modal-image-container {
        padding: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-section h2 {
        font-size: 1.75rem;
    }
    
    .modal-section h3 {
        font-size: 1.25rem;
    }
}

/* Prevent body scroll when modal is open */
body.modal-open {
    overflow: hidden;
}
/* ... các style cũ giữ nguyên ... */

/* Video Background Styles */
#video-background video {
    filter: brightness(0.7) contrast(1.2);
}

/* Floating Elements Styles */
.floating-element {
    position: absolute;
    pointer-events: none;
    animation: float 6s ease-in-out infinite;
}

.floating-element.anime {
    font-size: 2rem;
    opacity: 0.7;
    text-shadow: 0 0 10px currentColor;
}

.floating-element.shape {
    border-radius: 50%;
    background: linear-gradient(45deg, var(--color1), var(--color2));
    opacity: 0.4;
    filter: blur(1px);
}

/* New Animations */

/* Anime Icon Colors */

/* Enhanced card hover with video-like effects */
.card-hover {
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.card-hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.1), transparent);
    transition: left 0.6s ease;
}

.card-hover:hover::before {
    left: 100%;
}

.card-hover:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 
        0 20px 25px -5px rgba(139, 92, 246, 0.3),
        0 10px 10px -5px rgba(139, 92, 246, 0.2),
        0 0 30px rgba(139, 92, 246, 0.1);
}

/* Video container styles */
.video-container {
    position: relative;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

.video-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.2));
    pointer-events: none;
}



/* ... phần còn lại của CSS giữ nguyên ... */

/* Loading overlay styles */
#loading-overlay, .loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.45); /* semi-transparent so video can be visible underneath */
    z-index: 9999;
    pointer-events: all;
    opacity: 1; /* explicit starting opacity */
    transition: opacity 900ms ease-in-out; /* unified duration */
}

.loading-text, #loading-text {
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-align: center;
}

/* Hide everything while page is loading; allow only the overlay */
/* Keep the background video visible during loading by excluding its container (#video-background)
   Hide everything else while loading */
body.page-loading > *:not(#loading-overlay):not(#video-background) {
    display: none !important;
}

/* Fade-in video when page finishes loading */
/* Keep the background video visible during loading; transition for gentle changes */
/* Video starts dim while loading and fades to visible when revealing */
#video-background video {
    transition: opacity 900ms ease-in-out;
    opacity: 0.12; /* very dim while loading */
}

/* When revealing, fade video to the intended visible opacity */
body.revealing #video-background video,
body:not(.page-loading) #video-background video {
    opacity: 0.3; /* match the inline opacity-30 used in the HTML */
}

/* Revealing state: fade overlay out and make video visible */
body.revealing #loading-overlay {
    opacity: 0;
    pointer-events: none;
}

/* Soften the main page's video overlay when revealing */
#video-background > div {
    position: absolute;
    inset: 0;
    pointer-events: none;
    transition: opacity 900ms ease, background 900ms ease;
    opacity: 1;
    /* lighten the gradient tint so the video reads brighter after reveal */
    background: linear-gradient(
        90deg,
        rgba(0, 0, 0, 0.28) 0%,
        rgba(20, 6, 23, 0.22) 100%
    );
}

body.revealing #video-background > div {
    opacity: 0.35;
}

/* Make sure animations inside the page are visually paused while overlay is present */
/* end loading overlay styles */
