:root{
  --font-vi: system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  --font-jp: "Noto Sans JP","Hiragino Kaku Gothic ProN","Meiryo",sans-serif;
}
html{ font-family: var(--font-vi); }
:lang(ja), .jp { font-family: var(--font-jp); }

strong{font-family: Arial;}

* {
  box-sizing: border-box;
}
    html, body {
  height: 100%;
}
body {
  font-family: var(--font-vi);
  margin: 0;
  background: #f5f5f5;
  display: flex;
  flex-direction: column;
  min-height: 100vh; /* đảm bảo body luôn cao tối thiểu bằng chiều cao màn hình */
}
main {
  flex: 1; /* 💡 Phần còn lại sẽ được main chiếm */
  padding: 2rem;
  background: #f9f9f9;
}

header {
  background: #003366;
  color: white;
  padding: 1rem 2rem;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-img {
  height: 48px;
  width: auto;
  transition: height 0.3s ease;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: bold;
  color: #fff;
  font-family: 'Segoe UI', sans-serif;
  transition: font-size 0.3s ease;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
}

main.container {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 1.5rem;
}

.main-content {
  flex: 0 0 calc(75% - 0.75rem);
  max-width: calc(75% - 0.75rem);
  background: white;
  padding: 1rem 1.5rem;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.sidebar {
  flex: 0 0 calc(25% - 0.75rem);
  max-width: calc(25% - 0.75rem);
  background: #ffffff;
  padding: 1rem 1.5rem;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  font-size: 0.95rem;
}

footer {
  background: #003366;
  color: white;
  text-align: center;
  padding: 1rem;
}


.suggestion-item {
  padding: .25rem .5rem;
  cursor: pointer;
  border-bottom: 1px solid #ddd;
}

.suggestion-item:hover {
  background: #f0f0f0;
}

#suggestions {
  background: #fff;
  position: absolute;
  z-index: 10;
  width: 100%;
  
  top: 102%;                /* đặt ngay dưới input */
  left: 0;
  border-top: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  max-height: 300px;
  overflow-y: auto;
}

/*Phần search-bar*/
.search-bar {
  position: relative; /*Thiết kế riêng cho suggestions*/
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #fff;
  padding: 1rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  flex-wrap: wrap;
}

 /*Nhập dữ liệu tìm kiếm */
.search-bar input {
  flex-grow: 1;
  font-size: 1.1rem;
  padding: 0.6rem 0.9rem;
  font-weight: 500;
  color: #333;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-bar input:focus {
  outline: none;
  border-color: #3399ff;
  box-shadow: 0 0 0 2px rgba(51, 153, 255, 0.2);
}


/* Lựa chọn Từ vựng, Hán tự, Ngữ pháp */ 
.select-wrapper {
  position: relative;
  width: 120px;
  flex-shrink: 0;
}

.select-wrapper::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #333;
  pointer-events: none;
}

.custom-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100%;
  font-size: 1rem;
  padding: 0.5rem;
  padding-right: 2rem; /* chừa chỗ cho mũi tên */
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  color: #333;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.custom-select:hover {
  border-color: #3399ff;
}

.custom-select:focus {
  outline: none;
  border-color: #3399ff;
  box-shadow: 0 0 0 2px rgba(51, 153, 255, 0.3);
}


/* Button tìm kiếm */
.search-bar button {
  font-size: 1rem;
  padding: 0.6rem 0.9rem; /* giống với input */
  width: 100px;
  white-space: nowrap;
  flex-shrink: 0;

  background-color: #3399ff;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.search-bar button:hover {
  background-color: #007acc;
}

.search-bar button:active {
  transform: scale(0.98);
  background-color: #006bb3;
}

.search-menu-nav {
  display: flex;
  justify-content: center;
  background-color: #fff;
  padding: 0rem;
  margin-bottom:0.5rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.search-menu-item {
  flex: 1;
  padding: 0.6rem 1rem;
  font-size: 1rem;
  font-weight: 500;
  color: #333;
  background-color: #f3f3f3;
  border: none;
  border-radius: 4px; /* dạng viên thuốc */
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: 'Segoe UI', 'Noto Sans JP', sans-serif;
  outline: none;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.search-menu-item:hover {
  background-color: #f0f0f0;
}

.search-menu-item.active {
  background-color: #ffecec;
  color: #cc2222;
  font-weight: 700;
}

/* To TOP */
#toTopBtn {
  display: none;               /* Ẩn ban đầu */
  position: fixed;
  bottom: 8px;
  right: 8px;
  z-index: 99;
  font-size: 18px;
  border: none;
  outline: none;
  background-color: #3399ff;
  color: white;
  cursor: pointer;
  padding: 10px 15px;
  border-radius: 50%;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  transition: background-color 0.2s ease;
}
#toTopBtn:hover {
  background-color: #007acc;
}




/*Respontive cho mobile*/
@media (max-width: 768px) {
  .search-menu-item {
    padding: 0.25rem 0.1rem 0.45rem 0.1rem;
    font-size: 0.8rem;
  }

  main.container {
    padding: 0.5rem;
  }

  .main-content, .sidebar {
    flex: 0 0 100%;
    max-width: 100%;
    padding: 1rem;
  }

  .search-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-bar button,
  .search-bar input,
  .select-wrapper {
    width: 100%;
  }

  #toTopBtn {
    bottom: 4px;
    }

}

/*Respontive cho tablet*/
@media (min-width: 769px) and (max-width: 1024px) {
    
  main.container {
    padding: 1rem; /* Nhỏ hơn desktop nhưng lớn hơn mobile */
  }

  .main-content {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .sidebar {
    flex: 0 0 100%;
    max-width: 100%;
    margin-top: 1rem;
  }

  .search-bar {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .search-bar input,
  .select-wrapper,
  .search-bar button {
    flex: 1 1 100%;
  }

  .search-menu-item {
    font-size: 0.9rem;
    padding: 0.4rem 0.75rem;
  }

  #toTopBtn {
    bottom: 6px;
    }

}
