/*CONFIGURAÇÕES GERAIS*/
*,
*::before,
*::after {
  box-sizing: border-box;
  font-family: "Roboto", Arial, sans-serif;
}

body {
  margin: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: background-color 0.3s, color 0.3s;
}

/*VARIÁVEIS DE TEMA*/
:root {
  --bg-color: #f9f9f9;
  --text-color: #181717;
  --header-bg: #fff;
  --border-color: #ddd;
  --button-bg: #e7e7e7;
  --button-active-bg: #606060;
  --input-bg: #fff;
}

body.dark-mode {
  --bg-color: #181818;
  --text-color: #f1f1f1;
  --header-bg: #202020;
  --border-color: #333;
  --button-bg: #383838;
  --button-active-bg: #fff;
  --input-bg: #303030;
}

/*HEADER*/
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background-color: var(--header-bg);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border-color);
}

.youtube-logo {
  height: 20px;
}

/*BOTÃO DE TEMA*/
.theme-toggle {
  border: none;
  background: transparent;
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform 0.2s;
}

.theme-toggle:hover {
  transform: scale(1.2);
}

/*BARRA DE PESQUISA*/
.search-bar {
  display: flex;
  flex-grow: 1;
  margin: 0 2rem 0 4rem;
  max-width: 600px;
}

.search-input {
  width: 100%;
  font-size: 1rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border-color);
  border-right: none;
  border-radius: 2px 0 0 2px;
  outline: none;
  background-color: var(--input-bg);
  color: var(--text-color);
}

.search-input:focus {
  border-color: #065fd4;
}

.search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
  border: 1px solid var(--border-color);
  border-left: none;
  background-color: var(--button-bg);
  border-radius: 0 2px 2px 0;
  cursor: pointer;
}

.search-btn:hover {
  opacity: 0.85;
}

.search-btn img {
  width: 20px;
  height: 20px;
  filter: invert(0);
}

body.dark-mode .search-btn img {
  filter: invert(1);
}

/*MENU DE ÍCONES*/
.menu-icons {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.menu-icons img {
  width: 24px;
  height: 24px;
  cursor: pointer;
  filter: invert(0);
}

body.dark-mode .menu-icons img {
  filter: invert(1);
}

.menu-channel-icon {
  border-radius: 50%;
  width: 36px;
  height: 36px;
}

/*CATEGORIAS*/
.categories {
  padding: 1rem 2rem;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  background-color: var(--header-bg);
}

.category-section {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-section::-webkit-scrollbar {
  display: none;
}

.category {
  margin-right: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 900px;
  background-color: var(--button-bg);
  color: var(--text-color);
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.category:hover {
  background-color: var(--border-color);
}

.category.active {
  background-color: var(--button-active-bg);
  color: var(--bg-color);
}

/*SEÇÃO DE VÍDEOS*/
.videos {
  background-color: var(--bg-color);
}

.video-section {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 3rem 1rem;
  padding: 3rem 0;
  margin: 0 1.5rem;
}

.video-container {
  display: flex;
  flex-direction: column;
}

.thumbnail {
  position: relative;
}

.thumbnail img {
  width: 100%;
  border-radius: 8px;
  background-color: #aaa;
}

.thumbnail::before {
  content: attr(data-duration);
  position: absolute;
  background-color: rgba(0, 0, 0, 0.85);
  color: #fff;
  right: 5px;
  bottom: 5px;
  padding: 0.1em 0.3em;
  border-radius: 0.3em;
  font-size: 0.9rem;
}

/*DETALHES DO VÍDEO*/
.video-bottom-section {
  display: flex;
  align-items: flex-start;
  margin-top: 1rem;
}

.channel-icon {
  margin-right: 0.75rem;
  border-radius: 50%;
  width: 36px;
  height: 36px;
}

.video-details {
  display: flex;
  flex-direction: column;
}

.video-title {
  font-size: 1rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
  text-decoration: none;
  color: var(--text-color);
}

.video-title:hover {
  color: #065fd4;
}

.video-channel-name {
  text-decoration: none;
  color: #777;
}

body.dark-mode .video-channel-name {
  color: #ccc;
}

.video-metadata {
  color: #777;
  font-size: 0.9rem;
}

/*RESPONSIVIDADE*/
@media (max-width: 768px) {
  .header {
    flex-wrap: wrap;
    gap: 1rem;
  }

  .search-bar {
    margin: 0;
    order: 3;
    width: 100%;
  }

  .video-section {
    gap: 1.5rem;
    margin: 0 1rem;
    padding: 2rem 0;
  }
}
