/* ===== Reset cơ bản ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

@font-face {
  font-family: "SVN Product Sans";
  src: url("../../assets/font/SVN-Product Sans Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

body {
  font-family: "SVN Product Sans", sans-serif;
  background-color: #f9f9f9;
  color: #333;
  line-height: 1.6;
}

/* ===== Header ===== */
header {
  width: 100%;
  height: 60px;
  background: linear-gradient(90deg, #3b56e8, #007bff);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between; /* desktop */
  padding: 0 20px;
  position: fixed;
  top: 0;
  left: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 1000;
}

header h1 {
  display: flex;
  align-items: center; /* căn giữa theo chiều dọc */
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-toggle {
  display: none;
  font-size: 24px;
  cursor: pointer;
  margin-right: 10px;
}

.user-name {
  position: absolute;
  right: 20px; /* cách cạnh phải 20px */
  top: 50%;
  transform: translateY(-50%); /* căn giữa theo chiều dọc */
  font-weight: bold;
  font-size: 15px;
  color: white;
  white-space: nowrap;
}
.user-dropdown {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: white;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 5px;
  user-select: none;
}

.user-dropdown .arrow {
  display: inline-block;
  transition: transform 0.3s ease;
}

.user-dropdown.active .arrow {
  transform: rotate(180deg); /* mũi tên quay lên */
}

.dropdown-menu {
  position: absolute;
  top: 100%; /* ngay dưới user-dropdown */
  right: 0;
  background: white;
  color: black;
  border-radius: 5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  display: none; /* ẩn mặc định */
  margin-top: 5px;
  min-width: 100px;
  overflow: hidden;
  z-index: 1001;
}

.dropdown-menu button {
  font-family: "SVN Product Sans", sans-serif;
  width: 100%;
  height: 40px; /* chiều cao cố định để chữ luôn giữa */
  border: none;
  background-color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  border-radius: 6px;
  transition: all 0.2s ease;
  /* Flex để căn giữa chữ */
  display: flex;
  align-items: center; /* căn dọc */
  justify-content: center; /* căn ngang */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.dropdown-menu button:hover {
  background-color: #f0f4ff;
  color: #d81a1a;
  transform: translateY(-1px); /* dịch nhẹ lên khi hover */
}
/* ===== Container ===== */
.container {
  display: flex;
  flex-wrap: nowrap;
  margin-top: 60px; /* chiều cao header desktop */
}

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: 60px; /* chiều cao header */
  left: 0;
  width: 220px;
  height: calc(100vh - 60px);
  background-color: #fff;
  border-right: 1px solid #e0e0e0;
  padding-top: 10px;
  z-index: 999;
  transition: all 0.3s ease;
}

.sidebar ul {
  list-style: none;
}

.sidebar ul li a {
  display: flex; /* icon + text nằm hàng ngang */
  align-items: center; /* căn giữa theo chiều dọc */
  gap: 10px; /* khoảng cách icon – text */
  padding: 7px 20px;
  margin: 4px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: #333;
  font-weight: 500;
  transition: all 0.3s ease;
}

.sidebar ul li a:hover {
  background-color: #e0f0ff;
  color: #3b56e8;
}

.sidebar ul li a.active {
  background-color: #3b56e8;
  color: white;
  font-weight: bold;
}

/* Kích thước icon */
.sidebar ul li a .sidebar-icon {
  width: 18px;
  height: 18px;
}

/* Đổi màu icon SVG (chỉ nếu SVG là inline) */
/* Nếu dùng img thì cần SVG phải fill="currentColor" để đổi màu theo text*/
.sidebar ul li a:hover .sidebar-icon {
  filter: brightness(0) saturate(100%) invert(32%) sepia(88%) saturate(2195%)
    hue-rotate(198deg) brightness(96%) contrast(92%);
}

.sidebar ul li a.active .sidebar-icon {
  filter: brightness(0) invert(1); /* trắng khi active */
}

.sidebar-stats {
  margin-top: auto;
  padding: 15px;
  font-size: 13px;
  border-top: 1px solid #eee;
  color: #555;
  line-height: 1;
}

.sidebar-stats p {
  margin: 5px 0;
}
.sidebar {
  display: flex;
  flex-direction: column;
}

.sidebar ul {
  flex: 1;
}

.sidebar-stats .update-time {
  margin-top: 8px;
  font-size: 12px;
  color: #888;
}

.history-btn {
  font-family: "SVN Product Sans", sans-serif;
  width: 100%;
  padding: 8px;
  border: none;
  background: #3b56e8;
  color: white;
  border-radius: 50px;
  cursor: pointer;
  font-size: 13px;
  transition: 0.2s;
}

.history-btn:hover {
  background: #2c43c9;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}

.modal-content {
  width: 80%;
  max-height: 80%;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  font-size: 0.8rem;
  padding: 10px;
  background: #3b56e8;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#close-history {
  cursor: pointer;
  font-size: 22px;
}

.modal-body {
  padding: 10px;
  overflow: auto;
}

.modal table {
  width: 100%;
  border-collapse: collapse;
}

.modal th,
.modal td {
  border-bottom: 1px solid #eee;
  padding: 8px;
  font-size: 13px;
  text-align: left;
}

.modal td {
  word-break: break-word;
}

/* Không xuống dòng cho các cột */
#history-table td:nth-child(1),
#history-table td:nth-child(3) {
  white-space: nowrap;
}

/* Căn giữa header */
#history-modal th {
  text-align: center;
}

#history-table td:nth-child(3) {
  text-align: center;
}

