:root {
    --bg-color: #0d0d0d;
    --glass-bg: rgba(20, 20, 20, 0.4);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f5f5f7;
    --text-sec: #86868b;
    --accent: #2997ff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center; /* Căn giữa toàn bộ nội dung */
    overflow-x: hidden;
}

/* --- Background Blobs --- */
.background {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    overflow: hidden;
}
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.5;
    animation: move 15s infinite alternate;
}
.blob-1 { width: 500px; height: 500px; background: #2f27ce; top: -10%; left: -10%; }
.blob-2 { width: 400px; height: 400px; background: #d03066; bottom: -10%; right: -10%; animation-delay: 2s; }
.blob-3 { width: 300px; height: 300px; background: #0f86a3; top: 40%; left: 40%; animation-delay: 4s; }

@keyframes move {
    0% { transform: translate(0, 0); }
    100% { transform: translate(40px, -40px); }
}

/* --- BENTO GRID LAYOUT --- */
.bento-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* Chia 4 cột */
    grid-template-rows: repeat(3, auto);   /* 3 hàng */
    gap: 20px;
    width: 90%;
    max-width: 1000px;
    padding-bottom: 120px; /* Chừa chỗ cho Dock */
    margin-top: 40px;
}

/* Glass Card Global Style */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    overflow: hidden;
    transform-style: preserve-3d; /* Cho hiệu ứng 3D */
    transform: perspective(1000px);
}

/* 1. Hero Card (Chiếm 2 cột, 2 hàng) */
.hero-card {
    grid-column: span 2;
    grid-row: span 2;
    display: flex;
    align-items: center;
    justify-content: center;
}
.profile-content {
    text-align: center;
    transform: translateZ(20px); /* Đẩy nội dung nổi lên 3D */
}
.avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
    margin-bottom: 20px;
}
.hero-card h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #fff 0%, #a5a5a5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero-card p { color: var(--text-sec); }

/* 2. Terminal Card (Chiếm 2 cột, 1 hàng) */
.terminal-card {
    grid-column: span 2;
    grid-row: span 1;
    background: rgba(0, 0, 0, 0.6); /* Đen hơn để giống terminal */
    padding: 0;
    display: flex;
    flex-direction: column;
}
.terminal-header {
    background: rgba(255,255,255,0.05);
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--glass-border);
}
.dot { width: 12px; height: 12px; border-radius: 50%; }
.red { background: #ff5f56; }
.yellow { background: #ffbd2e; }
.green { background: #27c93f; }
.terminal-title { margin-left: 10px; font-size: 0.8rem; color: var(--text-sec); font-family: 'Fira Code', monospace;}
.terminal-body {
    padding: 20px;
    flex: 1;
    overflow: hidden;
}
.terminal-body pre {
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    color: #a5f3fc; /* Màu code neon */
    transform: translateZ(10px);
}

/* 3. Music Card (1 cột, 1 hàng) */
.music-card {
    grid-column: span 1;
    grid-row: span 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(255, 69, 58, 0.2), rgba(0,0,0,0.2));
}
.album-art {
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}
.music-info h4 { font-size: 1rem; margin: 5px 0; }
.music-info span { font-size: 0.7rem; color: #ff453a; font-weight: 600; text-transform: uppercase; }
.progress-bar { width: 100%; height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; margin-top: 10px; }
.progress-fill { width: 60%; height: 100%; background: #fff; border-radius: 2px; }

/* 4. Social Card (1 cột, 1 hàng) */
.social-card {
    grid-column: span 1;
    grid-row: span 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-main);
    transition: background 0.3s;
}
.social-card:hover { background: rgba(255,255,255,0.1); }
.social-card i { font-size: 3rem; margin-bottom: 10px; }
.social-card span { font-weight: 600; }

/* 5. Resource Card (Chiếm 2 cột, 1 hàng) */
.resource-card {
    grid-column: span 2;
    grid-row: span 1;
}
.resource-card h3 { margin-bottom: 15px; font-size: 1.2rem; }
.resource-list { list-style: none; }
.resource-list li {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-sec);
    cursor: pointer;
    transition: color 0.2s;
}
.resource-list li:hover { color: var(--text-main); padding-left: 5px; }

/* --- MACOS DOCK --- */
.dock-wrapper {
    position: fixed;
    bottom: 20px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    z-index: 100;
}
.dock {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 10px 20px;
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.15);
    display: flex;
    gap: 20px;
}
.dock-item {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
}
/* Hiệu ứng phóng to khi hover (Dock Effect) */
.dock-item:hover {
    transform: translateY(-10px) scale(1.2);
    background: rgba(255,255,255,0.2);
}
/* Tooltip tên icon */
.tooltip {
    position: absolute;
    top: -40px;
    background: rgba(0,0,0,0.8);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    white-space: nowrap;
}
.dock-item:hover .tooltip { opacity: 1; }

/* --- Responsive (Mobile) --- */
@media (max-width: 768px) {
    .bento-container {
        grid-template-columns: 1fr; /* Về 1 cột duy nhất */
        grid-template-rows: auto;
        padding-bottom: 100px;
    }
    .hero-card, .terminal-card, .music-card, .social-card, .resource-card {
        grid-column: span 1; /* Tất cả full width */
        grid-row: span 1;
    }
    .dock {
        padding: 10px 15px;
        gap: 15px;
    }
    .dock-item { width: 45px; height: 45px; }
}
/* --- MODAL / POPUP STYLE --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6); /* Nền tối mờ đằng sau */
    backdrop-filter: blur(5px);
    z-index: 999; /* Luôn nổi trên cùng */
    display: flex;
    justify-content: center;
    align-items: center;
    
    /* Ẩn mặc định */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Khi có class active thì hiện lên */
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    width: 90%;
    max-width: 400px;
    text-align: center;
    position: relative;
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Hiệu ứng nảy */
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-content h2 {
    margin-bottom: 25px;
    font-size: 1.5rem;
}

.close-btn {
    position: absolute;
    top: 15px; right: 20px;
    background: none;
    border: none;
    color: var(--text-sec);
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.2s;
}
.close-btn:hover { color: #ff5f56; }

/* Grid chứa các icon social */
.social-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 cột */
    gap: 15px;
}

.social-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    border-radius: 15px;
    text-decoration: none;
    color: var(--text-main);
    background: rgba(255,255,255,0.03);
    border: 1px solid transparent;
    transition: all 0.3s;
}

