/* ---- BIẾN MÀU SẮC CHO SIDEBAR (THAY ĐỔI THEO DARK MODE) ---- */
:root {
    --side-bg: #FFFFFF;         
    --side-text: #000000;       
    --side-border: #E0E0E0;     
    --main-blue: #1fc7e6;       /* Màu xanh cố định bên phải */
    --content-text: #111111;    
    --card-bg: rgba(255, 255, 255, 0.85); 
}

[data-theme="dark"] {
    --side-bg: #121212;
    --side-text: #FFFFFF;
    --side-border: #333333;
}

/* ---- BỐ CỤC CHUNG MỚI ---- */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Outfit', sans-serif;
    line-height: 1.6;
    background-color: var(--side-bg);
    overflow-x: hidden;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* ---- PHẦN BÊN TRÁI: SIDEBAR (ĐÃ THU GỌN 280PX) ---- */
.sidebar {
    width: 280px;
    background-color: var(--side-bg);
    color: var(--side-text);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-right: 1px solid var(--side-border);
    transition: all 0.3s ease;
    position: fixed; 
    height: 100vh;
    overflow-y: auto; /* Cuộn nếu màn hình nhỏ */
}

/* Avatar bo tròn viền xanh trơn kèm hiệu ứng phát sáng */
.profile-img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 15px;
    border: 2px solid var(--main-blue);
    box-shadow: 0 0 15px 3px rgba(31, 199, 230, 0.5); /* Glowing effect restored */
}

.sidebar h1 { font-size: 22px; font-weight: 600; margin-bottom: 5px; text-align: center; }
.contact-info { text-align: center; margin-bottom: 20px; font-size: 14px; }
.links { color: inherit; text-decoration: none; font-weight: 600; }
.links:hover { color: var(--main-blue); }

/* Thanh Search Sidebar */
.search-input {
    width: 100%; 
    padding: 10px 15px; 
    border-radius: 8px; 
    border: 1px solid var(--side-border); 
    background: transparent; 
    color: var(--side-text); 
    font-family: inherit; 
    outline: none; 
    transition: all 0.3s ease; 
    margin-bottom: 15px;
}
.search-input:focus { border-color: var(--main-blue); box-shadow: 0 0 5px rgba(31, 199, 230, 0.3); }

/* Khối Nút Tải CV & Đa Ngôn Ngữ */
.sidebar-actions { 
    display: flex; 
    gap: 10px; 
    width: 100%; 
    justify-content: space-between; 
    margin-bottom: 15px;
}
.action-btn { 
    flex: 1; 
    text-align: center; 
    text-decoration: none; 
    padding: 10px; 
    font-size: 14px; 
    font-family: inherit;
    font-weight: 600;
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 6px; 
    background: transparent;
    color: var(--side-text);
    border: 1px solid var(--side-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.action-btn:hover { background-color: rgba(0,0,0,0.05); }
[data-theme="dark"] .action-btn:hover { background-color: rgba(255,255,255,0.05); }

/* Menu Navigation Nút Bo Tròn Mới */
.nav-menu {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 10px;
    margin-bottom: auto; /* Đẩy nút Dark Mode xuống đáy */
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--side-border);
    border-radius: 12px;
    color: var(--side-text);
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
}

.nav-btn i {
    width: 20px;
    text-align: center;
    color: var(--main-blue);
    font-size: 16px;
}

.nav-btn:hover { background-color: rgba(0,0,0,0.05); }
[data-theme="dark"] .nav-btn:hover { background-color: rgba(255,255,255,0.05); }

/* Trạng thái đang chọn mục Sidebar */
.nav-btn.active { 
    background-color: var(--main-blue); 
    color: #000; 
    border-color: var(--main-blue); 
}
.nav-btn.active i { color: #000; }

/* Nút Dark Mode Đáy Màn Hình */
.theme-btn {
    cursor: pointer; 
    padding: 12px; 
    border-radius: 12px;
    border: 1px solid var(--side-border); 
    background-color: transparent;
    color: var(--side-text); 
    font-family: inherit; 
    font-size: 14px;
    font-weight: 600;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px; 
    transition: all 0.3s ease;
}
.theme-btn:hover { background-color: rgba(0,0,0,0.05); }
[data-theme="dark"] .theme-btn:hover { background-color: rgba(255,255,255,0.05); }

/* ---- PHẦN BÊN PHẢI: NỘI DUNG CHÍNH (2/3) ---- */
.main-content {
    width: calc(100% - 280px);
    margin-left: 280px; 
    background-color: var(--main-blue);
    color: var(--content-text);
    padding: 50px;
    min-height: 100vh;
}

.main-content h2 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 30px;
    position: relative;
    display: inline-block;
}
.main-content h2::after {
    content: "";
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 6px;
    background-color: #000;
}

.tab-content { display: none; animation: fadeIn 0.4s ease; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ---- CẤU TRÚC GIAO DIỆN HOME MỚI: TÍCH HỢP HÌNH & VĂN BẢN ---- */
.introduction-merged-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.intro-visuals {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    width: 100%;
}

.intro-gif {
    max-width: 200px;
    height: auto;
    border-radius: 8px;
    object-fit: contain;
}

.intro-text {
    width: 100%;
    text-align: left;
}

.intro-text p {
    font-size: 18px;
    margin-bottom: 15px;
    font-weight: 400;
    color: var(--content-text);
}

.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-top: 20px; }
.photo-item { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.15); transition: transform 0.3s ease; }
.photo-item:hover { transform: scale(1.05); box-shadow: 0 8px 20px rgba(0,0,0,0.3); }

