/* Kingsway Plugin Shared Styles */

/* Reset and Base Styles */
.kingsway-plugin * {
  box-sizing: border-box;
}

.kingsway-library-modal * {
  box-sizing: border-box;
}

.e-con.e-flex > .e-con-inner {
  flex-wrap: unset;
}

/* Video Container Styles */
.kingsway-video-container {
  position: relative;
  width: 100%;
  margin: 0 auto;
  /* 让嵌入区域在编辑器和前端都以白色背景展示 */
  background-color: #ffffff;
  padding: 0;
}

.kingsway-video-container .from-kingsway-plugin {
  width: 100%;
  height: 100%;
  background-color: #ffffff;
}

/* 去除 Elementor 在空视频时的默认灰底占位 */
.kingsway-video-container .elementor-custom-embed-placeholder,
.kingsway-video-container .elementor-custom-embed {
  display: none !important;
}

/* 隐藏 Kingsway 小部件在 Elementor 编辑器的灰色占位条 */
.elementor-widget-kingsway_video .elementor-widget-empty-icon {
  display: none !important;
}

/* Video Title */
.kingsway-video-title {
  margin-top: 10px;
  font-size: 16px;
  color: #333;
}

/* Video Widget Container */
.kingsway-video-widget-container {
  position: relative;
  width: 100%;
  margin: 0 auto;
}

/* Modal Styles */
.kingsway-video-selector-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999999;
  justify-content: center;
  align-items: center;
}

.kingsway-video-selector-content {
  background: white;
  width: 90%;
  max-width: 1200px;
  max-height: 90vh;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.kingsway-video-selector-header {
  padding: 15px 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kingsway-video-selector-header h3 {
  margin: 0;
  font-size: 18px;
}

.close-button {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  color: #666;
}

.kingsway-video-selector-body {
  padding: 20px;
  overflow-y: auto;
  flex-grow: 1;
}

/* Video List Styles */
.video-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

/* Video Item Styles */
.video-item {
  cursor: pointer;
  border: 1px solid #eee;
  border-radius: 4px;
  overflow: hidden;
  transition: transform 0.2s;
}

.video-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.video-cover {
  position: relative;
  padding-top: 56.25%; /* 16:9 aspect ratio */
}

.video-cover img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
}

.video-title {
  padding: 10px;
  font-size: 14px;
  line-height: 1.4;
  color: #333;
}

/* Pagination Styles */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}

.pagination button,
.pagination .page-number {
  min-width: 30px;
  padding: 4px 8px;
  border: 1px solid #ddd;
  background: white;
  cursor: pointer;
  border-radius: 4px;
  text-align: center;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination .page-number.active {
  background: #0073aa;
  color: white;
  border-color: #0073aa;
}

.pagination .ellipsis {
  padding: 0 5px;
  color: #666;
}

/* Folder Navigation Styles */
.c-videos__folder-name {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  margin-top: 10px;
  padding: 0 20px;
}

.c-videos__folder-name__link {
  cursor: pointer;
  color: #0073aa;
  text-decoration: underline;
  margin-right: 5px;
}

.c-videos__folder-name__link:hover {
  color: #005177;
}

.c-videos__folder-name__arrow {
  margin: 0 5px;
  color: #333;
}

.c-videos__folder-name span {
  margin-right: 5px;
  color: #555;
}

.c-videos__folder-name__videos {
  font-weight: bold;
  color: #000;
}

/* Radio Group Styles */
.kingsway-radio-options {
  display: inline-flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.kingsway-radio-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

/* Current Association Styles */
.kingsway-current-association {
  margin-left: 8px;
}

/* Folder Card Styles */
.c-folder-card {
  padding: 24px 12px 24px;
  width: 100%;
  height: fit-content;
  border-radius: 8px;
  background: transparent;
  filter: drop-shadow(0 4px 7px rgba(0, 0, 0, 0.03));
  transition: all 0.3s ease-in-out;
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.c-folder-card svg {
  position: absolute;
  height: 300px;
}

/* Folder SVG Background */
.c-folder-card__bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 0;
  overflow: hidden;
}

.c-folder-card__bg svg {
  width: 100%;
  height: 100%;
  display: block;
  transform: scale(1.02);
  transform-origin: top left;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.05));
}

/* 调整文件夹卡片内部元素的z-index */
.c-folder-card > * {
  position: relative;
  z-index: 1;
}

