/* =========================================================
   01. DESIGN TOKENS & VARIABLES
========================================================= */
:root {
    --color-primary: #0d6efd;
    --color-primary-dark: #0a58ca;
    --color-bg: #ffffff;
    --color-bg-muted: #f8fafc;
    --color-surface: #ffffff;
    --color-text: #374151;
    --color-heading: #111827;
    --color-muted: #6b7280;
    --color-border: #e5e7eb;
    --color-dark: #111827;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 16px;
    --radius-pill: 999px;

    --shadow-sm: 0 8px 25px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 15px 35px rgba(0, 0, 0, 0.08);

    --section-space: 90px;
    --transition: 0.3s ease;
}

/* =========================================================
   02. RESET & BASE STYLES
========================================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    width: 100%;
    overflow-x: hidden;
    scroll-behavior: smooth;
    scroll-padding-top: 90px;
}

body {
    margin: 0;
    width: 100%;
    overflow-x: hidden;
    font-family: "Inter", sans-serif;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.7;
    transition: background-color var(--transition), color var(--transition);
}

img,
svg,
video,
canvas,
iframe {
    display: block;
    max-width: 100%;
    height: auto;
}

a {
    text-decoration: none;
    color: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

p,
h1,
h2,
h3,
h4,
h5,
h6,
span,
a,
strong {
    overflow-wrap: anywhere;
}

/* =========================================================
   03. LAYOUT & REUSABLE COMPONENTS
========================================================= */
.container {
    width: 100%;
    margin-inline: auto;
    padding-inline: 16px;
}

.section {
    padding: var(--section-space) 0;
}

.section-muted {
    background: var(--color-bg-muted);
}

.section-heading {
    max-width: 700px;
}

.section-eyebrow {
    margin-bottom: 8px;
    color: var(--color-primary);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1.2px;
}

.section-heading h2 {
    position: relative;
    display: inline-block;
    margin: 0;
    color: var(--color-heading);
}

.section-heading h2::after {
    content: "";
    display: block;
    width: 50px;
    height: 4px;
    margin-top: 10px;
    background: var(--color-primary);
    border-radius: var(--radius-pill);
}

/* Common Card Base */
.info-card,
.skill-card,
.timeline-content,
.project-card,
.contact-form-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    min-width: 0;
}

.info-card,
.skill-card,
.contact-form-card,
.timeline-content {
    padding: 30px;
}

.skill-card,
.project-card,
.contact-info-item,
.certification-item {
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

/* =========================================================
   04. NAVIGATION
========================================================= */
.navbar {
    padding: 16px 0;
}

.navbar .nav-link {
    position: relative;
    margin-left: 20px;
    font-weight: 500;
    transition: color var(--transition);
}

.navbar .nav-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 2px;
    width: 0;
    height: 2px;
    background: var(--color-primary);
    transition: width var(--transition);
}

.navbar .nav-link:hover::after,
.navbar .nav-link.active::after {
    width: 100%;
}

.theme-toggle,
.print-cv,
.language-toggle {
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-pill);
    font-weight: 500;
    transition: transform var(--transition), background-color var(--transition);
}

.theme-toggle {
    width: 40px;
    padding: 0;
}

.print-cv {
    gap: 7px;
    padding: 0 15px;
}

.language-toggle {
    min-width: 58px;
    gap: 6px;
}

.theme-toggle:hover,
.print-cv:hover,
.language-toggle:hover {
    transform: translateY(-2px);
}

/* =========================================================
   05. HERO SECTION
========================================================= */
.hero-section {
    min-height: 80vh;
    display: flex;
    align-items: center;
    padding: 100px 0;
    background: radial-gradient(circle at top right, rgba(13, 110, 253, 0.12), transparent 35%);
}

.hero-avatar-column {
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-avatar {
    width: 245px;
    height: 350px;
    object-fit: cover;
    border: 8px solid #ffffff;
    transition: transform 0.4s ease;
}

.hero-avatar:hover {
    transform: scale(1.03);
}

.typing-cursor {
    display: inline-block;
    margin-left: 3px;
    color: var(--color-primary);
    font-weight: 700;
    animation: blink 0.8s infinite;
}

@keyframes blink {

    0%,
    49% {
        opacity: 1;
    }

    50%,
    100% {
        opacity: 0;
    }
}

/* =========================================================
   06. SKILLS & TIMELINE
========================================================= */
.skill-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.skill-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.skill-header h3 {
    margin: 0;
    flex: 1;
}

.skill-header span {
    color: var(--color-primary);
    font-weight: 700;
    white-space: nowrap;
}

.progress {
    height: 8px;
    background: #e5e7eb;
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.progress-bar {
    width: 0;
    border-radius: var(--radius-pill);
    transition: width 1s ease;
}

/* Timeline */
.timeline {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--color-primary);
}

.timeline-item {
    position: relative;
    padding-left: 55px;
    margin-bottom: 50px;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: 6px;
    top: 5px;
    width: 20px;
    height: 20px;
    background: var(--color-primary);
    border: 4px solid var(--color-bg-muted);
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--color-primary);
}

