/* Metameha YouTube Player — TECHNICAL CSS
   Purpose: layout/structure/behavior only.
   No theme colors, no decorative spacing, no typography choices.
 */
 
/* ---------- Base ---------- */
.metameha-yt,
.metameha-yt * {
  box-sizing: border-box;
}

.metameha-yt button {
  /* Button styles are handled by theme */
}

/* ---------- Player (video area) ---------- */
.metameha-yt-player-inner {
  width: 100%;
  overflow: hidden;
}

/* Wrap iframe so we can overlay a loader without destroying the player */
.metameha-yt-iframewrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9; /* keep correct video ratio on mobile */
  background: #000;
  overflow: hidden;
}

/* The iframe is managed by JS (YouTube Iframe API)
   YT replaces #metameha-yt-iframe with an <iframe> inside, so we style both.
 */
#metameha-yt-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#metameha-yt-iframe iframe {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Overlay loader (player) */
.metameha-yt-player-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
}

.metameha-yt-player-overlay.is-visible {
  display: flex;
}

/* ---------- "Now playing" ---------- */
.metameha-yt-now-title {
  margin: 0;
}

/* Genre row: flex container for genres + comments CTA */
.metameha-yt-now-genre-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
  flex-wrap: wrap;
}

/* Comments CTA button in player */
.metameha-yt-comments-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  cursor: pointer;
  white-space: nowrap;
}

.metameha-yt-comments-cta[hidden] {
  display: none;
}

.metameha-yt-openicon-inline {
  display: inline-flex;
  vertical-align: middle;
}

/* Make SVG inherit the link color */
.metameha-yt-openicon {
  fill: currentColor;
}

/* Artist row (full row clickable) */
.metameha-yt-artistrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.metameha-yt-artistbadge {
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}

