/* ==========================================================================
   STYLE HUONG DAN SU DUNG - SLATE CHARCOAL THEME (XÁM KHÓI HIỆN ĐẠI)
   (Modern slate gray backdrop, elevated charcoal cards, GIS teal accents)
   ========================================================================== */

:root {
  --yt-bg-main: #394d60;
  /* Màu nhạt hơn #2f4050 đúng 1 bậc (Lightness từ 25% lên 30%) */
}

html,
body {
  height: 100% !important;
  overflow: hidden !important;
}

body {
  color: #f1f5f9 !important;
  background: var(--yt-bg-main, slategray) !important;
  font-family: "Roboto", Arial, sans-serif !important;
}

#wrapper {
  height: 100vh !important;
  overflow: hidden !important;
}

body.elearning-standalone #page-wrapper {
  width: 100% !important;
  margin-left: 0 !important;
}

body.elearning-standalone .navbar-static-side {
  display: none !important;
}

body.elearning-standalone .external-toggle-wrapper {
  display: none !important;
}

#page-wrapper {
  padding: 0 !important;
  background: var(--yt-bg-main, slategray) !important;
  border-left: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: none !important;
  scrollbar-width: thin;
  scrollbar-color: #475569 var(--yt-bg-main, slategray);
  transition: margin 0.35s ease, width 0.35s ease !important;
  min-height: 0 !important;
}

.navbar-static-side {
  border-right: none !important;
  box-shadow: none !important;
}

#page-wrapper::-webkit-scrollbar,
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

#page-wrapper::-webkit-scrollbar-track,
::-webkit-scrollbar-track {
  background: #1b2330;
}

#page-wrapper::-webkit-scrollbar-thumb,
::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 4px;
}

#page-wrapper::-webkit-scrollbar-thumb:hover,
::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* Nút thu phóng menu trái (Núm thu ra vô) */
.external-toggle-wrapper {
  top: 15px !important;
  z-index: 2002 !important;
}

.minimalize-styl-2 {
  background: #1ab394 !important;
  color: #ffffff !important;
  border: 1px solid #1ab394 !important;
  border-left: none !important;
  box-shadow: none !important;
  transition: all 0.2s ease !important;
}

.minimalize-styl-2:hover {
  background: #2dd4bf !important;
  border-color: #2dd4bf !important;
  box-shadow: none !important;
}

.minimalize-styl-2 i {
  color: #ffffff !important;
}

#id_huongdansudung_group_body {
  padding: 0 !important;
  margin: 0 !important;
  background: var(--yt-bg-main, slategray) !important;
  min-height: 0 !important;
}

/* ==========================================================================
   1. THANH HEADER CHUẨN YOUTUBE (TOPBAR SLATE)
   ========================================================================== */
.yt-header-bar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 48px;
  padding: 0 12px;
  background: #202A34 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  box-sizing: border-box;
}

@media (max-width: 680px) {
  .yt-header-bar {
    justify-content: flex-start;
  }
}

/* Cụm nút chuyển kênh góc phải trên cùng chuẩn YouTube */
.yt-header-right {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.yt-header-channel-switchers {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.yt-header-channel-switchers::-webkit-scrollbar {
  display: none;
}

.yt-channel-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #273344;
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.yt-channel-tab-btn:hover:not(.is-active) {
  background: #334358;
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

.yt-channel-tab-btn.is-active {
  background: #273344;
  color: #ffffff;
  border: 2px solid #1ab394;
  font-weight: 600;
  box-shadow: none;
}

.yt-tab-logo {
  width: 18px;
  height: 18px;
  object-fit: contain;
  border-radius: 3px;
  flex-shrink: 0;
  display: inline-block;
}

.yt-tab-count {
  font-size: 12px;
  opacity: 0.9;
  margin-left: 2px;
}

/* ==========================================================================
   2. KHUNG NỘI DUNG CHÍNH (YOUTUBE WATCH CONTAINER)
   ========================================================================== */
.yt-watch-container {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 402px;
  gap: 15px;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 15px;
  box-sizing: border-box;
  background: var(--yt-bg-main, slategray) !important;
}

/* ==========================================================================
   3. CỘT PHÁT VIDEO CHÍNH (TRÁI / GIỮA)
   ========================================================================== */
.yt-primary-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Màn hình phát video tràn viền 16:9 sắc nét */
.yt-video-player-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.yt-video-player-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.yt-video-player-screen video,
.yt-video-player-screen iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  object-fit: contain;
}

/* Tiêu đề Video chuẩn YouTube */
.yt-watch-title {
  font-size: 20px;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.4;
  margin: 12px 0 10px 0;
  letter-spacing: -0.01em;
}

/* Hàng thông tin Channel & Các nút thao tác */
.yt-watch-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

/* Khối thông tin Channel */
.yt-channel-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.yt-channel-avatar-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #253244;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.yt-channel-avatar-circle img,
.yt-author-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
  display: block;
}

.yt-channel-meta-text {
  display: flex;
  flex-direction: column;
}

.yt-channel-title-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.yt-channel-title {
  font-size: 15.5px;
  font-weight: 600;
  color: #f8fafc;
  line-height: 1.2;
}

.yt-verified-icon {
  font-size: 15px;
  color: #10b981 !important;
}

.yt-verified-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 5px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.yt-verified-badge:hover {
  transform: scale(1.15);
}

/* Nhóm nút tác vụ Like, Share, Zalo dạng viên thuốc */
.yt-action-buttons-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.yt-action-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: 18px;
  background: #253244;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f1f5f9 !important;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none !important;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.yt-action-pill-btn:hover {
  background: #2e3d52;
  border-color: #1ab394;
  color: #2dd4bf !important;
  box-shadow: 0 0 10px rgba(26, 179, 148, 0.25);
}