#history-table td:nth-child(1),
#history-table td:nth-child(2),
#history-table td:nth-child(4) {
  text-align: justify;
  text-align-last: left;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
}
/* ===== Main content ===== */
main#content {
  margin-left: 220px;
  margin-top: 60px;
  padding: 20px;
  width: calc(100% - 220px);
  min-height: calc(100vh - 60px);
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.wifi {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  margin-left: 8px;
}

.wifi span {
  width: 3px;
  background: white;
  opacity: 0.3;
  transition: 0.3s;
}

/* chiều cao từng vạch */
.wifi span:nth-child(1) {
  height: 5px;
}
.wifi span:nth-child(2) {
  height: 8px;
}
.wifi span:nth-child(3) {
  height: 11px;
}
.wifi span:nth-child(4) {
  height: 14px;
}

/* active */
.wifi span.active {
  opacity: 1;
  background: #00ff3c;
}

@keyframes blink {
  0% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.3;
  }
}

.wifi.loading span {
  animation: blink 1s infinite;
}

@media screen and (max-width: 768px) {
  main#content {
    margin-top: 60px; /* nếu header 60px */
  }
}

@media screen and (max-width: 480px) {
  main#content {
    margin-top: 50px; /* nếu header 50px */
  }
}

.net-speed.fast {
  color: #00ffcc;
}
.net-speed.medium {
  color: #ffd166;
}
.net-speed.slow {
  color: #ff6b6b;
}
/* ===== Scrollbar đẹp ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
  background: transparent;
}

::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  transition: background-color 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-button {
  display: none;
}

/* ===== Responsive ===== */
@media screen and (max-width: 768px) {
  header {
    justify-content: flex-start; /* menu toggle bên trái */
    padding: 0 10px;
  }

  .menu-toggle {
    display: block;
    margin-right: 10px;
  }

  .sidebar {
    width: 0;
    left: -220px;
    height: calc(100vh - 60px);
  }

  .sidebar.active {
    left: 0;
    width: 220px;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
  }

  main#content {
    margin-left: 0;
    width: 100%;
    padding: 15px;
  }
}

@media screen and (max-width: 480px) {
  header {
    height: 50px;
  }

  header h1 {
    font-size: 16px;
  }

  .container {
    margin-top: 50px; /* bằng chiều cao header mobile */
  }

  .sidebar {
    top: 50px;
    height: calc(100vh - 50px);
  }

  .sidebar ul li a {
    padding: 10px 15px;
    font-size: 14px;
  }

  main#content {
    padding: 10px;
  }
}

/* ===== Desktop ===== */
.header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  height: 45px; /* chỉnh theo ý bạn */
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
  header h1 {
    display: none; /* ẩn text */
  }

  .logo {
    height: 40px; /* logo to hơn chút */
  }
}
