/* ==========================================================================
   1. RESET HỆ THỐNG & CẤU HÌNH THÂN TRANG + CON TRỎ CHUỘT PIXEL
   ========================================================================== */
* { 
  margin: 0; 
  padding: 0; 
  box-sizing: border-box; 
}

body, html {
  width: 100%;
  height: 100%;
}

body {
  font-family: 'Tahoma', cursive;
  /* LIGHT MODE: Gradient Trắng ở trên, Hồng ở dưới */
  background: linear-gradient(to bottom, #ffffff 0%, #ffb3d9 100%);
  background-attachment: fixed;
  color: #444;
  line-height: 1.6;
  transition: background 0.5s, color 0.5s;
  overflow-x: hidden; 

  cursor: url('cursor.png') 0 0, auto !important;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: pixelated; 
}

/* HIỆU ỨNG HẠT NOISE (GRAINY BACKGROUND) */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  /* Mã base64 tạo hiệu ứng nhiễu hạt */
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.12; /* Độ đậm nhạt của hạt */
  z-index: 0;
}

#xp-screen, #context-menu, .menu-item, .submenu-item, #desktop, #congrats-screen {
  cursor: url('cursor.png') 0 0, auto !important;
}

#start-button, .submenu-item:not(.disabled), .icon, nav a, button, #view-more-btn {
  cursor: url('cursor.png') 0 0, pointer !important;
}

/* ==========================================================================
   2. GIAO DIỆN MÀN HÌNH CHỜ WINDOWS XP & LOGO START
   ========================================================================== */
#xp-screen {
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999; 
  transition: opacity 0.8s ease-out, visibility 0.8s;
  user-select: none;
}

#desktop {
  width: 100%;
  height: calc(100% - 30px);
  background: #245edb url('bliss.png') no-repeat center center;
  background-size: cover;
  position: relative;
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 20px;
}

/* Box hướng dẫn hiệu ứng Kính mờ */
#mission-box {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  padding: 12px 25px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  font-size: 13px;
  font-weight: bold;
  color: #004ece;
  text-align: center;
  z-index: 10000;
  animation: xpBounce 2s infinite;
  font-family: Tahoma, Arial, sans-serif;
}

@keyframes xpBounce {
  0%, 100% { top: 20px; }
  50% { top: 30px; }
}

.icon {
  width: 85px;
  height: 75px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: white;
  text-shadow: 1px 1px 1px rgba(0,0,0,0.9);
  font-weight: bold;
  font-family: Tahoma, Arial, sans-serif;
}
.icon img { width: 40px; height: 40px; margin-bottom: 5px; }

#taskbar {
  width: 100%; height: 30px;
  background: linear-gradient(to bottom, #245edb 0%, #3f8cf3 9%, #245edb 18%, #1b4fa3 92%, #19448a 100%);
  position: absolute; bottom: 0; left: 0;
  display: flex; justify-content: space-between; align-items: center;
}

#start-button {
  height: 100%; padding: 0 15px 0 10px;
  background: linear-gradient(to bottom, #60af37 0%, #539e2e 9%, #438522 18%, #326417 92%, #264e10 100%);
  border-top-right-radius: 5px; border-bottom-right-radius: 5px;
  display: flex; align-items: center; color: white;
  font-size: 14px; font-weight: bold; font-style: italic;
  font-family: Tahoma, Arial, sans-serif; gap: 6px;
}
.start-logo { height: 16px; width: auto; filter: drop-shadow(1px 1px 1px rgba(0,0,0,0.5)); }

#system-tray {
  height: 100%;
  background: linear-gradient(to bottom, #0c8df2 0%, #0066cc 100%);
  border-left: 1px solid #10418c; padding: 0 10px;
  display: flex; align-items: center; color: white;
  font-family: Tahoma, Arial, sans-serif;
}

/* ==========================================================================
   3. MENU CHUỘT PHẢI
   ========================================================================== */