.tag-list .badge {
    margin: 0 5px 5px 0;
    padding: 7px 10px;
    font-weight: 500;
}

/* =========================================================
   07. PROJECTS & EDUCATION
========================================================= */
.project-card {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.project-card:hover {
    transform: translateY(-8px);
    border-color: var(--color-primary);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.08);
}

.project-icon {
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-muted);
    color: var(--color-primary);
    font-size: 4rem;
}

.project-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 30px;
}

.info-card-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 30px;
}

.info-icon {
    width: 55px;
    height: 55px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eff6ff;
    color: var(--color-primary);
    border-radius: 12px;
    font-size: 1.6rem;
}

.education-item {
    position: relative;
    display: flex;
    gap: 20px;
}

.education-dot {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 5px;
    background: var(--color-primary);
    border-radius: 50%;
    box-shadow: 0 0 0 4px #eff6ff;
}

/* =========================================================
   08. CONTACT & FOOTER
========================================================= */
.contact-info-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 22px;
}

.contact-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eff6ff;
    color: var(--color-primary);
    border-radius: 12px;
    font-size: 1.2rem;
}

.site-footer {
    background: var(--color-dark);
    color: #9ca3af;
    padding: 30px 0;
    margin-top: 30px;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.footer-social {
    display: flex;
    align-items: center;
    gap: 20px;
}

.footer-social a {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    transition: color 0.25s ease, transform 0.25s ease;
}

.footer-social a:hover {
    color: #ffffff;
    transform: translateY(-2px);
}

.footer-social .back-to-top {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #ffffff;
}

/* Floating back to top button */
.back-to-top {
    position: fixed;
    right: 25px;
    bottom: 25px;
    z-index: 1000;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px);
    transition: var(--transition);
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* =========================================================
   09. ANIMATION & DARK MODE
========================================================= */
.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

body.dark-mode {
    --color-bg: #111827;
    --color-bg-muted: #1f2937;
    --color-surface: #1f2937;
    --color-text: #e5e7eb;
    --color-heading: #ffffff;
    --color-muted: #9ca3af;
    --color-border: #374151;
}

body.dark-mode .info-icon,
body.dark-mode .contact-icon {
    background: #172554;
}

body.dark-mode .contact-form-card .form-control {
    background: #111827;
    color: #fff;
    border-color: #374151;
}

/* =========================================================
   10. CONSOLIDATED RESPONSIVE MEDIA QUERIES
========================================================= */
@media (min-width: 576px) {
    .container {
        padding-inline: 20px;
    }
}

@media (min-width: 768px) {
    .container {
        padding-inline: 24px;
    }
}

@media (min-width: 992px) {
    .container {
        padding-inline: 28px;
    }
}

@media (max-width: 991.98px) {
    .navbar .nav-link {
        margin-left: 0;
        padding: 10px 5px;
    }

    .navbar-collapse {
        margin-top: 15px;
        padding: 15px;
        background: #1f2937;
        border-radius: 12px;
    }

    .language-toggle {
        height: 40px;
        min-width: 58px;

        display: inline-flex;
        align-items: center;
        justify-content: center;

        gap: 6px;
        padding: 0 12px;

        border: 1px solid rgba(255, 255, 255, 0.55);
        border-radius: 999px;

        background: rgba(255, 255, 255, 0.06);
        color: #ffffff;

        font-size: 0.9rem;
        font-weight: 600;

        white-space: nowrap;

        transition:
            background-color 0.25s ease,
            border-color 0.25s ease,
            transform 0.25s ease,
            box-shadow 0.25s ease;
    }

    .language-toggle i {
        font-size: 0.9rem;
    }

    /* =========================================================
   MOBILE
========================================================= */

    @media (max-width: 991.98px) {

        .language-toggle {
            width: 82px;
            min-width: 82px;
            max-width: 82px;

            height: 40px;
            padding: 0 10px;

            justify-content: center;
        }
    }

    .language-toggle:hover {
        background: rgba(255, 255, 255, 0.14);
        border-color: rgba(255, 255, 255, 0.9);

        transform: translateY(-2px);

        box-shadow:
            0 4px 12px rgba(0, 0, 0, 0.18);
    }

    .language-toggle:active {
        transform: translateY(0);
    }
}

@media (max-width: 767.98px) {
    :root {
        --section-space: 65px;
    }

    .hero-section {
        min-height: auto;
        padding: 80px 0 50px;
        text-align: center;
    }

    .hero-avatar {
        width: 200px;
        height: 200px;
        margin: 0 auto;
        transform: none;
    }

    .hero-actions {
        justify-content: center;
    }

    .timeline::before {
        left: 10px;
    }

    .timeline-item {
        padding-left: 40px;
    }

    .timeline-dot {
        left: 1px;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .footer-social {
        justify-content: center;
    }
}

@media (max-width: 400px) {
    .container {
        padding-inline: 12px;
    }

    .skill-card,
    .info-card,
    .timeline-content,
    .contact-form-card {
        padding: 18px;
    }

    .hero-avatar {
        width: 160px;
        height: 160px;
    }
}

@media print {

    .navbar,
    .back-to-top,
    .theme-toggle,
    .site-footer,
    .loading-screen {
        display: none !important;
    }

    body {
        background: #fff !important;
        color: #000 !important;
    }

    .reveal {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* =========================================================
   NAVBAR - FIX CHO MÀN HÌNH 992px → 1199px
========================================================= */

@media (min-width: 992px) and (max-width: 1199.98px) {

    /* Navbar */
    .navbar {
        padding: 12px 0;
    }

    /* Container */
    .navbar .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    /* Logo */
    .navbar-brand {
        flex-shrink: 0;
        white-space: nowrap;
        font-size: 1rem;
    }

    /* Navigation */
    .navbar-nav {
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
        gap: 2px;
    }

    /* Navigation links */
    .navbar .nav-link {
        margin-left: 8px;
        padding-left: 5px;
        padding-right: 5px;

        white-space: nowrap;
        overflow-wrap: normal;

        font-size: 0.88rem;
        line-height: 1.2;
    }

    /* Các nút */
    .theme-toggle,
    .print-cv,
    .language-toggle {
        flex-shrink: 0;
        white-space: nowrap;
        font-size: 0.85rem;
    }

    /* Nút giao diện */
    .theme-toggle {
        width: 40px;
        min-width: 40px;
    }

    /* Nút In CV */
    .print-cv {
        min-width: 82px;
        padding-left: 10px;
        padding-right: 10px;
    }

    /* Nút ngôn ngữ */
    .language-toggle {
        min-width: 62px;
        padding-left: 8px;
        padding-right: 8px;
    }

    /* Không cho chữ trong button xuống dòng */
    .theme-toggle *,
    .print-cv *,
    .language-toggle * {
        white-space: nowrap;
    }

    /* Khoảng cách giữa các button */
    .navbar-nav .ms-lg-3 {
        margin-left: 8px !important;
    }

    .navbar-nav .ms-lg-2 {
        margin-left: 5px !important;
    }
}


/* =========================================================
   NAVBAR - MÀN HÌNH TỪ 1200px TRỞ LÊN
========================================================= */

@media (min-width: 1200px) {

    .navbar .nav-link {
        white-space: nowrap;
        overflow-wrap: normal;
    }

    .navbar-brand {
        white-space: nowrap;
    }

    .print-cv,
    .language-toggle {
        white-space: nowrap;
    }
}

/* =========================================================
   INFORMATION CARD
========================================================= */

.info-card {
    padding: 30px;
}

.info-card h3 {
    margin-bottom: 28px !important;
}

.contact-info-line {
    display: flex;
    align-items: center;
    gap: 14px;

    margin-bottom: 20px;

    line-height: 1.5;
    font-style: normal;
}

.contact-info-line i {
    flex: 0 0 20px;

    width: 20px;
    text-align: center;

    color: var(--color-primary);
    font-size: 1.05rem;

    font-style: normal;
}

.contact-info-line span {
    flex: 1;

    color: var(--color-text);
    font-style: normal;
}

@media (max-width: 767.98px) {

    .info-card {
        padding: 24px;
    }

    .contact-info-line {
        gap: 12px;
        margin-bottom: 16px;
    }
}

/* =========================================================
   CONTACT SECTION BACKGROUND
========================================================= */

#contact {
    background-color: #ffffff;
    width: 100%;
}

/* Đảm bảo section chiếm toàn bộ chiều ngang */
#contact.section {
    width: 100%;
}

/* Khoảng cách trên dưới */
#contact {
    padding-top: 80px;
    padding-bottom: 80px;
}


/* =========================================================
   DARK MODE
========================================================= */

body.dark-mode #contact {
    background-color: #111827;
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 767.98px) {

    #contact {
        padding-top: 60px;
        padding-bottom: 60px;
    }
}