.yt-action-pill-btn.is-liked {
  background: rgba(26, 179, 148, 0.2) !important;
  border-color: #1ab394 !important;
  color: #2dd4bf !important;
  box-shadow: 0 0 10px rgba(26, 179, 148, 0.3) !important;
}

#yt-btn-open-youtube:hover {
  border-color: #ef4444 !important;
  color: #ffffff !important;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.35) !important;
}

#yt-btn-toggle-blog:hover {
  border-color: #f59e0b !important;
  color: #fbbf24 !important;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.35) !important;
}

#yt-btn-webview-to-video {
  border-color: rgba(26, 179, 148, 0.5) !important;
  background: rgba(26, 179, 148, 0.15) !important;
  color: #2dd4bf !important;
}

#yt-btn-webview-to-video:hover {
  background: #1ab394 !important;
  border-color: #1ab394 !important;
  color: #ffffff !important;
  box-shadow: 0 0 12px rgba(26, 179, 148, 0.45) !important;
}

.yt-action-pill-btn.is-liked i {
  color: #2dd4bf !important;
}

/* Hộp mô tả Video (Description Card Slate) */
.yt-description-container {
  background: #222d3d;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 16px 18px;
  font-size: 14px;
  line-height: 1.5;
  color: #e2e8f0;
  margin-top: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: border-color 0.2s;
}

.yt-description-meta-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #f8fafc;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.yt-desc-dot {
  color: #94a3b8;
  font-size: 11px;
}

.yt-desc-summary {
  margin: 0 0 14px 0;
  color: #cbd5e1;
  font-size: 14px;
  line-height: 1.6;
}

.yt-desc-steps-section {
  background: #18202c;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.yt-steps-heading {
  font-size: 13.5px;
  font-weight: 700;
  color: #2dd4bf;
  margin: 0 0 10px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.yt-steps-ordered-list {
  margin: 0;
  padding-left: 20px;
}

.yt-steps-ordered-list.yt-steps-source-numbered {
  list-style: none;
}

.yt-steps-ordered-list li {
  margin-bottom: 6px;
  color: #cbd5e1;
  font-size: 13.5px;
}

.yt-steps-ordered-list li:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   4. CỘT PLAYLIST BÊN PHẢI (CHUẨN DANH SÁCH YOUTUBE SLATE)
   ========================================================================== */
.yt-secondary-col {
  min-width: 0;
}

.yt-sidebar-sticky {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Hộp banner "Tiếp theo: ..." chuẩn YouTube */
.yt-upnext-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #222d3d;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.yt-upnext-text {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.yt-upnext-label {
  font-weight: 600;
  color: #94a3b8;
  flex-shrink: 0;
}

.yt-upnext-title {
  font-weight: 600;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.yt-upnext-status {
  font-size: 11px;
  font-weight: 600;
  color: #2dd4bf;
  background: rgba(45, 212, 191, 0.15);
  border: 1px solid rgba(45, 212, 191, 0.35);
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}

/* Danh sách Card video nằm ngang chuẩn YouTube Slate */
.yt-sidebar-video-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.yt-video-card-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px 5px 5px;
  border-radius: 10px;
  background: #222d3d;
  border: 2px solid transparent;
  text-decoration: none !important;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: none;
}

.yt-video-card-item:hover:not(.is-active) {
  background: #283649;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25) !important;
  transform: translateY(-1px);
}

.yt-video-card-item.is-active {
  background: #222d3d !important;
  border: 2px solid #1ab394 !important;
  box-shadow: none !important;
}

.yt-video-card-item.is-active:hover {
  border-color: #1ab394 !important;
  box-shadow: none !important;
}

/* Số thứ tự ở góc dưới bên phải Card */
.yt-card-corner-index {
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  padding: 1px 5px;
  line-height: 1.2;
  user-select: none;
  transition: all 0.15s ease;
}

.yt-video-card-item:hover:not(.is-active) .yt-card-corner-index {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.15);
}

