/**
 * Plugin Name: YouTube Cleanup
 * Description: Affiche une vidéo YouTube propre avec miniature HD, bouton personnalisé, sans vidéos suggérées externes. Utilise le shortcode [YT-cleanup "video-id"].
 * Version: 1.1
 */
/* Conteneur générique */
.yt-cleanup-video {
  position: relative;
  width: 100%;
  overflow: hidden;
}
.yt-cleanup-thumbnail {
    position: relative;
    top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    cursor: pointer;
}
/* Vidéo dans cadre */
.yt-video-framed {
	border: solid 1px #c2c2c2;
	padding: 5px;
	transition: all 0.2s;
	background: #fff;
}
/* Traite les proportions de la vidéo selon option "format" du shortcode */

/* 16:9 */
.yt-wide .yt-cleanup-thumbnail {
  	aspect-ratio: 16 / 9; 
  	padding-top: 56.25%; /* 9 / 16 = 0.5625 */
  	position: relative;
}

/* 4:3 */
.yt-43 .yt-cleanup-thumbnail {
  	aspect-ratio: 4 / 3;
  	padding-top: 75%; /* 3 / 4 = 0.75 */
  	position: relative;
}

/* 1:1 */
.yt-square .yt-cleanup-thumbnail {
  	aspect-ratio: 1 / 1; 
  	padding-top: 100%; /* 1 / 1 = 1 */
  	position: relative;
}

/* Format carré devient 4:3 sur écran large */
@media (min-width: 768px) {
.yt-square .yt-cleanup-thumbnail {
    aspect-ratio: 4 / 3;
		padding-top: 75%;
}
}
/* iframe ou vidéo en position absolue */
.yt-cleanup-thumbnail iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
}

/**************************************/
/* Bouton play */
.yt-cleanup-play-button {
    position: absolute;
    top: 75%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    border-radius: 10%;
}
.yt-cleanup-play-button svg {
    background: rgb(255 0 0 / 60%);
    width: 100px;
    height: 60px;
    transition: transform 0.2s ease;
    padding: 0;
    border-radius: 10%;
}
.yt-cleanup-play-button svg:hover {
	background: rgba(255, 0, 0, 1);
}
.yt-cleanup-play-button:hover {
    filter: drop-shadow(0 0 5px rgba(255,255,255,0.5));
	background: none;
}
.yt-cleanup-play-button:hover polygon {
  fill-opacity: 1;
}

