* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #0f0f0f;
  color: #f1f1f1;
  font-family: Arial, sans-serif;
}

a {
  color: inherit;
}

button,
input,
textarea,
select {
  font-family: inherit;
}

img {
  max-width: 100%;
  display: block;
}

/* ========================= */
/* TOPO */
/* ========================= */

.yt-topbar {
  min-height: 56px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #0f0f0f;
  border-bottom: 1px solid #222;
  position: sticky;
  top: 0;
  z-index: 50;
}

.left-top,
.right-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-btn {
  background: transparent;
  color: white;
  border: none;
  font-size: 22px;
  cursor: pointer;
}

.yt-logo {
  color: #ff0033;
  font-weight: 900;
  font-size: 24px;
  text-decoration: none;
  white-space: nowrap;
}

.search-wrap {
  flex: 1;
  max-width: 680px;
  display: flex;
  align-items: center;
}

.search-wrap input {
  flex: 1;
  height: 40px;
  background: #121212;
  color: white;
  border: 1px solid #333;
  border-radius: 999px 0 0 999px;
  padding: 0 18px;
  outline: none;
}

.search-wrap button {
  height: 40px;
  min-width: 60px;
  border: 1px solid #333;
  border-left: none;
  background: #222;
  color: white;
  border-radius: 0 999px 999px 0;
  cursor: pointer;
}

#sortSelect {
  background: #222;
  color: white;
  border: 1px solid #333;
  padding: 9px 12px;
  border-radius: 10px;
}

.create-btn,
.upload-btn {
  background: #272727;
  color: white;
  text-decoration: none;
  padding: 9px 14px;
  border-radius: 999px;
  font-weight: bold;
  border: none;
  cursor: pointer;
  display: inline-block;
}

.create-btn:hover,
.upload-btn:hover {
  background: #3a3a3a;
}

.logout-btn {
  background: #222;
  color: white;
  border: none;
  padding: 9px 14px;
  border-radius: 999px;
  cursor: pointer;
}

/* ========================= */
/* AVATARES */
/* ========================= */

.top-avatar,
.video-avatar,
.watch-avatar,
.comment-avatar,
.channel,
.avatar,
.big-avatar {
  background: #ff0033;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
}

.top-avatar,
.video-avatar,
.watch-avatar,
.comment-avatar,
.channel,
.avatar {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  text-decoration: none;
}

.big-avatar {
  width: 96px;
  height: 96px;
  min-width: 96px;
  border-radius: 50%;
  font-size: 38px;
}

.top-avatar img,
.video-avatar img,
.watch-avatar img,
.comment-avatar img,
.channel img,
.avatar img,
.big-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ========================= */
/* HOME */
/* ========================= */

.yt-layout {
  display: flex;
}

.yt-sidebar {
  width: 230px;
  padding: 12px;
  flex-shrink: 0;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
}

.yt-sidebar a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: white;
  text-decoration: none;
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 4px;
}

.yt-sidebar a:hover,
.yt-sidebar .active {
  background: #272727;
}

.yt-home {
  flex: 1;
  min-width: 0;
  padding: 18px 24px;
}

.chips {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 8px;
}

.chips button {
  background: #272727;
  color: white;
  border: none;
  padding: 9px 14px;
  border-radius: 10px;
  white-space: nowrap;
  cursor: pointer;
}

.chips button:hover,
.active-chip {
  background: white !important;
  color: black !important;
}

.home-stats {
  color: #aaa;
  font-size: 14px;
  margin: 0 0 18px;
}

.yt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 30px 18px;
}

.yt-card {
  cursor: pointer;
}

.yt-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  background: #222;
  overflow: hidden;
}

.yt-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.yt-info {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.yt-text {
  min-width: 0;
  flex: 1;
}

.yt-text h2 {
  font-size: 16px;
  line-height: 1.35;
  margin: 0 0 6px;
  color: white;
}

.yt-channel-name {
  color: #aaa;
  font-size: 14px;
  text-decoration: none;
}

.yt-channel-name:hover {
  color: white;
}

.yt-text p {
  color: #aaa;
  font-size: 14px;
  margin: 4px 0;
}

.dots {
  background: transparent;
  color: white;
  border: none;
  font-size: 20px;
  cursor: pointer;
}

/* ========================= */
/* WATCH PAGE */
/* ========================= */

.yt-watch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 24px;
  padding: 24px;
  align-items: start;
}

.yt-watch-main {
  min-width: 0;
}

.video-player-box {
  width: 100%;
  max-height: 72vh;
  background: black;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#player {
  width: 100%;
  background: black;
}

.video-player-box video {
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
}

.video-player-box .plyr {
  width: 100%;
}

.video-player-box .plyr__video-wrapper {
  max-height: 72vh;
}

