/* --- CSS VARIABLES & RESET --- */
:root {
  --bg-color: #ffffff;
  --text-color: #1a1a1a;
  --accent-color: #0065ff; /* Màu xanh tin cậy */
  --accent-hover: #0052cc;
  --code-bg: #1e1e1e;
  --code-text: #e0e0e0;
  --gray-light: #f5f5f7;
  --gray-medium: #888;
  --transition: all 0.3s ease;
  --container-width: 800px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}
ul {
  list-style: none;
}

/* --- HEADER --- */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  z-index: 1000;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.logo {
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--text-color);
}

/* Hamburger Menu Icon */
.hamburger-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 1002;
}

.hamburger-line {
  width: 24px;
  height: 2px;
  background-color: var(--text-color);
  transition: var(--transition);
}

/* Hamburger Animation */
.nav-active .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.nav-active .hamburger-line:nth-child(2) {
  opacity: 0;
}
.nav-active .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Navigation Overlay */
.nav-overlay {
  position: fixed;
  top: 0;
  right: -100%;
  width: 300px; /* Độ rộng menu */
  height: 100vh;
  background-color: var(--bg-color);
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  padding-top: 80px;
  transition: var(--transition);
  z-index: 1001;
}

.nav-overlay.active {
  right: 0;
}

.nav-links li {
  margin-bottom: 20px;
}
.nav-links a {
  display: block;
  padding: 10px 30px;
  font-size: 1.1rem;
  font-weight: 500;
}
.nav-links a:hover {
  color: var(--accent-color);
  background: var(--gray-light);
}

/* Backdrop click to close */
.backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
  z-index: 1000;
}
.backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* --- MAIN CONTENT --- */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 120px 20px 60px;
  max-width: var(--container-width);
  margin: 0 auto;
}

h1 {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 16px;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

h1 span {
  color: var(--accent-color);
}

.subtitle {
  font-size: 0.9rem;
  color: var(--gray-medium);
  margin-bottom: 40px;
  max-width: 600px;
}

/* --- COMMAND BOX --- */
.cmd-wrapper {
  background-color: var(--code-bg);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 650px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  border: 1px solid #333;
  position: relative;
  overflow: hidden;
}

.cmd-text {
  font-family: "JetBrains Mono", monospace;
  color: #4ade80; /* Màu xanh neon dễ chịu */
  font-size: 0.95rem;
  overflow-x: auto;
  white-space: nowrap;
  margin-right: 15px;
  text-align: left;
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */
}
.cmd-text::-webkit-scrollbar {
  display: none;
}

.copy-btn {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  font-family: "Inter", sans-serif;
}

.copy-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
}
.copy-btn:active {
  transform: scale(0.95);
}

.copy-success {
  background-color: #4ade80 !important;
  color: #000 !important;
}

/* --- FEATURES GRID (Optional but good for homepage) --- */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
  margin-top: 60px;
  width: 100%;
}
.feature-item h3 {
  font-size: 1rem;
  margin-bottom: 5px;
}
.feature-item p {
  font-size: 0.85rem;
  color: var(--gray-medium);
}

/* --- FOOTER --- */
footer {
  border-top: 1px solid var(--gray-light);
  padding: 40px 20px;
  text-align: center;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
  margin-bottom: 20px;
}

.footer-nav a {
  font-size: 0.9rem;
  color: var(--gray-medium);
  font-weight: 500;
}

.footer-nav a:hover {
  color: var(--accent-color);
}

.copyright {
  font-size: 0.8rem;
  color: #999;
}

/* --- RESPONSIVE FIX (FINAL) --- */
@media (max-width: 600px) {
  /* Lớp bảo vệ 1: Ngăn cuộn ngang toàn trang tuyệt đối */
  html,
  body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
  }

  main {
    /* Giảm padding để có thêm không gian cho nội dung ở màn hình nhỏ */
    padding: 110px 16px 40px;
    width: 100%; /* Đảm bảo main không vượt quá body */
  }

  h1 {
    font-size: 1.8rem; /* Giảm size chữ để tiêu đề không bị gãy từ xấu */
    line-height: 1.2;
  }

  /* Lớp bảo vệ 2: Xử lý khối Command Box triệt để */
  .cmd-wrapper {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px; /* Giảm padding một chút để tiết kiệm diện tích */

    /* Quan trọng: ép buộc chiều rộng tính cả border/padding */
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .cmd-text {
    margin-right: 0;
    text-align: left;
    font-size: 0.8rem;

    /* QUAN TRỌNG NHẤT: Kỹ thuật 'min-width: 0' trong Flexbox/Grid */
    /* Giúp container con hiểu rằng nó được phép nhỏ hơn nội dung của nó */
    min-width: 0;
    width: 100%;

    display: block;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 5px;
  }

  .copy-btn {
    width: 100%;
    padding: 12px 0; /* Vùng bấm lớn cho ngón tay */
  }

  /* Lớp bảo vệ 3: Grid an toàn cho màn hình siêu nhỏ (320px) */
  .features {
    margin-top: 40px;
    display: flex; /* Chuyển sang Flex column thay vì Grid để kiểm soát tốt hơn */
    flex-direction: column;
    gap: 24px;
  }

  .feature-item {
    width: 100%;
  }
}