:root {
  --main-gradient: linear-gradient(to right, #2459a1, #3273cb, #2459a1);
  --glass-bg: rgba(255, 255, 255, 0.2);
  --glass-blur: blur(5px);
}
* {
  box-sizing: border-box;
  font-family: 'Montserrat', sans-serif;
}
body {
  margin: 0;
  background: #ededed;
  color: #222;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}
#vanta-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 0;
}
.navbar {
  background: rgb(255 255 255 / 56%);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid rgba(255,255,255,0.3);
  color: #000;
  padding: 10px 83px;
  font-size: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 1001;
}
.navbar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 50px;
}
.navbar nav a {
  color: #000;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}
.navbar nav a:hover {
  text-decoration: underline;
}
.navbar img {
  height: 48px;
}
.menu-toggle {
  display: none;
  font-size: 28px;
  color: #000;
  cursor: pointer;
  background: none;
  border: none;
  align-self: center;
}
p.note {
    text-align: center;
    font-size: 14px;
    line-height: 1.2;
}
#overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1000;
}
#overlay.active {
  display: block;
}
.close-btn {
  display: none;
}
@media (max-width: 768px) {
  .navbar {
    padding: 8px 16px;
  }
  .navbar nav {
    position: absolute;
    gap: 20px;
    top: 100%;
    right: 0;
    left: 0;
    background: rgba(255, 255, 255, 0.97);
    flex-direction: column;
    padding: 20px;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }
  .navbar nav.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .menu-toggle {
    display: block;
    margin-left: auto;
    align-self: center;
  }
  .close-btn {
    display: block;
    align-self: flex-end;
    position: absolute;
    font-size: 26px;
    font-weight: bold;
    cursor: pointer;
    background: #f2d8d8;
    padding: 15px;
    border-radius: 12px;
  }

  /* Cập nhật mới cho màn hình nhỏ hơn hoặc bằng 768px */
  .card {
    padding: 20px; /* Giảm padding cho card */
    gap: 30px; /* Giảm khoảng cách giữa các phần */
  }
  .form-section, .preview-section {
    flex: 1 1 100%; /* Cho phép các phần chiếm toàn bộ chiều rộng có sẵn */
    min-width: unset; /* Loại bỏ min-width cố định */
    padding: 0px; /* Bỏ padding tại đây vì card đã có padding */
  }
  .row {
    flex-direction: column; /* Đổi thành cột trên màn hình nhỏ */
    gap: 20px; /* Tăng khoảng cách giữa các hàng */
  }
  .group {
    width: 100%; /* Đảm bảo group chiếm 100% chiều rộng */
  }
  /* Điều chỉnh font size hoặc padding nếu cần cho các input/button */
  input[type="number"], button:not(.copy-btn):not(.menu-toggle) {
    font-size: 15px;
    padding: 10px;
  }
  .copy-btn {
    font-size: 11px;
    padding: 4px 8px;
    height: calc(100% - 8px);
  }
}
/* Dòng note gốc này đã được chuyển vị trí và style bởi .small-note */
/* p.note {
    text-align: center;
    font-size: 14px;
    line-height: 1.2;
} */


.container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 60px 20px;
  z-index: 1;
}
.card {
  position: relative;
  z-index: 2;
  max-width: 1100px;
  width: 100%;
  border-radius: 16px;
  backdrop-filter: var(--glass-blur);
  background: rgb(255 255 255 / 70%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  padding: 40px;
  display: flex;
  gap: 60px;
  flex-wrap: wrap;
}
.form-section, .preview-section {
  flex: 1 1 400px;
  /* min-width: 320px; Đã bỏ và điều chỉnh trong media query */
  padding: 10px;
}
.row {
  display: flex;
  gap: 15px;
  margin-bottom: 25px;
}
.group {
  flex: 1;
}
label {
  font-weight: 600;
  margin-bottom: 5px;
  display: block;
}
/* Kiểu dáng cho tất cả các input type="number" */
input[type="number"] {
  width: 100%;
  padding: 12px; /* Padding cơ sở cho tất cả inputs */
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.6);
}
input[type="number"]::placeholder {
  color: #999;
}

/* Container cho input và nút copy */
.input-container {
  position: relative;
  width: 100%; /* Đảm bảo nó lấp đầy chiều rộng của parent (.group) */
}

/* Điều chỉnh padding-right cho input khi có nút copy bên trong */
.input-container input[type="number"] {
  padding-right: 70px; /* Tạo không gian cho nút copy */
}

/* Kiểu dáng cho nút copy */
.copy-btn {
  position: absolute;
  right: 5px; /* Cách lề phải 5px */
  top: 50%; /* Đặt ở giữa theo chiều dọc */
  transform: translateY(-50%); /* Dịch chuyển lên 50% chiều cao của chính nó để căn giữa hoàn hảo */
  padding: 5px 10px; /* Padding nhỏ hơn cho nút */
  font-size: 12px; /* Font nhỏ hơn */
  background: #007bff; /* Màu xanh dương */
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap; /* Ngăn không cho chữ "Copy" xuống dòng */
  transition: background 0.2s ease;
  height: calc(100% - 10px); /* Chiều cao nút bằng chiều cao input trừ đi 2 * 5px (tương đương padding top/bottom) */
  display: flex; /* Dùng flex để căn giữa chữ "Copy" trong nút */
  align-items: center;
  justify-content: center;
}

.copy-btn:hover {
  background: #0056b3; /* Màu hover sẫm hơn */
}

.preview-box {
  max-width: 500px;
  margin: 0 auto;
  border: 1px solid #ccc;
  border-radius: 12px;
  overflow: hidden;
  background: #eee;
  position: relative;
}
.preview-box::before {
  content: '';
  display: block;
  padding-top: var(--ratio, 56.25%);
}
.preview-content {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}
.preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.4s;
}

/* Cập nhật quy tắc này cho nút reset */
/* Áp dụng cho button mà KHÔNG phải là .copy-btn VÀ KHÔNG phải là .menu-toggle */
button:not(.copy-btn):not(.menu-toggle) {
  background: var(--main-gradient);
  color: white;
  border: none;
  font-size: 16px;
  border-radius: 8px;
  padding: 15px 45px 15px 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.3s;
}

.reset-icon {
  animation: rotate 2s linear infinite;
}
@keyframes rotate {
  100% { transform: rotate(360deg); }
}
footer {
  text-align: center;
  padding: 20px;
  font-size: 14px;
  color: #666;
  background: transparent;
  z-index: 3;
}
footer a {
  color: #2459a1;
  text-decoration: none;
  font-weight: bold;
}

/* Thêm các kiểu dáng cho thông báo copy */
.copy-notification {
  position: fixed;
  bottom: 20px; /* Cách đáy 20px */
  left: 50%;
  transform: translateX(-50%); /* Căn giữa theo chiều ngang */
  background: rgba(40, 167, 69, 0.9); /* Màu xanh lá cây */
  color: white;
  padding: 10px 20px;
  border-radius: 5px;
  opacity: 0; /* Mặc định ẩn */
  visibility: hidden; /* Mặc định ẩn */
  transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
  z-index: 9999; /* Đảm bảo nó luôn nằm trên cùng */
  font-size: 16px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.copy-notification.show {
  opacity: 1; /* Hiện ra */
  visibility: visible; /* Hiện ra */
}

/* Kiểu dáng cho dòng note nhỏ mới */
.form-section .small-note {
  margin-top: 25px; /* Khoảng cách với nút reset */
  font-size: 0.85em; /* Kích thước nhỏ hơn */
  color: #666; /* Màu chữ nhạt hơn */
  text-align: center;
  line-height: 1.4;
}