.plyr {
  border-radius: 16px;
  overflow: hidden;
}

.plyr--video {
  background: black;
}

.watch-title {
  font-size: 22px;
  line-height: 1.35;
  margin: 14px 0 12px;
}

.watch-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.watch-channel-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.watch-owner-name {
  color: white;
  font-weight: bold;
  text-decoration: none;
}

.watch-channel-box p {
  color: #aaa;
  margin: 4px 0 0;
  font-size: 13px;
}

.subscribe-pill {
  background: white;
  color: black;
  border: none;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: bold;
  cursor: pointer;
  margin-left: 10px;
}

.watch-buttons {
  display: flex;
  gap: 8px;
}

.watch-buttons button {
  background: #272727;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 999px;
  font-weight: bold;
  cursor: pointer;
}

.watch-buttons button:hover {
  background: #3a3a3a;
}

.yt-description-box {
  background: #272727;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 18px;
}

.yt-description-box strong {
  display: block;
  margin-bottom: 8px;
}

.yt-description-box p {
  white-space: pre-wrap;
  margin: 0;
  color: #ddd;
  line-height: 1.5;
}

/* Recomendações no canto */
.yt-recommendations {
  min-width: 0;
  align-self: start;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  padding-right: 6px;
}

.yt-rec-card {
  display: grid;
  grid-template-columns: 168px 1fr 24px;
  gap: 10px;
  margin-bottom: 12px;
  cursor: pointer;
}

.yt-rec-thumb {
  aspect-ratio: 16 / 9;
  background: #222;
  border-radius: 10px;
  overflow: hidden;
}

.yt-rec-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.yt-rec-info {
  min-width: 0;
}

.yt-rec-info h3 {
  font-size: 14px;
  line-height: 1.3;
  margin: 0 0 5px;
}

.yt-rec-info p {
  margin: 2px 0;
  color: #aaa;
  font-size: 13px;
}

/* ========================= */
/* COMENTÁRIOS / PAINÉIS */
/* ========================= */

.yt-panel,
.yt-comments,
.comments-box {
  background: transparent;
  margin-top: 22px;
}

.yt-panel {
  background: #181818;
  padding: 18px;
  border-radius: 16px;
}

.comments-header h2 {
  font-size: 20px;
}

.yt-comment-form,
.comment-form {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.yt-comment-form input,
.comment-form input {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 1px solid #555;
  color: white;
  padding: 10px;
  outline: none;
}

.yt-comment-form input:focus,
.comment-form input:focus {
  border-bottom-color: #3ea6ff;
}

.yt-comment-form button,
.comment-form button {
  background: #3ea6ff;
  color: black;
  border: none;
  padding: 9px 14px;
  border-radius: 999px;
  font-weight: bold;
  cursor: pointer;
}

.yt-comment {
  display: flex;
  gap: 12px;
  margin: 18px 0;
}

.yt-comment strong {
  margin-right: 8px;
}

.yt-comment span {
  color: #aaa;
  font-size: 13px;
}

.yt-comment p {
  white-space: pre-wrap;
  margin: 6px 0;
  color: #ddd;
}

.playlist-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #111;
  border: 1px solid #252525;
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 10px;
}

.playlist-row p {
  color: #aaa;
  margin: 4px 0 0;
}

.playlist-row button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========================= */
/* CHANNEL / HISTORY / PLAYLIST */
/* ========================= */

.content {
  flex: 1;
  padding: 24px;
  min-width: 0;
}

.channel-banner {
  background: linear-gradient(135deg, #181818, #111);
  border-radius: 22px;
  padding: 28px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.channel-banner h1 {
  margin: 0 0 8px;
  font-size: 32px;
}

.channel-banner p {
  color: #aaa;
  margin: 0 0 12px;
}

.videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 22px;
}

.card {
  cursor: pointer;
}

.thumb {
  background: #222;
  border-radius: 15px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.thumb img,
.thumb video,
.mini-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.info {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.text {
  min-width: 0;
  width: 100%;
}

.text h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
}

.text p {
  margin: 4px 0;
  color: #aaa;
  font-size: 14px;
  line-height: 1.4;
}

.channel-link {
  color: #aaa;
  text-decoration: none;
}

.channel-link:hover {
  color: #3ea6ff;
}

/* ========================= */
/* LOGIN */
/* ========================= */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f0f0f;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #181818;
  padding: 28px;
  border-radius: 18px;
  text-align: center;
}

.login-card h1 {
  color: #ff0033;
}

.login-card input {
  width: 100%;
  margin: 10px 0;
  padding: 13px;
  border-radius: 10px;
  border: 1px solid #333;
  background: #111;
  color: white;
}

.login-card button {
  width: 100%;
  padding: 12px;
  margin-top: 10px;
  border: none;
  border-radius: 10px;
  background: #3ea6ff;
  color: black;
  font-weight: bold;
  cursor: pointer;
}

.login-card .secondary {
  background: #272727;
  color: white;
}

.login-card a {
  display: block;
  color: #3ea6ff;
  margin-top: 16px;
  text-decoration: none;
}

#message {
  color: #ff5555;
}

