 body {
  box-sizing: border-box;
  font-family: Roboto, Arial, sans-serif;
  /* Thêm padding-top để tránh header cố định che mất nội dung */
  padding-top: 57px; 
}
.header {
  display: flex;
  height: 57px;
  border-bottom: 1px solid rgb(222, 222, 222);
  margin-bottom: 20px;
  justify-content: space-between;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: white;
  z-index: 100;
}

.left-section {
  display: flex;
  align-items: center;
}
.fa-bars {
  height: 24px;
  width: 24px;
  margin-left: 24px;
  margin-right: 24px;
  cursor: pointer;
  font-size: 25px;
  cursor: pointer;
}
.logo-ytb {
  width: 90px;
  height: 20px;
  cursor: pointer;
}
.middle-section {
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 470px;
  margin-left: 60px;
}
.search {
  font-family: Roboto, Arial, sans-serif;
  height: 40px;
  width: 0;
  flex: 1;
  padding-left: 12px;
  font-size: 16px;
  border: 1px solid rgb(204, 204, 204);
  border-radius: 2px;
  box-shadow: inset 0px 1px 2px rgb(238, 238, 238);
}
.btn-search,
.voice,
.create-video-btn,
.youtube-app-btn,
.notifications-btn {
  display: flex;
  justify-content: center;
  position: relative;
  align-items: center;
}
.btn-search .tooltips,
.voice .tooltips, 
.create-video-btn .tooltips, 
.youtube-app-btn .tooltips,
.notifications-btn .tooltips {
  position: absolute;
  bottom: -40px ;
  right: 5px;
  background-color: rgb(171, 171, 171);
  padding: 5px 10px;
  border-radius: 2px;
  color: white;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}
.voice .tooltips {
  right: -50px;
}
.youtube-app-btn .tooltips,.notifications-btn .tooltips {
  right: -40px;
}
.create-video-btn .tooltips {
  right: -15px;
}

.btn-search:hover .tooltips,
.voice:hover .tooltips,
.create-video-btn:hover .tooltips,
.youtube-app-btn:hover .tooltips,
.notifications-btn:hover .tooltips {
  opacity: 1;
}
.fa-magnifying-glass {
  font-size: 17px;
  color: rgb(81, 80, 80);
  cursor: pointer;
}
.btn-search {
  border: 1px solid rgb(204, 204, 204);
  height: 44px;
  width: 70px;
  padding-right: 6px;
  padding-bottom: 1px;
  border-radius: 2px;
  background-color: #f7f7f7;
  cursor: pointer;
}
.btn-search:hover {
  background-color: #edecec;
}
.fa-microphone {
  font-size: 18px;
  cursor: pointer;
}
.voice {
  background-color: #f7f7f7;
  height: 42px;
  width: 42px;
  border: none;
  border-radius: 20px;
  margin-left: 10px;
  cursor: pointer;
}

.right-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 182px;
  margin-right: 24px;
  margin-left: 29px;
  flex-shrink: 0;
}
.add-video {
  width: 24px;
  height: 24px;
  cursor: pointer;
}
.youtube-app {
  width: 24px;
  height: 24px;
  cursor: pointer;
}
.notifications {
  width: 24px;
  height: 24px;
  cursor: pointer;
}
.number {
  width: 13px;
  height: 15px;
  background-color: rgb(206, 17, 17);
  color: white;
  border: none;
  font-weight: bold;
  font-size: 10px;
  border-radius: 10px;
  position: absolute;
  top: 0px;
  right: -3px;
  padding-right: 11px;
  cursor: pointer;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 16px;
  cursor: pointer;
}
.sidebar {
  position: fixed;
  width: 72px;
  top: 56px;
  left: 0;
  bottom: 0;
  padding-top: 4px;
  background-color: white;
  z-index: 200;
}
.sidebar-link {
  font-size: 10px;
  height: 74px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}
.sidebar-link:hover {
  background-color: #e9e6e6;
}
.sidebar-link img {
  height: 24px;
  margin-bottom: 6.5px;
}

main {
  position: relative; 
  margin: -10px -8.3px -10px 64px ;
  padding: 20px 24px 10px 24px;
  background-color: rgb(247, 247, 247);
}
.video-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  column-gap: 10px;
  row-gap: 22px;
  padding: 12px;
}
@media (max-width: 1100px) {
  .video-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}
@media (max-width:800px) {
  .video-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.video-card {
  padding: 4px;
  vertical-align: top;
}
.thumbnail-container {
  position: relative;
}
.thumbnail {
  width: 100%; 
  height: auto;
  border-radius: 5px;
}
.video-time {
    position: absolute;
    bottom: 10px;
    right: 10px;
    color: white;
    background-color: rgba(0, 0, 0, 0.9);
    font-size: 12px;
    padding: 4px;
    border-radius: 2px;
    font-weight: 500;
}
.video-info-grid {
  display: grid;
  grid-template-columns: 48px 1fr;
}
.channel-profile a img {
  width: 36px;
  border-radius: 36px;
  margin-top: 10px;
}
.video-title {
  font-size: 14px;
  font-weight: bold;
  margin-top: 10px;
}
.video-title a {
  text-decoration: none;
  color: black;
}
.channel-name {
  text-decoration: none;
  font-size: 12px;
  margin-top: 10px;
  color: #606060;
}
.video-stats {
  font-size: 12px;
  margin-top: 4px;
  margin-bottom: 12px;
  color: #606060;
}


@media (max-width: 600px) {
  .header {
    height: 50px;
    right: 0;
  }
  body {
    padding-top: 50px;
    padding-bottom: 0; 
  }

  .fa-bars {
    display: none;
  }
  .left-section {
    margin-left: 10px;
    flex: 1;
    justify-content: flex-start;
  }
  .middle-section {
    display: none;
  }
  .right-section {
    width: auto;
    margin-left: 0;
    margin-right: 10px;
    justify-content: flex-end;
  }
  .add-video,
  .youtube-app,
  .notifications,
  .number {
    display: none;
  }
  .right-section .avatar {
    margin-left: 15px;
  }
  .right-section::before {
    content: "\f002"; 
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 20px;
    color: rgb(81, 80, 80);
    cursor: pointer;
  }
  
  main {
    position: relative;
    margin-left: 0;
    padding: 10px 0;
    min-width: initial;
    padding-bottom: 56px; 
  }

  .video-grid {
    grid-template-columns: 1fr; 
    column-gap: 0;
    row-gap: 15px;
    padding: 0 10px;
  }
  .video-card {
    padding: 0;
  }

  .sidebar {
    position: fixed;
    bottom: 0;
    top: auto; 
    left: 0;
    right: 0;
    width: 100%; 
    height: 56px; 
    padding-top: 0;
    border-top: 1px solid rgb(222, 222, 222);
    display: flex; 
    justify-content: space-around; 
    align-items: center;
    z-index: 200;
  }
  .sidebar-link {
    height: 100%;
    flex: 1; 
    margin: 0;
    padding: 0;
  }
}

@media (max-width: 768px) {
  .thumbnail-container {
    padding: 0 10px;
  }
  .thumbnail {
    width: 100%;
  }
  .video-info-grid {
    padding: 0 10px;
  }
  .video-time {
    right: 20px;
  }
}