.metameha-yt-artisttext {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.metameha-yt-artistname {
  line-height: 1.2;
}

.metameha-yt-artistcount {
  line-height: 1.2;
}

/* Genres under player (tag-like buttons) */
.metameha-yt-meta--genre-player {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.metameha-yt-termbtn {
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.metameha-yt-genre-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  vertical-align: middle;
  opacity:0.6;
}
.metameha-yt-termbtn:hover .metameha-yt-genre-icon {
  opacity:1;
}

/* ---------- List (songs) ---------- */
.metameha-yt-list-inner {
  width: 100%;
}

.metameha-yt-item {
  width: 100%;
}

.metameha-yt-item-main {
  width: 100%;
  display: flex;
  gap: 12px;
  align-items: stretch;
  text-align: left;
  border: 0;
  padding: 0;
  cursor: pointer;
}

/* Thumbnail */
.metameha-yt-thumbwrap {
  position: relative;
  flex: 0 0 auto;
  width: 120px;
  height: 80px;
  overflow: hidden;
}

.metameha-yt-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Play badge overlay (hidden by default; shown on hover/focus/active) */
.metameha-yt-playbadge {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin: auto;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.metameha-yt-item:hover .metameha-yt-playbadge,
.metameha-yt-item:focus-within .metameha-yt-playbadge,
.metameha-yt-item.is-active .metameha-yt-playbadge {
  opacity: 1;
}

/* Item body */
.metameha-yt-item-body {
  flex: 1 1 auto;
  min-width: 0;
}

/* cut the posts title at 2 lines */
.metameha-yt-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  /* vscode-css-languageservice-disable unknown-property */
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  line-height: 1.25;
  max-height: calc(1.25em * 2);
}

.metameha-yt-meta-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ---------- Pagination ---------- */
.metameha-yt-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.metameha-yt-pages {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}

.metameha-yt-btn,
.metameha-yt-pagebtn {
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.metameha-yt-pagebtn.is-active {
  cursor: default;
}

/* ---------- Loading (list + player) ---------- */
.metameha-yt-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.metameha-yt-loading.metameha-yt-loading--player {
  min-height: 220px; /* technical minimum to avoid layout jump */
}

/* Spinner uses currentColor so it inherits theme color */
.metameha-yt-spinner {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 3px solid currentColor;
  border-right-color: transparent;
  animation: metameha-yt-spin 0.8s linear infinite;
  opacity: 0.75;
}

@keyframes metameha-yt-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Screen-reader only utility (used by JS spinners) */
.metameha-yt-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Post Content Container ---------- */
#metameha_youtube_post_content,
.metameha-yt-post-content {
  
  position: relative;
}

/* Hide by default on homepage and non-single-post pages */
#metameha_youtube_post_content:not(.is-visible),
.metameha-yt-post-content:not(.is-visible) {
  display: none;
}

/* Show when is-visible class is added (by JS on single post or after CTA click) */
#metameha_youtube_post_content.is-visible,
.metameha-yt-post-content.is-visible {
  display: block;
}

/* Loading state for post content */
.metameha-yt-post-content.is-loading {
  min-height: 100px;
}

.metameha-yt-loading.metameha-yt-loading--post-content {
  min-height: 100px;
  padding: 20px 0;
}

/* Error state for post content */
.metameha-yt-post-content-error {
  padding: 20px;
  text-align: center;
  opacity: 0.7;
}

/* Post title */
.metameha-yt-post-title {
  text-align: center;
  margin: 0 0 40px 0;
}

/* Post taxonomies - 2 columns layout */
.metameha-yt-post-taxonomies {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1em;
  margin: 0 0 20px 0;
  font-size: 0.9em;
  opacity: 0.8;
  border-bottom: 1px solid var(--theme-palette-color-9);
  padding-bottom: 20px;
}

.metameha-yt-post-artists {
  grid-column: 1;
}

.metameha-yt-post-genres {
  grid-column: 2;
  text-align: right;
}

.metameha-yt-post-taxo-label {
  font-weight: 600;
  display: block;
  margin-bottom: 0.25em;
}

.metameha-yt-post-genre,
.metameha-yt-post-artist {
  display: inline;
}

.metameha-yt-post-genre a,
.metameha-yt-post-artist a {
  text-decoration: none;
  color: inherit;
}

.metameha-yt-post-genre a:hover,
.metameha-yt-post-artist a:hover {
  text-decoration: underline;
}

/* Post body/content */
.metameha-yt-post-body {
  margin: 0 0 2em 0;
}

/* Comments section */
.metameha-yt-post-comments {
  margin-top: 2em;
  padding-top: 2em;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.metameha-yt-comments-title {
  margin: 0 0 1em 0;
  font-size: 1.2em;
  font-weight: bold;
}

.metameha-yt-post-comments .commentlist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.metameha-yt-post-comments .commentlist > li {
  margin: 0 0 10px 0;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.metameha-yt-post-comments .comment-body {
  position: relative;
}

.metameha-yt-post-comments .comment-meta {
  margin-bottom: 0.5em;
  font-size: 0.9em;
}

.metameha-yt-post-comments .comment-author {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin-bottom: 0.25em;
}

.metameha-yt-post-comments .comment-author img {
  border-radius: 50%;
}

.metameha-yt-post-comments .comment-metadata {
  font-size: 0.85em;
  opacity: 0.7;
}

.metameha-yt-post-comments .comment-content {
  margin: 0.5em 0;
  line-height: 1.6;
}

.metameha-yt-post-comments .reply {
  margin-top: 0.5em;
  font-size: 0.9em;
}

.metameha-yt-post-comments #respond {
  margin-top: 0;
  padding-top: 0;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.metameha-yt-post-comments .comment-form {
  margin-top: 1em;
}

.metameha-yt-post-comments .comment-form input[type="text"],
.metameha-yt-post-comments .comment-form input[type="email"],
.metameha-yt-post-comments .comment-form input[type="url"],
.metameha-yt-post-comments .comment-form textarea {
  border-color: var(--theme-palette-color-4);
}

.metameha-yt-post-comments .comment-form input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--theme-palette-color-4);
  border-radius: 3px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
  background-color: transparent;
  position: relative;
  cursor: pointer;
}

.metameha-yt-post-comments .comment-form input[type="checkbox"]:focus {
  outline: none;
  border-color: var(--theme-palette-color-1);
}

.metameha-yt-post-comments .comment-form input[type="checkbox"]:checked {
  background-color: var(--theme-palette-color-1);
  border-color: var(--theme-palette-color-1);
}

.metameha-yt-post-comments .comment-form input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 6px;
  height: 10px;
  border-right: 2px solid var(--theme-palette-color-10);
  border-bottom: 2px solid var(--theme-palette-color-10);
  transform: rotate(45deg);
}

.metameha-yt-post-comments .comment-form input[type="text"]:focus,
.metameha-yt-post-comments .comment-form input[type="email"]:focus,
.metameha-yt-post-comments .comment-form input[type="url"]:focus,
.metameha-yt-post-comments .comment-form textarea:focus {
  border-color: var(--theme-palette-color-1);
  outline: none;
}

.metameha-yt-post-comments .comment-form-comment textarea {
  width: 100%;
  min-height: 120px;
  padding: 0.5em;
  font-family: inherit;
  font-size: inherit;
  border: 1px solid var(--theme-palette-color-4);
  border-radius: 4px;
}

.metameha-yt-post-comments .form-submit {
  margin-top: 1em;
}

.metameha-yt-post-comments .form-submit input[type="submit"] {
  padding: 0.5em 1.5em;
  font-size: 1em;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  background: transparent;
}

/* ---------- Artists block preview behavior ----------
   Uses a mask (no background color) to hint "more content".
 */
/* Preview ON (JS adds .is-preview) */
.metameha-yt-artists--preview.is-preview .metameha-yt-artists-inner{
  max-height: 230px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 80%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 80%, transparent 100%);
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}

/* Preview OFF (after "Show all") */
.metameha-yt-artists--preview:not(.is-preview) .metameha-yt-artists-inner{
  max-height: none;
  overflow: visible;
  -webkit-mask-image: none;
  mask-image: none;
}


.metameha-yt-artists-footer {
  width: 100%;
}

.metameha-yt-artists-showall {
  width: 60%;
}

/* ---------- Artists header (search) ---------- */
/* High specificity + !important to override Blocksy theme */
#metameha-yt-artists .metameha-yt-artists-header,
.metameha-yt-artists .metameha-yt-artists-header {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  margin-bottom: 16px !important;
  gap: 16px !important;
  flex-wrap: nowrap !important;
  width: 100% !important;
}

#metameha-yt-artists .metameha-yt-artists-header-left,
#metameha-yt-artists .metameha-yt-artists-header-right,
.metameha-yt-artists .metameha-yt-artists-header-left,
.metameha-yt-artists .metameha-yt-artists-header-right {
  display: flex !important;
  align-items: center !important;
  min-width: 0 !important;
}

#metameha-yt-artists .metameha-yt-artists-header-left,
.metameha-yt-artists .metameha-yt-artists-header-left {
  flex: 0 0 auto !important;
}

#metameha-yt-artists .metameha-yt-artists-header-right,
.metameha-yt-artists .metameha-yt-artists-header-right {
  flex: 1 1 auto !important;
  justify-content: flex-end !important;
}

#metameha-yt-artists .metameha-yt-artists-title,
.metameha-yt-artists .metameha-yt-artists-title,
.metameha-yt-artists-title {
  margin: 0 !important;
  width: auto !important;
  flex: 0 0 auto !important;
  white-space: nowrap !important;
}

#metameha-yt-artists .metameha-yt-artists-search,
.metameha-yt-artists .metameha-yt-artists-search,
input#metameha-yt-artists-search,
input.metameha-yt-artists-search {
  flex: 0 1 360px !important;
  width: 300px !important;
  min-width: 200px !important;
  max-width: 45% !important;
  margin-left: auto !important;
  padding: 8px 12px !important;
  border: 1px solid var(--theme-palette-color-9, #e0e0e0) !important;
  border-radius: 4px !important;
  font: inherit;
  font-size: 0.9rem !important;
  box-sizing: border-box !important;
}

#metameha-yt-artists .metameha-yt-artists-search:focus,
input#metameha-yt-artists-search:focus {
  border-color: var(--theme-palette-color-1, #0066cc) !important;
}

/* Styliser la croix de suppression (WebKit/Chrome/Safari/Edge) */
#metameha-yt-artists-search::-webkit-search-cancel-button {
  -webkit-appearance: none !important; /* Désactive le style par défaut */
  height: 20px !important;
  width: 20px !important;
  cursor: pointer !important;
  
  /* Utilisation d'un masque pour pouvoir changer la couleur facilement */
  background-color: var(--theme-palette-color-3, #0066cc) !important; /* Couleur de la croix */
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/></svg>") !important;
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/></svg>") !important;
  -webkit-mask-repeat: no-repeat !important;
  mask-repeat: no-repeat !important;
  -webkit-mask-position: center !important;
  mask-position: center !important;
  
  margin-right: 2px !important;
}

/* Changer la couleur au survol */
#metameha-yt-artists-search::-webkit-search-cancel-button:hover {
  background-color: var(--theme-palette-color-1, #004499) !important;
}

@media (max-width: 768px) {
  #metameha-yt-artists .metameha-yt-artists-header,
  .metameha-yt-artists .metameha-yt-artists-header {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  
  #metameha-yt-artists .metameha-yt-artists-header-right,
  .metameha-yt-artists .metameha-yt-artists-header-right {
    justify-content: flex-start !important;
  }
  
  #metameha-yt-artists .metameha-yt-artists-search,
  input#metameha-yt-artists-search {
    min-width: 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
  }
}

/* keep list from jumping while loading (technical) */
.metameha-yt-list.is-loading .metameha-yt-list-inner {
  opacity: 0.65;
}

/* ---------- Playlist Header (above AJAX list) ----------
   Structural CSS only (no theme colors).
*/
.metameha-yt-playlist-header{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.metameha-yt-playlist-left,
.metameha-yt-playlist-right{
  display:flex;
  align-items:center;
  gap:14px;
}

/* Icon buttons (Shuffle / Prev / Next) */
.metameha-yt-iconbtn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:0;
  padding:0;
  background:transparent;
  cursor:pointer;
}

.metameha-yt-ic{
  display:inline-flex;
  line-height:0;
}

/* ---------- Toggle Switches (Autoplay / Shuffle) ---------- */
.metameha-yt-toggle{
  display:inline-flex;
  align-items:center;
  gap:4px;
  border:0;
  padding:0;
  background:transparent;
  cursor:pointer;
  user-select:none;
}

.metameha-yt-toggle .metameha-yt-toggle-track{
  position:relative;
  width:44px;
  height:24px;
  border-radius:999px;
  border:1px solid var(--theme-palette-color-9);
  background:transparent;
}

.metameha-yt-toggle .metameha-yt-toggle-thumb{
  position:absolute;
  top:50%;
  left:3px;
  width:18px;
  height:18px;
  border-radius:999px;
  background:#9aa0a6; /* inactif = gris */
  transform:translateY(-50%);
  transition:left .15s ease, transform .15s ease, background-color .15s ease;
}

/* ON state */
.metameha-yt-toggle.is-active .metameha-yt-toggle-thumb{
  background:var(--theme-palette-color-1); /* actif */
  left:calc(100% - 3px);
  transform:translate(-100%, -50%);
}

/* Focus visible for accessibility */
.metameha-yt-toggle:focus-visible .metameha-yt-toggle-track{
  outline:2px solid var(--theme-palette-color-9);
  outline-offset:2px;
}

/* ---------- Genre Icons ---------- */
.meta-cards-ui-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
}

.meta-cards-ui-left {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
}

.meta-cards-ui-icon {
  display: inline-block;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  vertical-align: middle;
  margin-right: 8px;
  opacity:0.6;
}
.meta-cards-ui-item:hover .meta-cards-ui-icon {
  opacity:1;
}

.meta-cards-ui-title {
  flex: 0 1 auto;
}

.meta-cards-ui-count {
  flex: 0 0 auto;
  margin-left: auto;
}