.c-folder-card:hover {
  transform: translateY(-2px);
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.05));
}

/* 移除之前的伪元素背景 */
.c-folder-card::before,
.c-folder-card::after {
  content: none;
}

.c-folder-card__cover {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  justify-content: space-between;
  align-content: space-between;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  overflow: hidden;
  z-index: 1;
}

.c-folder-cover {
  width: 100%;
  height: 100%;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  box-sizing: border-box;
  padding: 4px;
  border-radius: 4px;
}

.c-folder-cover__item {
  position: relative;
  overflow: hidden;
  width: 33.3%;
  height: 50%;
  flex-shrink: 0;
  padding: 4px;
  box-sizing: border-box;
}

.c-folder-cover__item__inner {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.c-folder-cover__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 3px;
}

.c-folder-cover__item--folder .c-folder-cover__item__inner {
  padding: 0 2px 2px 2px;
}

.c-folder-cover__item--folder .c-folder-cover__item__inner::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 0;
  right: 0;
  bottom: 0;
  background: #7483f8;
  z-index: 1;
  border-radius: 3px;
}

.c-folder-cover__item--folder img {
  position: relative;
  z-index: 2;
}

.c-folder-cover__item--folder .c-folder-cover__item__inner::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  aspect-ratio: 73 / 21;
  background: linear-gradient(
    180deg,
    rgba(116, 131, 248, 0.8) 0%,
    rgba(116, 131, 248, 0.6) 100%
  );
  z-index: 3;
  border-radius: 0 0 3px 3px;
}

.c-folder-cover__item--empty {
  .c-folder-cover__item__inner::after {
    background: linear-gradient(
      180deg,
      rgba(116, 131, 248, 0.4) 0%,
      rgba(116, 131, 248, 0.2) 100%
    );
  }
}

.c-folder-card__row {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 1;
}

.c-folder-card__name {
  font-size: 16px;
  font-weight: 500;
  color: #333;
  margin-bottom: 8px;
}

.c-folder-card__time {
  font-size: 12px;
  opacity: 0.4;
  color: #333;
  position: relative;
  z-index: 1;
}

/* Video Card Styles */
.c-video-card {
  padding: 24px 24px 14px;
  width: 100%;
  border-radius: 8px;
  background: #fff;
  filter: drop-shadow(0 4px 7px rgba(0, 0, 0, 0.03));
  transition: all 0.3s ease-in-out;
  cursor: pointer;
  position: relative;
}

.c-video-card:hover {
  transform: translateY(-2px);
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.05));
}

.c-video-card-cover-wrap {
  overflow: hidden;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background-color: #f8f8f9;
  cursor: pointer;
}

.c-video-card__cover {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.c-video-card-cover__mask {
  width: 100%;
  position: absolute;
  left: 0;
  bottom: 0;
  height: 48px;
  background: linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.6) 0%,
    rgba(0, 0, 0, 0) 100%
  );
  z-index: 1;
}

.c-video-card-cover__info {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  z-index: 2;
  font-weight: 500;
}

.c-video-card-detail__stats {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: #ffffff;
  position: absolute;
  z-index: 2;
  bottom: 8px;
  left: 8px;
  gap: 6px;
}

.c-video-card-detail {
  margin-top: 14px;
  color: #333;
}

.c-vc-detail-row {
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.c-vc-detail-title-box {
  position: relative;
  display: flex;
  align-items: center;
  padding-right: 10px;
  flex: 1;
  min-width: 0;
}

.c-vc-detail__title {
  font-weight: 500;
  font-size: 16px;
  color: #333;
  margin: 0;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  text-overflow: ellipsis;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.c-video-card-detail__datetime {
  margin-top: 8px;
  font-size: 12px;
  opacity: 0.4;
  color: #333;
  display: flex;
  align-items: center;
  overflow: hidden;
}

/* Video Layout Styles */
.c-video-layout {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 20px;
}

/* Video List Styles */
.video-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
  padding: 0;
}

/* Tool Classes */
.g-truncate {
  --line-clamp: 1;
  overflow: hidden;
  display: -webkit-box;
  text-overflow: ellipsis;
  -webkit-line-clamp: var(--line-clamp);
  line-clamp: var(--line-clamp);
  -webkit-box-orient: vertical;
  word-break: break-word;
}

/* Responsive Styles */
@media (max-width: 768px) {
  .video-list {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
  }

  .kingsway-video-selector-content {
    width: 95%;
  }
}
