/* 
 * Optimized Video Player CSS
 * Removed duplicates and redundant rules
 * Organized by components
 */

/* ===== Base Elements ===== */
:root {
  --primary-color: #065fd4;
  --primary-hover: #0356c2;
  --text-color: #0f0f0f;
  --text-secondary: #606060;
  --border-color: #e5e5e5;
  --bg-light: #f8f8f8;
  --bg-dark: #000;
  --danger-bg: #fde8e8;
  --danger-color: #c53030;
  --danger-border: #f8b4b4;
}

/* ===== Video Player ===== */
.video-wrapper {
  aspect-ratio: 16/9;
  position: relative;
  background: var(--bg-dark);
}

.video-wrapper iframe,
.video-wrapper video,
.video-player video {
  width: 100%;
  height: 100%;
  position: relative;
  top: 0;
  left: 0;
}

.video-player {
  width: 100%;
  aspect-ratio: 16/9;
  background-color: var(--bg-dark);
  margin-bottom: 16px;
}

/* ===== Layout Containers ===== */
.video-container,
.watch-container {
  display: flex;
  flex-wrap: wrap;
}

.video-main {
  flex: 1;
  min-width: 65%;
  margin-right: 20px;
}

.video-sidebar {
  flex: 0 0 30%;
  max-width: 30%;
}

.video-player-container {
  flex: 1;
  min-width: 640px;
  margin-right: 24px;
}

.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 24px;
  overflow-y: auto;
}

/* ===== Video Information ===== */
.video-description {
  margin: 10px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
  line-height: 1.5;
}

.video-title {
  color: #000;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-meta {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 10px;
}

.owner,.video-actions {
  display: flex;
}
#avatar,#author{
  border: none;
  position: relative;
  padding: 0 10px;
  height: 36px;
  font-size: 16px;
  line-height: 36px;
  color: #0f0f0f;
}
#avatar img{
  border-radius: 50%;
  width: 40px;
  height: 40px;
}
.video-action {
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative; /* Để định vị các hạt con */
  overflow: visible; /* Cho phép hạt bay ra ngoài nút */
}
.thumbs-up {
  background: rgba(0, 0, 0, 0.05);
  border: none;
  border-radius: 18px 0 0 18px;
  position: relative;
  padding: 0 15px;
  height: 36px;
  font-size: 14px;
  line-height: 36px;
}
.thumbs-down {
  background: rgba(0, 0, 0, 0.05);
  border: none;
  border-radius: 0 18px 18px 0;
  position: relative;
  padding: 0 15px;
  height: 36px;
  font-size: 14px;
  line-height: 36px;
}
.thumbs-up:hover,.thumbs-down:hover{
  background: rgba(0, 0, 0, 0.1);
  border-color: transparent;
}
.video-action i,
.video-action-icon {
  margin-right: 5px;
}
.icon-thumbs-up::before{
  content: "\e97f";
}
.icon-thumbs-down::before{
  content: "\e97e";
}
.video-desc-wrap {
  position: relative;
  font-size: 15px;
  line-height: 1.5;
  max-width: 100%;
  padding: 10px;
  font-size: 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.05);
}
.video-views {
  color: #006a69;
  font-weight: 600;
}
/* Trạng thái thu gọn (hiển thị 3 dòng) */
.video-desc-text {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3; /* Quan trọng: Giới hạn 3 dòng */
  -webkit-box-orient: vertical;
}

/* Trạng thái mở rộng (xóa giới hạn dòng) */
.video-desc-text.expanded {
  display: block; /* Hoặc display: inline, tùy thuộc vào thẻ của bạn */
  -webkit-line-clamp: unset; /* Bỏ giới hạn dòng */
}

