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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    flex-wrap: wrap;
    gap: 1rem;
}

.avatar img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #007bff;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

nav a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: color 0.3s;
}

nav a:hover {
    color: #007bff;
}

/* Dark mode toggle */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #007bff;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #007bff, #00d4ff);
    color: white;
    text-align: center;
    padding: 100px 0;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.highlight {
    background: rgba(255,255,255,0.2);
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
}

.tagline {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.btn {
    display: inline-block;
    background: white;
    color: #007bff;
    padding: 0.8rem 1.5rem;
    text-decoration: none;
    border-radius: 30px;
    font-weight: bold;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    border: none;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* About Section */
.about {
    padding: 80px 0;
    background: white;
}

.about h2, .projects h2, .contact h2 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
}

.about-content {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
}

.about-text {
    flex: 2;
}

.skills {
    flex: 1;
    background: #f4f4f4;
    padding: 1.5rem;
    border-radius: 10px;
}

.skill-tags span {
    display: inline-block;
    background: #007bff;
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    margin: 0.3rem;
    font-size: 0.9rem;
}

/* Projects */
.projects {
    background: #f9f9f9;
    padding: 80px 0;
}

.filter-buttons {
    text-align: center;
    margin-bottom: 2rem;
}

.filter-btn {
    background: transparent;
    border: 2px solid #007bff;
    color: #007bff;
    padding: 0.5rem 1rem;
    margin: 0.25rem;
    cursor: pointer;
    border-radius: 30px;
    transition: all 0.3s;
    font-weight: bold;
}

.filter-btn.active, .filter-btn:hover {
    background: #007bff;
    color: white;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.project-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.project-card:hover {
    transform: translateY(-5px);
}

.project-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.project-info {
    padding: 1.5rem;
}

.project-info h3 {
    margin-bottom: 0.5rem;
}

.btn-small {
    display: inline-block;
    margin-top: 1rem;
    background: #007bff;
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-small:hover {
    background: #0056b3;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #fff;
    padding: 2rem;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    position: relative;
    animation: slideDown 0.3s ease;
    transition: background 0.3s;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
}

.close-modal:hover {
    color: #333;
}

@keyframes slideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Dark mode overrides */
body.dark {
    background: #1e1e2f;
    color: #f4f4f4;
}

body.dark header {
    background: #2a2a40;
}

body.dark nav a {
    color: #f4f4f4;
}

body.dark .about,
body.dark .contact,
body.dark .project-card,
body.dark .modal-content {
    background: #2a2a40;
    color: #f4f4f4;
}

body.dark .skills {
    background: #1e1e2f;
}

body.dark .filter-btn {
    border-color: #f4f4f4;
    color: #f4f4f4;
}

body.dark .filter-btn.active,
body.dark .filter-btn:hover {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

body.dark .close-modal {
    color: #ccc;
}

body.dark .close-modal:hover {
    color: white;
}

/* Contact Form */
.contact-info {
    text-align: center;
    margin-bottom: 2rem;
}

.contact-info i {
    margin-right: 0.5rem;
    color: #007bff;
}

form {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

input, textarea {
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: inherit;
    background: white;
    color: #333;
}

body.dark input,
body.dark textarea {
    background: #3a3a50;
    border-color: #555;
    color: #f4f4f4;
}

/* Footer */
footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 1.5rem 0;
}

body.dark footer {
    background: #111;
}

/* Responsive */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        text-align: center;
    }
    nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }
    .about-content {
        flex-direction: column;
    }
    .hero h1 {
        font-size: 2rem;
    }
}
/* ========== PROJECTS SECTION ========== */
.projects {
    background: #f9f9f9;
    padding: 80px 0;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;  /* QUAN TRỌNG: căn giữa container */
}

/* Filter buttons – căn giữa */
.filter-btns {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filter-btn {
    background: transparent;
    border: 2px solid #007bff;
    color: #007bff;
    padding: 0.5rem 1.2rem;
    cursor: pointer;
    border-radius: 30px;
    font-weight: bold;
    transition: all 0.3s;
}

.filter-btn.active,
.filter-btn:hover {
    background: #007bff;
    color: white;
}

/* Project grid – lưới tự động căn giữa */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    justify-content: center; /* căn giữa lưới nếu số cột ít */
}

.project-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s;
    color: #333;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-5px);
}

.project-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.project-info {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.project-info h3 {
    margin-bottom: 0.5rem;
    color: #000;
}

.project-info p {
    margin-bottom: 1rem;
    flex: 1;
}

.btn-small {
    align-self: flex-start;
    background: #007bff;
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.3s;
    text-decoration: none;
    display: inline-block;
}

/* Dark mode cho phần projects */
body.dark .projects {
    background: #1e1e2f;
}

body.dark .project-card {
    background: #2a2a40;
    color: #f4f4f4;
}

body.dark .project-card h3 {
    color: #fff;
}

body.dark .filter-btn {
    border-color: #f0f0f0;
    color: #f0f0f0;
}

body.dark .filter-btn.active,
body.dark .filter-btn:hover {
    background: #007bff;
    border-color: #007bff;
    color: white;
}