/* app-shell/style.css */

/* Reset Base */
body,
html {
   margin: 0;
   padding: 0;
   width: 100%;
   height: 100%;
   overflow: hidden;
}

/* Iframe Principal */
#site-frame {
   width: 100%;
   height: 100%;
   border: none;
   display: block;
}

/* Reproductor Flotante */
#app-player {
   position: fixed;
   z-index: 9999;
   background: #000;
   display: none;
   flex-direction: column;
   transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
   box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
   overflow: hidden;
}

/* MODO M?VIL */
body.is-mobile #app-player {
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
}

/* MODO DESKTOP */
body.is-desktop #app-player {
   width: 450px;
   height: 253px;
   bottom: 20px;
   right: 20px;
   top: auto;
   left: auto;
   border-radius: 12px;
   border: 1px solid #333;
}

/* ESTADO MINIMIZADO */
#app-player.minimized {
   width: 50% !important;
   max-width: 200px;
   aspect-ratio: 16/9;
   height: auto !important;
   top: auto;
   left: auto;
   bottom: 50px;
   right: 15px;
   border-radius: 8px;
   box-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
   border: 1px solid rgba(255, 255, 255, 0.1);
   overflow: visible;
   background: rgba(0, 0, 0, 0.5);
   backdrop-filter: blur(18px);
}

/* Ajuste m?vil Minimizado */
body.is-mobile #app-player.minimized {
   top: auto;
   left: auto;
}

/* Ajuste Desktop Minimizado */
body.is-desktop #app-player.minimized {
   width: 250px !important;
   bottom: 20px !important;
   right: 20px !important;
}

/* Botones y Overlays */
.player-controls-row {
   display: none;
   /* Oculto por defecto */
   position: absolute;
   top: 0;
   left: 0;
   /* gap: 10px; */
   padding: 5px;
   z-index: 10000;
}

.control-btn {
   width: 32px;
   height: 32px;
   background: rgba(0, 0, 0, 0.6);
   color: white;
   border-radius: 50%;
   display: flex;
   align-items: center;
   justify-content: center;
   cursor: pointer;
   box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
   backdrop-filter: blur(4px);
}

.control-btn:hover {
   background: rgba(0, 0, 0, 0.8);
}

#app-player.minimized .player-controls-row {
   display: flex;
   justify-content: space-between;
   width: -webkit-fill-available;
}

/* Eliminar estilos viejos ya no usados si existen o sobrescribirlos */
#btn-mini-close {
   display: flex;
   /* Ahora es parte del row por default si se usa ID, pero mejor usar la clase .control-btn */
}


#btn-desktop-close {
   display: none;
   position: absolute;
   top: 5px;
   right: 5px;
   color: white;
   cursor: pointer;
   z-index: 100;
   background: rgba(0, 0, 0, 0.5);
   padding: 5px 10px;
   border-radius: 4px;
}

body.is-desktop #app-player:not(.minimized) #btn-desktop-close {
   display: block;
}

#overlay-gesture {
   display: none;
   position: absolute;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   background: transparent;
   z-index: 2000;

   /* CRITICAL FIX FOR DRAG: */
   touch-action: none !important;
}

#app-player.minimized #overlay-gesture {
   display: block;
}

/* Zona de agarre en Desktop */
body.is-desktop #overlay-gesture {
   display: block;
   height: 40px;
   width: 100%;
   cursor: move;
}

body.is-desktop #overlay-gesture:hover {
   background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent);
}

iframe#video-frame {
   width: 100%;
   height: 100%;
   border: none;
   display: block;
   background: #000;
}

#app-player.minimized iframe#video-frame {
   border-radius: 8px;
}

/* Landscape Mobile Fix */
@media (max-width: 900px) and (orientation: landscape) {

   /* En landscape fullscreen, ocultamos controles mini para ver video limpio (usuario toca para maximizar si quiere controles) */
   body.is-mobile #app-player.minimized .player-controls-row {
      /* display: none !important; */
   }
}

/* --- DEBUG ZONES (Solo para desarrollo) --- */
.debug-overlay-zone {
    position: fixed;
    left: 0;
    width: 100%;
    z-index: 2147483647; /* Encima de todo */
    pointer-events: none; /* Permite pasar los clics a trav?s */
    opacity: 0.3; /* Transl?cido */
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
    text-transform: uppercase;
    border: 2px dashed rgba(255,255,255,0.5);
}

/* Zona Roja: Video (35% superior aprox) */
.zone-video-debug {
    top: 0;
    height: 35%; /* Ajustable seg?n el tama?o real de tu video */
    background-color: red;
}

/* Zona Verde: Comentarios (Resto de la pantalla) */
.zone-comments-debug {
    top: 35%;
    height: 65%;
    background-color: green;
}