/**
 * Premium dark video tiles (listing) — typography, badges, overlays.
 * Depends on html.theme-flat (present in include_header_general.tpl).
 */

/* Equal-height rows + consistent gutters (replaces negative-margin inline-block hacks) */
html.theme-flat .list-videos > .margin-fix,
html.theme-flat .list-videos-screenshots > .margin-fix {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
  margin: 0 !important;
  font-size: 14px;
  line-height: 1.35;
}

/* Manage mode wraps tiles in <form>; inner flex inherits same gap math as .margin-fix */
html.theme-flat .list-videos > .margin-fix > form,
html.theme-flat .list-videos-screenshots > .margin-fix > form {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
  flex: 1 1 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-sizing: border-box;
}

html.theme-flat .list-videos > .margin-fix > form > .generic-error,
html.theme-flat .list-videos > .margin-fix > form > .bottom {
  flex: 1 1 100%;
  width: 100%;
}

html.theme-flat .list-videos > .margin-fix > .item,
html.theme-flat .list-videos > .margin-fix > form > .item,
html.theme-flat .list-videos-screenshots > .margin-fix > .item,
html.theme-flat .list-videos-screenshots > .margin-fix > form > .item {
  display: flex;
  flex-direction: column;
  margin: 0 !important;
}

html.theme-flat .list-videos > .margin-fix > .item > a,
html.theme-flat .list-videos > .margin-fix > form > .item > a,
html.theme-flat .list-videos-screenshots > .margin-fix > .item > a,
html.theme-flat .list-videos-screenshots > .margin-fix > form > .item > a {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

html.theme-flat .list-videos .item,
html.theme-flat .list-videos-screenshots .item {
  background: #14151a !important;
  border: 1px solid #282c38 !important;
  border-radius: 12px !important;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
  transition:
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    transform 0.22s ease;
}

/* Thumbnail flush to rounded card */
html.theme-flat .list-videos .img,
html.theme-flat .list-videos-screenshots .img {
  flex-shrink: 0;
  background-color: #0b0d12 !important;
  border-radius: 0;
}

html.theme-flat .list-videos .img img:first-child {
  border-radius: 0;
}

/* Resolution badge — UHD tiers: vivid yellow cube */
html.theme-flat .list-videos .is-hd {
  top: 8px !important;
  right: 8px !important;
  left: auto !important;
  z-index: 5;
  opacity: 1 !important;
  padding: 5px 7px !important;
  border-radius: 6px !important;
  font-size: 11px !important;
  font-weight: 900 !important;
  letter-spacing: 0.04em !important;
  text-transform: none !important;
  line-height: 1 !important;
}

html.theme-flat .list-videos .is-hd.is-4k,
html.theme-flat .list-videos .is-hd.is-8k,
html.theme-flat .list-videos .is-hd[class*="k"] {
  background: #fde047 !important;
  color: #111827 !important;
}

html.theme-flat .list-videos .is-hd:not([class*="k"]) {
  background: #4b5563 !important;
  color: #f9fafb !important;
  text-transform: uppercase !important;
}

/* Bottom-right duration pill */
html.theme-flat .list-videos .thumb-duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 4;
  max-width: calc(100% - 72px);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  color: #f9fafb;
  background: rgba(0, 0, 0, 0.78);
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    "Noto Sans TC",
    sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Title */
html.theme-flat .list-videos .item .title {
  flex-shrink: 0;
  height: auto !important;
  min-height: 2.65em;
  max-height: 2.85em;
  padding: 10px 12px 4px !important;
  margin: 0 !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  line-height: 1.35 !important;
  color: #f4f4f5 !important;
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
  overflow: hidden !important;
}

html.theme-flat .no-touch .list-videos .item:hover .title {
  color: #e0f2fe !important;
}

/* Row 1: channel + models — grey text, coloured icons via ::before */
html.theme-flat .list-videos .wrap-card-meta {
  flex-shrink: 0;
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 4px;
  padding: 2px 12px 6px !important;
  justify-content: flex-start !important;
  color: #94a3b8 !important;
  font-size: 12px !important;
  line-height: 1.4 !important;
}

html.theme-flat .list-videos .wrap-card-meta a {
  color: #cbd5e1 !important;
  text-decoration: none !important;
  transition: color 0.15s ease;
}

html.theme-flat .no-touch .list-videos .wrap-card-meta a:hover {
  color: #f1f5f9 !important;
}

html.theme-flat .list-videos .meta-gap {
  color: #94a3b8;
}

html.theme-flat .list-videos .meta-channel {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

html.theme-flat .list-videos .meta-channel::before {
  font-family: "icomoon", sans-serif !important;
  content: "\e91c";
  flex-shrink: 0;
  font-size: 12px;
  color: var(--flat-accent, #5b9cf6) !important;
  line-height: 1;
}

html.theme-flat .list-videos .meta-models {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  row-gap: 0;
}

html.theme-flat .list-videos .meta-models::before {
  flex-shrink: 0;
  width: 1em;
  text-align: center;
  margin-right: 2px;
  font-size: 10px;
  line-height: 1;
  color: #94a3b8;
  content: "\2605";
  font-family: system-ui, sans-serif !important;
}

/* Row 2: rating % + views */
html.theme-flat .list-videos .wrap-card-stats {
  margin-top: auto;
  display: flex !important;
  align-items: center;
  justify-content: space-between !important;
  padding: 4px 12px 11px !important;
  gap: 8px;
  color: #94a3b8 !important;
  font-size: 12px !important;
}

html.theme-flat .no-touch .list-videos .item:hover {
  border-color: rgba(96, 165, 250, 0.55) !important;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5) !important;
  transform: translateY(-3px);
}

html.theme-flat .list-videos .wrap-card-stats .rating {
  color: var(--flat-accent-hover, #60a5fa) !important;
  font-weight: 600 !important;
}

html.theme-flat .list-videos .wrap-card-stats .rating.negative {
  color: #f87171 !important;
}

html.theme-flat .list-videos .wrap-card-stats .rating::before {
  color: inherit !important;
}

html.theme-flat .list-videos .wrap-card-stats .views {
  color: #9ca3af !important;
}

html.theme-flat .list-videos .wrap-card-stats .views::before {
  color: #9ca3af !important;
}

html.theme-flat .list-videos .wrap-card-stats .rating,
html.theme-flat .list-videos .wrap-card-stats .views {
  position: relative;
  padding-left: 20px !important;
}

html.theme-flat .list-videos .wrap-card-stats .views {
  padding-left: 21px !important;
}

html.theme-flat .list-videos .wrap-card-stats .rating::before,
html.theme-flat .list-videos .wrap-card-stats .views::before {
  left: 0;
}

/* Metal skin: deepen slightly */
html.theme-flat.theme-flat-metal .list-videos .item,
html.theme-flat.theme-flat-metal .list-videos-screenshots .item {
  background: #101218 !important;
  border-color: #232a38 !important;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 8px 28px rgba(0, 0, 0, 0.55) !important;
}

@media screen and (max-width: 480px) {
  html.theme-flat .list-videos .thumb-duration {
    font-size: 10px;
    padding: 4px 8px;
  }
}