.social-item i {
    font-size: 2.5rem;
    margin-bottom: 5px;
}

.social-item span {
    font-size: 0.8rem;
    font-weight: 500;
}

/* Màu sắc riêng cho từng mạng xã hội khi Hover */
.social-item:hover {
    background: rgba(255,255,255,0.1);
    transform: translateY(-5px);
}

.fb:hover i { color: #1877f2; }
.zalo:hover i { color: #0068ff; }
.insta:hover i { 
    background: -webkit-linear-gradient(#833ab4, #fd1d1d, #fcb045);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.tele:hover i { color: #229ED9; }
.git:hover i { color: #fff; }
/* --- HIỆU ỨNG TUYẾT RƠI APPLE WINTER --- */
.snowflake {
    position: fixed;
    top: -10px; /* Bắt đầu từ trên cùng màn hình */
    background: rgba(255, 255, 255, 0.8); /* Màu trắng hơi trong suốt */
    border-radius: 50%; /* Hình tròn */
    pointer-events: none; /* Chuột xuyên qua tuyết, không bị chặn click */
    z-index: 99; /* Nổi lên trên các ô kính nhưng dưới các popup */
    animation: fall linear forwards; /* Hiệu ứng rơi đều */
    filter: blur(1px); /* Làm mờ nhẹ cho giống thật */
}

/* Định nghĩa chuyển động rơi */
@keyframes fall {
    to {
        transform: translateY(105vh) rotate(360deg); /* Rơi quá màn hình và xoay nhẹ */
    }
}

/* (Tùy chọn) Điều chỉnh màu nền Blobs lạnh hơn cho hợp mùa đông */
/* Nếu bạn thích màu cũ thì bỏ qua đoạn comment này */
/*
.blob-1 { background: #2f27ce; } 
.blob-2 { background: #30d0d0; } 
.blob-3 { background: #5e0fa3; }
*/
/* --- STYLE CHO MODAL "ABOUT THIS DEV" --- */

/* Chỉnh độ rộng riêng cho modal này để giống cửa sổ Mac ngang */
.about-mac-style {
    max-width: 650px; /* Rộng hơn modal liên hệ */
    padding: 40px;
    text-align: left; /* Căn trái text */
}

.about-layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

/* Cột trái: Avatar */
.about-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 150px;
}

.mac-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,0.1);
    margin-bottom: 15px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.mac-model {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.mac-year {
    font-size: 0.8rem;
    color: var(--text-sec);
}

/* Cột phải: Thông số */
.about-right {
    flex: 1;
}

.mac-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
}

.spec-row {
    display: flex;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.spec-label {
    width: 100px; /* Độ rộng cố định cho nhãn */
    text-align: right;
    margin-right: 15px;
    color: var(--text-sec);
    font-weight: 500;
}

.spec-value {
    color: var(--text-main);
    flex: 1;
}

/* Nút bấm style MacOS */
.mac-buttons {
    margin-top: 30px;
    display: flex;
    gap: 10px;
}

.mac-btn {
    padding: 6px 12px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-main);
    text-decoration: none;
    transition: background 0.2s;
}

.mac-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* Responsive cho điện thoại: Chuyển thành hàng dọc */
@media (max-width: 600px) {
    .about-layout {
        flex-direction: column;
        align-items: center;
    }
    .spec-label { text-align: left; width: auto; font-weight: 700; }
    .spec-row { flex-direction: column; gap: 5px; text-align: center; }
    .about-mac-style { text-align: center; }
    .mac-buttons { justify-content: center; }
}
/* --- HIỆU ỨNG THANH NHẠC CHẠY --- */

/* 1. Định nghĩa chuyển động: Từ 0% đến 100% chiều rộng */
@keyframes playMusic {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* 2. Áp dụng vào thanh màu trắng */
.progress-fill {
    height: 100%;
    background: #fff;
    border-radius: 2px;
    width: 0%; /* Bắt đầu từ 0 */
    
    /* Cú pháp: Tên_animation | Thời_gian_chạy (30 giây) | Chạy_đều (linear) | Lặp_mãi_mãi (infinite) */
    animation: playMusic 30s linear infinite;
}

/* (Thêm cái này cho đẹp) Hiệu ứng nhấp nháy nhẹ cho icon nhạc */
.music-info h4 {
    animation: textGlow 2s ease-in-out infinite alternate;
}

@keyframes textGlow {
    from { text-shadow: 0 0 5px rgba(255, 255, 255, 0.2); }
    to { text-shadow: 0 0 15px rgba(255, 255, 255, 0.8); }
}
/* --- STYLE CHO MODAL DỰ ÁN (PROJECTS) --- */

.project-layout {
    width: 90%;
    max-width: 700px; /* Rộng hơn để hiển thị code đẹp */
    max-height: 85vh; /* Giới hạn chiều cao */
    display: flex;
    flex-direction: column;
    text-align: left; /* Căn trái toàn bộ nội dung */
    padding: 0; /* Xóa padding mặc định để custom */
}

.project-layout h2 {
    text-align: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin: 0;
}

.project-list-container {
    padding: 20px 30px;
    overflow-y: auto; /* Cho phép cuộn dọc nếu danh sách dài */
}

/* Tùy chỉnh thanh cuộn cho đẹp */
.project-list-container::-webkit-scrollbar {
    width: 8px;
}
.project-list-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

/* Style cho từng mục dự án */
.project-item {
    margin-bottom: 40px; /* Khoảng cách giữa các dự án */
}

.project-title {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: var(--text-main);
    font-weight: 600;
}

/* Style riêng cho Terminal nhỏ trong Modal */
.mini-terminal {
    background: #1e1e1e; /* Màu nền đen đậm giống VS Code */
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}

/* Header của Terminal (3 chấm màu) */
.mini-terminal .terminal-header {
    background: #2d2d2d;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mini-terminal .terminal-body {
    padding: 15px;
    background: #0d0d0d; /* Màu nền vùng code đen tuyền */
}

.mini-terminal pre {
    margin: 0;
    white-space: pre-wrap; /* Tự động xuống dòng nếu code quá dài */
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: #a5f3fc; /* Màu code mặc định */
    line-height: 1.5;
}

.project-desc {
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--text-sec);
    text-align: right;
}

.project-desc a {
    color: #2997ff;
    text-decoration: none;
}
.project-desc a:hover { text-decoration: underline; }
/* --- 1. STYLE CHO WIDGET ĐỒNG HỒ --- */
.clock-card {
    grid-column: span 1;
    grid-row: span 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0.2));
}

.clock-content {
    text-align: center;
    z-index: 2;
}

.time {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 5px;
    background: linear-gradient(to bottom, #fff, #ccc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-variant-numeric: tabular-nums; /* Giúp số không bị nhảy khi thay đổi */
}

.greeting {
    font-size: 0.8rem;
    color: #a5f3fc; /* Màu xanh sáng */
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.clock-icon-bg {
    position: absolute;
    bottom: -10px;
    right: -10px;
    font-size: 5rem;
    color: rgba(255,255,255,0.05);
    z-index: 1;
    transform: rotate(-15deg);
}

/* --- 2. STYLE CHO THÔNG BÁO MACOS --- */
.mac-toast {
    position: fixed;
    top: 20px;
    right: -400px; /* Ẩn bên phải màn hình */
    width: 320px;
    background: rgba(40, 40, 40, 0.7); /* Màu tối kiểu Mac */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 16px;
    padding: 15px;
    display: flex;
    gap: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    z-index: 1000;
    transition: right 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Hiệu ứng trượt nảy */
}

/* Class này được JS thêm vào để hiện thông báo */
.mac-toast.active {
    right: 20px;
}

.toast-icon img {
    width: 45px;
    height: 45px;
    border-radius: 10px;
}

.toast-content {
    flex: 1;
}

.toast-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.toast-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.toast-time {
    font-size: 0.75rem;
    color: var(--text-sec);
}

.toast-message {
    font-size: 0.85rem;
    color: #ddd;
    line-height: 1.3;
}
/* --- SPOTIFY THEME STYLE --- */

/* 1. Nền Card chuyển sang tông tối pha xanh lục */
.spotify-theme {
    background: linear-gradient(135deg, rgba(29, 185, 84, 0.15), rgba(0, 0, 0, 0.6)) !important;
    border: 1px solid rgba(29, 185, 84, 0.2); /* Viền xanh nhẹ */
}

/* 2. Ô chứa Logo (Vuông xanh lá) */
.spotify-theme .album-art {
    background: #1DB954; /* Màu xanh Spotify chuẩn */
    color: #000; /* Logo màu đen cho nổi bật */
    width: 50px;
    height: 50px;
    border-radius: 8px; /* Bo góc ít hơn xíu cho vuông vức giống bìa album */
}

.spotify-theme .album-art i {
    font-size: 2rem;
}

/* 3. Dòng chữ trạng thái nhỏ */
.spotify-status {
    color: #1DB954 !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px;
    font-size: 0.7rem !important;
}

/* 4. Tên bài hát */
.spotify-theme h4 {
    color: #fff;
    margin-top: 5px;
}

/* 5. Thanh chạy nhạc màu xanh và phát sáng */
.spotify-progress {
    background: #1DB954 !important;
    box-shadow: 0 0 10px rgba(29, 185, 84, 0.6); /* Hiệu ứng Neon Glow */
}
/* --- SỬA LẠI ANIMATION CHO NHẠC --- */

/* Mặc định thanh nhạc đứng im */
.progress-fill {
    width: 0%;
    height: 100%;
    background: #1DB954;
    border-radius: 2px;
    /* Animation được khai báo nhưng trạnh thái là PAUSED (Dừng) */
    animation: playMusic 180s linear infinite; 
    animation-play-state: paused; 
}

/* Khi có class "playing" thì thanh nhạc mới CHẠY */
.progress-fill.playing {
    animation-play-state: running; /* Chuyển sang trạng thái chạy */
    box-shadow: 0 0 10px rgba(29, 185, 84, 0.8);
}

/* Định nghĩa lại chuyển động */
@keyframes playMusic {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* Hiệu ứng rung nhẹ cho icon khi đang phát nhạc */
.album-art.pulse {
    animation: pulseIcon 1.5s infinite;
}

@keyframes pulseIcon {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(29, 185, 84, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(29, 185, 84, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(29, 185, 84, 0); }
}
/* --- STYLE CHO 3 NÚT ĐIỀU KHIỂN --- */

.music-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px; /* Khoảng cách giữa các nút */
    margin-top: 15px;
}

.music-controls i {
    cursor: pointer;
    color: #b3b3b3; /* Màu xám nhạt cho nút phụ */
    font-size: 2rem;
    transition: color 0.2s;
}

.music-controls i:hover {
    color: #fff;
}

/* Style riêng cho nút Play ở giữa (Hình tròn xanh) */
.play-btn-circle {
    width: 45px;
    height: 45px;
    background: #fff; /* Nền trắng nổi bật */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.play-btn-circle:hover {
    transform: scale(1.1);
    background: #1DB954; /* Hover vào đổi màu xanh Spotify */
}

/* Icon Play bên trong nút tròn */
.play-btn-circle i {
    color: #000 !important; /* Icon màu đen */
    font-size: 2.2rem;
    margin-left: 2px; /* Căn chỉnh lại chút cho cân */
}