.project, .skill-category {
    background-color: var(--card-bg); 
    padding: 25px; border-radius: 12px; margin-bottom: 25px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease; 
}
.project:hover, .skill-category:hover { transform: scale(1.03); box-shadow: 0 10px 25px rgba(0,0,0,0.15); }

.project-title { font-size: 22px; font-weight: bold; color: #000; margin-bottom: 5px;}
.project-title a { color: #000; text-decoration: none; margin-left: 10px; transition: color 0.2s ease; }
.project-title a:hover { color: #555; } 

.project-details { padding-left: 20px; list-style-type: none; }
.project-details li { margin-bottom: 8px; position: relative;}
.project-details li::before { content: "→"; position: absolute; left: -20px; color: #555; }
.duration { color: #444; font-style: italic; margin-bottom: 10px; }

.skills-grid, .projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.skill-category-title { font-size: 18px; font-weight: bold; margin-bottom: 10px; border-bottom: 1px solid #ccc; padding-bottom: 5px; }

/* Form liên hệ (Contact) */
.contact-form { display: flex; flex-direction: column; gap: 15px; }
.contact-form input, .contact-form textarea { padding: 15px; border: none; border-radius: 8px; font-family: inherit; font-size: 16px; width: 100%; background: #fff; }
.contact-form button { padding: 15px; background-color: #000; color: #fff; border: none; border-radius: 8px; font-size: 18px; cursor: pointer; font-weight: bold; }

.contact-info img { border-radius: 2px; box-shadow: 0 0 5px rgba(31, 199, 230, 0.3); display: inline-block; }

/* ---- AI CHAT WIDGET ---- */
.chat-widget {
    position: fixed; bottom: 25px; right: 25px; width: 400px; 
    background: var(--side-bg); border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.25); 
    overflow: hidden; z-index: 1000; font-family: 'Outfit', sans-serif;
}
.chat-header { background: #000; color: #fff; padding: 16px 20px; font-size: 16px; font-weight: bold; cursor: pointer; text-align: center; }
.chat-box { display: none; flex-direction: column; height: 500px; background: var(--side-bg); }
.chat-box.open { display: flex; }
.chat-messages { flex-grow: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 15px; }
.message { max-width: 85%; padding: 12px 16px; border-radius: 10px; font-size: 15px; line-height: 1.5; }
.ai-message { background: #f1f1f1; align-self: flex-start; color: #000; border-bottom-left-radius: 2px;}
.user-message { background: var(--main-blue); align-self: flex-end; color: #000; font-weight: 500; border-bottom-right-radius: 2px;}
.chat-input-area { display: flex; border-top: 1px solid var(--side-border); }
.chat-input-area input { flex-grow: 1; padding: 15px; border: none; outline: none; background: transparent; color: var(--side-text); font-size: 15px; }
.chat-input-area button { padding: 0 20px; background: #000; color: #fff; border: none; cursor: pointer; font-weight: bold; font-size: 15px; }

/* Responsive */
@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; padding: 30px 20px; border-right: none; border-bottom: 1px solid var(--side-border); }
    .main-content { width: 100%; margin-left: 0; padding: 20px; }
    .chat-widget { display: none; }
}