.toggle-description {
    color: #006a69;
    cursor: pointer;
    font-weight: 500;
    display: inline-block;
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: linear-gradient(to left, #f2f2f2 70%, rgba(255, 255, 255, 0));
    padding-left: 30px;
}

.video-primary-info {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.video-title-large {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 8px;
}

.video-stats {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 14px;
}

.video-secondary-info {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

/* ===== Video Grid (Homepage) ===== */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.video-card {
  cursor: pointer;
  transition: transform 0.2s;
}

.video-card:hover {
  transform: scale(1.03);
}

.video-thumbnail {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
  background-color: var(--bg-dark);
  border-radius: 8px;
  overflow: hidden;
}

.video-thumbnail img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 2px 4px;
  border-radius: 2px;
  font-size: 12px;
}

.video-info {
  display: flex;
  margin-top: 12px;
}

.video-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  margin-right: 12px;
  background-color: #ccc;
}

.video-details {
  flex: 1;
}

.video-channel,
.video-metadata {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* ===== Related Videos ===== */
.related-videos {
  flex: 0 0 402px;
  max-width: 402px;
  margin-bottom: 10px;
}

.related-videos h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

.related-video {
  display: flex;
  margin-bottom: 10px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.related-video:hover .related-title {
  color: var(--primary-color);
}

.related-thumbnail {
  flex: 0 0 168px;
  height: 94px;
  margin-right: 8px;
  position: relative;
  background-color: var(--bg-dark);
  border-radius: 8px;
  overflow: hidden;
}

.related-thumbnail svg {
  position: absolute;
  z-index: 100;
  left: 50%;
  top: 50%;
  transform: translateX(-50%) translateY(-50%);
  -webkit-transform: translateX(-50%) translateY(-50%);
}

.related-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.related-info {
  flex: 1;
}

.related-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-channel,
.related-metadata {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* ===== Comments Section ===== */
.comments-section {
  margin-top: 10px;
}

.comments-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.comments-count {
  color: #000;
  font-size: 16px;
  font-weight: 500;
}

.comments-sort {
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
}

.comment-form {
  display: flex;
  margin-bottom: 10px;
}

.comment-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #ccc;
  margin-right: 15px;
}

.comment-input-container {
  flex: 1;
}

.comment-input {
  width: 100%;
  padding: 10px 0;
  border: none;
  border-bottom: 1px solid var(--border-color);
  outline: none;
  font-size: 14px;
  resize: none;
}

.comment-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.comment-button {
  padding: 8px 16px;
  border: none;
  border-radius: 2px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.comment-cancel {
  background-color: transparent;
  color: var(--text-secondary);
  margin-right: 10px;
}

.comment-submit {
  background-color: var(--primary-color);
  color: white;
}

.comment-item {
  display: flex;
  margin-bottom: 10px;
}

.comment-content {
  flex: 1;
}

.comment-author {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
}

.comment-time {
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: 5px;
}

.comment-text {
  font-size: 14px;
  line-height: 1.4;
  margin-bottom: 8px;
}

.comment-actions-buttons {
  display: flex;
  gap: 15px;
  font-size: 12px;
  color: var(--text-secondary);
}

.comment-action {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.comment-action i {
  margin-right: 5px;
}

/* ===== Form Elements ===== */
.search-form {
  display: flex;
  width: 100%;
}

.search-input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid #ccc;
  border-right: none;
  border-radius: 2px 0 0 2px;
  font-size: 16px;
  height: 40px;
}

.search-button {
  background-color: var(--bg-light);
  border: 1px solid #ccc;
  border-radius: 0 2px 2px 0;
  cursor: pointer;
  height: 40px;
  width: 64px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 16px;
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

.btn {
  padding: 10px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.alert {
  padding: 12px;
  margin-bottom: 16px;
  border-radius: 4px;
}

.alert-danger {
  background-color: var(--danger-bg);
  color: var(--danger-color);
  border: 1px solid var(--danger-border);
}

.form-text {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ===== Responsive Design ===== */
@media (max-width: 1200px) {
  .watch-container {
    flex-direction: column;
  }
  
  .video-player-container {
    margin-right: 0;
    margin-bottom: 10px;
  }
  
  .related-videos {
    max-width: 100%;
  }
}

@media (max-width: 1024px) {
  .video-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

@media (max-width: 992px) {
  
  .video-main {
    margin-right: 0;
    margin-bottom: 10px;
  }
  .video-description,.comments-section{
    padding: 0 5px;
  }
  .video-sidebar {
    flex: 0 0 100%;
    max-width: 100%;
    padding: 0 5px;
  }
}

@media (max-width: 768px) {
  .header-center {
    margin: 0 16px;
  }
  
  .sidebar {
    width: 72px;
  }
  
  .sidebar-item span {
    display: none;
  }
  
  .sidebar-icon {
    margin-right: 0;
  }
  
  .main-content {
    margin-left: 72px;
  }
  
  .video-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

@media (max-width: 480px) {
  .header-left {
    flex: 0;
  }
  
  .header-center {
    flex: 1;
  }
  
  .logo span {
    display: none;
  }
  
  .sidebar {
    display: none;
  }
  
  .main-content {
    margin-left: 0;
    padding: 16px;
  }
  
  .video-grid {
    grid-template-columns: 1fr;
  }
}
/* CSS cho hiệu ứng "pop" của icon */
.icon-pop-animation .icon-thumbs-up::before,
.icon-pop-animation .icon-thumbs-down::before { /* Có thể áp dụng cho cả dislike */
    display: inline-block; /* Cần thiết cho transform */
    animation: icon-pop 0.4s ease-out;
}

@keyframes icon-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* CSS cho hiệu ứng hạt bung ra */
.like-particle {
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--particle-size, 6px);
    height: var(--particle-size, 6px);
    background-color: var(--particle-color, #FF5722);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    animation: particle-burst 0.7s ease-out forwards;
    pointer-events: none;
    z-index: 10;
}

@keyframes particle-burst {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx, 0px), var(--ty, 0px)) scale(0);
        opacity: 0;
    }
}

/* CSS cho messageBox (nếu bạn chưa có) */
.message-box {
    margin-top: 15px;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    display: none;
    text-align: center;
}
.message-box.success {
    background-color: #e6fffa;
    color: #00796b;
    border: 1px solid #b2dfdb;
}
.message-box.error {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}