.yt-video-card-item.is-active .yt-card-corner-index {
  color: #2dd4bf;
  border-color: rgba(45, 212, 191, 0.4);
  background: rgba(26, 179, 148, 0.18);
  font-weight: 700;
}

/* Khung Thumbnail bên trái của Card (156px x 88px) cách đều trên, dưới, trái 5px */
.yt-card-thumb-wrap {
  position: relative;
  width: 156px;
  min-width: 156px;
  height: 88px;
  border-radius: 6px;
  overflow: hidden;
  background: #141b24;
  border: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

.yt-card-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Huy hiệu thời lượng góc dưới thumbnail */
.yt-card-badge-duration {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.85);
  color: #ffffff;
  font-size: 12px;
  font-weight: 500;
  padding: 1px 4px;
  border-radius: 4px;
  line-height: 1.2;
}

/* Thông tin Card bên phải */
.yt-card-details {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  flex: 1;
  padding: 6px 8px 6px 0;
}

.yt-card-item-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #f8fafc;
  line-height: 1.35;
  max-height: 38px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0 0 4px 0;
}

.yt-card-channel-name {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.yt-card-meta-line {
  font-size: 12px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  padding-right: 36px;
}

/* Trạng thái trống khi tìm kiếm */
.yt-empty-box {
  text-align: center;
  padding: 28px 16px;
  background: #222d3d;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #94a3b8;
}

.yt-empty-box i {
  font-size: 24px;
  color: #94a3b8;
  margin-bottom: 6px;
}

.yt-empty-box h4 {
  font-size: 14px;
  font-weight: 600;
  color: #f8fafc;
  margin: 0 0 4px 0;
}

.yt-empty-box p {
  font-size: 12px;
  margin: 0 0 10px 0;
}

.yt-empty-reset-btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #2c3a4e;
  color: #e2e8f0;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.yt-empty-reset-btn:hover {
  background: #36475f;
  border-color: #1ab394;
  color: #ffffff;
}

/* ==========================================================================
   5. TOAST NOTIFICATION
   ========================================================================== */
.yt-toast-notification {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(70px);
  opacity: 0;
  pointer-events: none;
  background: #222d3d;
  color: #f8fafc;
  border: 1px solid #1ab394;
  padding: 12px 20px;
  border-radius: 24px;
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  z-index: 99999;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.yt-toast-notification.is-show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.yt-toast-notification i {
  color: #2dd4bf;
  font-size: 15px;
}

/* ==========================================================================
   6. RESPONSIVE CHO MÀN HÌNH NHỎ & MOBILE
   ========================================================================== */
@media (max-width: 1120px) {
  .yt-watch-container {
    grid-template-columns: 1fr;
    padding: 10px 10px 40px;
  }
}

@media (max-width: 768px) {
  .yt-header-bar {
    padding: 0 10px;
  }

  .yt-watch-container {
    padding: 8px 8px 30px;
    gap: 12px;
  }

  .yt-video-player-wrap {
    border-radius: 0;
  }

  .yt-watch-title {
    font-size: 16px;
  }

  .yt-watch-actions-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .yt-card-thumb-wrap {
    width: 120px;
    min-width: 120px;
    height: 68px;
  }

  .yt-card-item-title {
    font-size: 13px;
  }
}

/* ==========================================================================
   7. KHUNG WEBVIEW BLOGSPOT (NGUYỄN HÙNG THẮNG - BỎ TÚI GIS)
   ========================================================================== */
.yt-webview-box {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 48px);
  padding: 15px;
  background: var(--yt-bg-main, slategray) !important;
  box-sizing: border-box;
}

.yt-webview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 12px;
  background: #222d3d;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px 8px 0 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.yt-webview-author {
  display: flex;
  align-items: center;
  gap: 10px;
}

.yt-webview-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid #1ab394;
  flex-shrink: 0;
}

.yt-webview-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.2;
}

.yt-webview-subtitle {
  margin: 2px 0 0 0;
  font-size: 11.5px;
  color: #94a3b8;
  line-height: 1.2;
}

.yt-webview-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.yt-webview-frame-wrap {
  flex: 1;
  width: 100%;
  min-height: 0;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: none;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.yt-webview-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

@media (max-width: 768px) {
  .yt-webview-box {
    padding: 10px;
    height: calc(100vh - 48px);
  }

  .yt-webview-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 10px;
  }
}