#context-menu {
  display: none; position: absolute; background: #f0f0f0; 
  border: 1px solid #716f64; box-shadow: 2px 2px 4px rgba(0,0,0,0.3);
  z-index: 10001; padding: 2px; min-width: 180px; font-family: Tahoma, Arial, sans-serif; font-size: 11px;
}
.menu-item { padding: 4px 15px 4px 25px; display: flex; justify-content: space-between; align-items: center; position: relative; color: #000; }
.menu-separator { border: none; border-top: 1px solid #aca899; margin: 3px 2px; }
.menu-item.disabled, .submenu-item.disabled { opacity: 0.4; pointer-events: none; background: transparent !important; color: #555 !important; }
.submenu-arrow { font-size: 8px; }
.menu-item.has-submenu:hover { background: #316ac5; color: #fff; }
.submenu { display: none; position: absolute; top: -3px; left: 98%; background: #f0f0f0; border: 1px solid #716f64; box-shadow: 2px 2px 4px rgba(0,0,0,0.3); padding: 2px; min-width: 180px; }
.menu-item.has-submenu:hover .submenu { display: block; }
.submenu-item { padding: 4px 10px 4px 6px; display: flex; align-items: center; color: #000; gap: 5px; }
.submenu-item:not(.disabled):hover { background: #316ac5; color: #fff; }
.menu-icon { width: 16px; height: 16px; }

/* ==========================================================================
   4. MÀN HÌNH TRUNG GIAN CHÚC MỪNG
   ========================================================================== */
#congrats-screen {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background-color: #0d1117; z-index: 10005; flex-direction: column; justify-content: center; align-items: center;
  padding: 20px; text-align: center; transition: opacity 0.8s ease-out, visibility 0.8s;
}
.congrats-text { font-family: 'Courier New', Courier, monospace; font-size: 24px; color: #ffffff; max-width: 750px; line-height: 1.6; margin-bottom: 35px; word-wrap: break-word; }
#view-more-btn {
  background-color: #3b82f6; color: white; border: none; padding: 12px 30px; font-size: 14px; font-family: 'Courier New', Courier, monospace;
  border-radius: 6px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2); display: inline-flex; align-items: center; gap: 10px; transition: background 0.3s, transform 0.2s;
}
#view-more-btn:hover { background-color: #2563eb; transform: translateY(-1px); }
.white-arrow { font-size: 16px; color: #ffffff; }

/* ==========================================================================
   5. NÚT THOÁT GAME (Ở GÓC MISSION-BOX)
   ========================================================================== */
.skip-game-container {
  position: absolute; top: -10px; right: -10px; display: flex; flex-direction: column; align-items: flex-end; z-index: 10001;
}
.close-btn {
  background: #ff4d4d; border: 2px solid #fff; color: #ffffff; font-size: 12px; font-family: Tahoma, Arial, sans-serif; font-weight: bold;
  border-radius: 50%; width: 24px; height: 24px; display: flex; justify-content: center; align-items: center; cursor: pointer;
  transition: transform 0.2s, background 0.2s; box-shadow: 1px 1px 4px rgba(0,0,0,0.3);
}
.close-btn:hover { background: #e60000; transform: scale(1.15); }
.tooltip-text {
  visibility: hidden; width: max-content; background-color: rgba(0, 0, 0, 0.85); color: #fff; text-align: center; border-radius: 4px;
  padding: 4px 8px; font-size: 11px; margin-top: 6px; opacity: 0; transition: opacity 0.3s ease, visibility 0.3s ease; font-family: Tahoma, Arial, sans-serif;
  box-shadow: 1px 1px 3px rgba(0,0,0,0.4);
}
.skip-game-container:hover .tooltip-text { visibility: visible; opacity: 1; }

/* ==========================================================================
   6. HEADER CÔNG NGHỆ (FULL 100VH) XUYÊN THẤU
   ========================================================================== */
#portfolio-screen {
  opacity: 0; visibility: hidden; transition: opacity 1.2s ease-in; width: 100%; height: 100%; position: relative; z-index: 1;
}

#tech-header {
  position: relative;
  width: 100%;
  height: 100vh;
  background-color: transparent; /* Để lộ nền body gradient bên dưới */
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

#tech-canvas {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; 
}

.header-content {
  position: relative; z-index: 2; text-align: center; pointer-events: none; 
}

.header-content h1 {
  font-size: 4em;
  font-family: 'Courier New', Courier, monospace;
  text-transform: uppercase; letter-spacing: 4px;
  color: #333; /* Chữ đậm màu xám ở Light Mode */
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
  margin-bottom: 10px;
}

.header-content p {
  color: #444;
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.3em;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
  margin-bottom: 25px;
}

.dark-toggle {
  display: inline-block; margin-top: 15px; padding: 12px 30px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 25px;
  /* Hiệu ứng kính cho nút */
  background: rgba(255, 102, 178, 0.8);
  backdrop-filter: blur(5px);
  color: white; font-size: 16px; font-weight: bold; font-family: 'Tahoma', sans-serif;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1); cursor: pointer; pointer-events: auto; transition: all 0.3s;
}
.dark-toggle:hover { background: #ff3399; transform: scale(1.05); }

/* ==========================================================================
   7. PHẦN CÒN LẠI CỦA PORTFOLIO (GLASSMORPHISM TEXTBOX)
   ========================================================================== */
nav {
  /* Hiệu ứng hộp kính (Trắng nhạt, mờ) */
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 40px;
  margin: 20px auto;
  max-width: 600px;
  text-align: center;
  padding: 15px;
  box-shadow: 0 8px 32px 0 rgba(255, 153, 204, 0.2);
  position: relative;
  z-index: 2;
}
nav a {
  margin: 0 20px; text-decoration: none; color: #ff3399; font-weight: bold; transition: color 0.3s;
}
nav a:hover { color: #cc0066; }

section {
  padding: 60px 20px; max-width: 1000px; margin: auto; position: relative; z-index: 2;
}
section h2 {
  color: #ff3399; margin-bottom: 20px; font-size: 2em; border-left: 5px solid #ff99cc; padding-left: 10px;
}

.project {
  /* Hiệu ứng hộp kính cho Card */
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 20px;
  box-shadow: 0 8px 32px 0 rgba(255, 153, 204, 0.2);
  padding: 25px; margin-bottom: 25px;
  transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.8s ease-out;
}
.project.active:hover { 
  transform: scale(1.02) translateY(-2px); 
  box-shadow: 0 12px 40px 0 rgba(255, 105, 180, 0.3); 
}

footer {
  text-align: center; padding: 20px;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.6);
  color: #ff3399; font-size: 0.9em; font-weight: bold;
}

/* ==========================================
   8. HIỆU ỨNG TRƯỢT (SCROLL REVEAL)
   ========================================== */
.reveal-on-scroll {
  opacity: 0; transform: translateY(35px); transition: opacity 0.8s ease-out, transform 0.8s ease-out; will-change: opacity, transform;
}
.reveal-on-scroll.active { opacity: 1; transform: translateY(0); }

/* ==========================================================================
   9. DARK MODE (ĐEN ĐỈNH -> XANH MÒNG KÉT ĐÁY, GIỐNG ẢNH TẢI LÊN)
   ========================================================================== */
body.dark-mode {
  /* Gradient Đen ở trên, Xanh mòng két (Teal/Slate blue) ở dưới */
  background-image: linear-gradient(to bottom, #050505 0%, #1e4554 100%);
  background-attachment: fixed;
  color: #f1f1f1;
}

body.dark-mode::before {
  opacity: 0.15; /* Hạt mờ nổi bật hơn một chút trong nền tối */
}

/* Header Dark Mode */
body.dark-mode .header-content h1 {
  color: #a3d9eb; /* Xanh nhạt sáng */
  text-shadow: 0 0 15px rgba(163, 217, 235, 0.4);
}
body.dark-mode .header-content p {
  color: #e0e0e0;
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
}
body.dark-mode .dark-toggle {
  background: rgba(43, 93, 114, 0.8); /* Màu teal nhạt cho nút */
  border: 1px solid rgba(255, 255, 255, 0.3);
}
body.dark-mode .dark-toggle:hover {
  background: rgba(62, 126, 153, 0.9);
}

/* Glassmorphism Dark Mode */
body.dark-mode nav {
  background: rgba(20, 30, 40, 0.4); /* Kính đen mờ */
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}
body.dark-mode nav a { color: #88c0d0; } /* Xanh teal sáng */
body.dark-mode nav a:hover { color: #a3d9eb; }

body.dark-mode section h2 { 
  color: #88c0d0; 
  border-left: 5px solid #4c8296; 
}
body.dark-mode .project { 
  background: rgba(25, 35, 45, 0.5); /* Kính đen mờ */
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4); 
}
body.dark-mode .project.active:hover {
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.6); 
}
body.dark-mode footer { 
  background: rgba(15, 20, 25, 0.6); 
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: #88c0d0;
}
.about-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 30px;
  margin-top: 20px;
}

.about-content {
  flex: 1; /* Chiếm phần bên trái */
}

.about-image {
  flex: 0 0 300px; /* Khung ảnh cố định 300px */
}

.about-image img {
  width: 100%;
  height: auto;
  border-radius: 15px;
  /* Hiệu ứng kính mờ cho ảnh */
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* Tự động xếp chồng khi xem trên điện thoại */
@media (max-width: 768px) {
  .about-wrapper {
    flex-direction: column;
    text-align: center;
  }
}