/* ========================= */
/* UPLOAD */
/* ========================= */

.upload-page {
  min-height: calc(100vh - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.upload-card {
  width: 100%;
  max-width: 620px;
  background: #181818;
  padding: 30px;
  border-radius: 18px;
}

.upload-card h1 {
  margin-top: 0;
}

.upload-card label,
.dashboard-card label {
  display: block;
  color: #aaa;
  margin-top: 12px;
  font-size: 14px;
}

.upload-card input,
.upload-card textarea {
  width: 100%;
  margin: 10px 0;
  padding: 13px;
  border-radius: 10px;
  border: 1px solid #333;
  background: #111;
  color: white;
  resize: vertical;
}

.upload-card textarea {
  min-height: 110px;
}

.upload-card input[type="file"] {
  border: 1px dashed #444;
}

.upload-card button {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 999px;
  background: #3ea6ff;
  color: black;
  font-weight: bold;
  cursor: pointer;
  margin-top: 14px;
}

#status {
  margin-top: 20px;
  color: #ccc;
}

/* Barra de upload */
.progress-box {
  margin: 16px 0;
}

.progress-bar {
  width: 100%;
  height: 14px;
  background: #222;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #333;
}

#progressFill {
  width: 0%;
  height: 100%;
  background: #3ea6ff;
  transition: width 0.2s ease;
}

#progressText {
  color: #aaa;
  font-size: 14px;
  margin-top: 8px;
}

/* ========================= */
/* DASHBOARD */
/* ========================= */

.dashboard-page {
  padding: 24px;
}

.dashboard-card {
  background: #181818;
  padding: 22px;
  border-radius: 18px;
  margin-bottom: 24px;
}

.profile-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 16px 0;
}

.dashboard-card input,
.dashboard-card textarea {
  width: 100%;
  max-width: 560px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #333;
  background: #111;
  color: white;
  margin: 8px 0 12px;
  resize: vertical;
}

.dashboard-card textarea {
  min-height: 90px;
}

.dashboard-card button {
  padding: 11px 16px;
  border: none;
  border-radius: 999px;
  background: #3ea6ff;
  color: black;
  font-weight: bold;
  cursor: pointer;
}

.dashboard-video-card {
  background: #111;
  border-radius: 18px;
  padding: 12px;
}

.delete-btn {
  margin-top: 8px;
  background: #ff4444 !important;
  color: white !important;
  border: none;
  padding: 8px 11px;
  border-radius: 999px;
  cursor: pointer;
}

.edit-status {
  color: #3ea6ff !important;
  font-size: 14px;
}

#profileMessage {
  color: #aaa;
}

/* ========================= */
/* RESPONSIVO */
/* ========================= */

@media (max-width: 1200px) {
  .yt-watch-layout {
    grid-template-columns: minmax(0, 1fr) 340px;
  }

  .yt-rec-card {
    grid-template-columns: 140px 1fr 20px;
  }
}

@media (max-width: 980px) {
  .yt-watch-layout {
    grid-template-columns: 1fr;
  }

  .yt-recommendations {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .yt-rec-card {
    grid-template-columns: 170px 1fr 24px;
  }
}

@media (max-width: 760px) {
  .yt-topbar {
    flex-wrap: wrap;
    padding: 10px;
  }

  .search-wrap {
    order: 3;
    min-width: 100%;
  }

  .right-top {
    flex-wrap: wrap;
  }

  .yt-layout {
    display: block;
  }

  .yt-sidebar {
    width: 100%;
    height: auto;
    position: static;
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 10px;
  }

  .yt-sidebar a {
    white-space: nowrap;
    background: #181818;
  }

  .yt-home,
  .content,
  .dashboard-page,
  .yt-watch-layout {
    padding: 14px;
  }

  .yt-grid,
  .videos-grid {
    grid-template-columns: 1fr;
  }

  .yt-rec-card {
    grid-template-columns: 140px 1fr 20px;
  }

  .watch-actions-row {
    align-items: flex-start;
  }

  .watch-channel-box {
    flex-wrap: wrap;
  }

  .channel-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .big-avatar {
    width: 72px;
    height: 72px;
    min-width: 72px;
    font-size: 30px;
  }

  .yt-comment-form,
  .comment-form {
    align-items: stretch;
    flex-direction: column;
  }

  .playlist-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .create-btn,
  .upload-btn,
  .logout-btn {
    padding: 9px 11px;
    font-size: 14px;
  }
}