/* Container général */
.yt-cleanup-meta {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 8px 12px 20px 12px;
    display: flex;
    flex-direction: column; /* colonne pour garder le titre au-dessus */
    gap: 6px;
    z-index: 10;
    color: #fff;
    font-family: sans-serif;
    background: linear-gradient(to bottom, rgba(0,0,0,0.8), rgba(0,0,0,0));
    box-sizing: border-box;
}
/* Titre vidéo */
.yt-cleanup-title {
    font-family: roboto, arial, sans serif;
	font-size: 20px;
	text-shadow: 0 0 2px rgba(0,0,0,.5);
    line-height: 1.2em;
    font-weight: 400;
	opacity: 0.9;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    display: -webkit-box;
    max-width: 95%;
}
/* Ligne contenant logo + nom chaîne + bouton s'abonner */
.yt-cleanup-channel-line {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    overflow: hidden;
}
/* Logo de la chaîne */
.yt-cleanup-channel-logo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
}
/* Nom de la chaîne */
.yt-cleanup-channel-title {
    font-family: roboto, arial, sans serif;
	font-size: 17px;
	text-shadow: 0 0 1px rgba(0,0,0,.5);
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Bouton s'abonner */
.yt-cleanup-subscribe-btn {
    background-color: #fff;
    color: #000;
    border: 1px solid #000;
    padding: 2px 6px;
    border-radius: 3px;
    text-decoration: none;
    font-weight: bold;
    font-size: 12px;
    transition: background-color 0.3s ease, color 0.3s ease;
}
.yt-cleanup-subscribe-btn:hover {
    background-color: #cc181e;
    color: #fff;
}
/* Icône partager */
.yt-cleanup-share-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  background: none;
  padding: 6px 8px;
  border: none;
	color: #eee;
  transition: background 0.2s ease;
  gap: 0.5em;
}
/* Style de l'icône */
.yt-cleanup-share-button i {
    color: #fff;
    font-size: 20px;
  	margin-bottom: 4px;
	text-shadow: 0 0 2px rgba(0,0,0,.5);
}
/* Style spécifique du texte */
.yt-cleanup-share-label {
    color: #eee;
    font-weight: 600;
    font-size: 14px;
	text-shadow: 0 0 2px rgba(0,0,0,.5);
}
.yt-cleanup-share-button:hover {
  background: rgba(255, 255, 255, 0.2);
}
/* Fenêtre modale de partage */
.yt-cleanup-share-modal {
  display: none; /* CACHÉE par défaut */
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);;
  color: white;
  padding: 20px;
  border-radius: 8px;
  z-index: 10;
  width: 400px;
  max-width: 90%;
  text-align: center;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.5);
}
.yt-cleanup-share-modal h3 {
  color: white;
	margin: 0 0 19px 0;
}
.yt-cleanup-share-modal.active {
  display: block;
}
.yt-cleanup-share-modal-content {
    background: #222;
    color: white;
    padding: 20px;
    max-width: 500px;
    margin: 10% auto;
    border-radius: 12px;
    text-align: center;
    position: relative;
}
/* Bouton fermer (caché) */
.yt-cleanup-share-close {
    display: none;
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 24px;
    cursor: pointer;
    padding: 7px 14px;
}
/* Lien vers vidéo */
.yt-cleanup-share-link-box {
    background-color: rgb(27 127 204);
    padding: 10px 15px;
    border-radius: 6px;
    margin: 10px 0;
    text-align: center;
    word-break: break-all;
}
.yt-cleanup-share-link {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    font-size: 20px;
}
.yt-cleanup-share-link:hover {
    text-decoration: underline;
}
/* Icônes sociales */
.yt-cleanup-share-icons {
    margin-top: 12px;
    display: flex;
    justify-content: center;
    gap: 15px;
}
.yt-cleanup-share-icons a {
    font-size: 32px;
    line-height: 1.2em;
    color: white;
    margin: 0px 20px;
}
.yt-cleanup-share-icons i {
    font-size: 32px;
    color: white;
    border: 2px solid;
    padding: 5px;
    border-radius: 4px;
    background-color: blue;
    background-color: rgb(27 127 204);
}
.yt-cleanup-share-icons a:hover i {
    color: #ccc;
}
/* Messages de debug, partie commune */
.yt-api-mode .yt-cleanup-thumbnail::after, .yt-iframe-mode .yt-cleanup-thumbnail::after {
    font-size: 10px;
    position: absolute;
    bottom: 0;
    right: 0;
    background: rgba(0,0,0,0.5);
    color: white;
    padding: 2px 4px;
  }
/* Affiche un mesage si API YT pour iOS ou iframe est utilisée */
.yt-api-mode .yt-cleanup-thumbnail::after {
	content: ''; /* Caché en exploitation */
    /* content: 'API YouTube utilisée sur iOS'; */
  }
.yt-iframe-mode .yt-cleanup-thumbnail::after {
	content: ''; /* Caché en exploitation */
    /* content: 'Mode iframe utilisé'; */
  }

/* PLATFORM DEPENDENT ***********************/

/* Affichages sur petits écrans */
@media (max-width: 1400px) {
	.yt-cleanup-title {
  		max-width: 96%;
  		font-size: 18px;
	}
}
@media (max-width: 768px) {
	.yt-cleanup-play-button svg {
	    width: 80px;
    	height: 48px;
    	padding: 0;
		}

	.yt-cleanup-share-button {
		bottom: 50px;
		left: 6px;
		position: relative;
		top: unset;
		background-color: rgba(0, 0, 0, 0.5);
		border-radius: 50%;
		padding: 10px 8px 6px;
		}
	.yt-cleanup-share-label {
		display: none;
		}
	.yt-cleanup-title {
  		font-size: 15px;
		max-width: 100%;
		}
	.yt-cleanup-channel-title {
		font-size: 14px;
		}
}