/* =========================================================
   CONTACT → FOOTER
   Loại bỏ khoảng trắng giữa 2 section
========================================================= */

#contact {
    margin-bottom: 0 !important;
    padding-bottom: 60px;
}

/* Footer sát ngay sau Contact */
.site-footer,
footer {
    margin-top: 0 !important;
}

/* =========================================================
   PROJECT SECTION
========================================================= */

#projects {
    background-color: #ffffff;
    margin: 0;
    padding-top: 80px;
    padding-bottom: 80px;
}

/* Nội dung bên trong */
#projects .container {
    position: relative;
    z-index: 1;
}

/* =========================================================
   SECTION PHÍA TRƯỚC PROJECT
========================================================= */

#education {
    background-color: #F8FAFC;
    margin-bottom: 0;
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 767.98px) {

    #projects {
        padding-top: 60px;
        padding-bottom: 60px;
    }
}

/* =========================================================
   FIXED NAVBAR
========================================================= */

.site-navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;

    z-index: 1030;

    padding: 16px 0;

    background-color: #212529 !important;

    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}


/* =========================================================
   ĐẨY NỘI DUNG XUỐNG KHÔNG BỊ NAVBAR CHE
========================================================= */

body {
    padding-top: 72px;
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 991.98px) {

    .site-navbar {
        padding: 10px 0;
    }

    body {
        padding-top: 62px;
    }
}