/* ==========================================================
   CKS COVER MANAGER
   FASE 3A
   ========================================================== */

/* Contenedor */
.cks-cover-content {
    position: relative;
}

.cks-cover-manager {
    display: block;
    position: absolute;
    width: 32px;
    height: 32px;
    bottom: 20px;
    right: 0px;
}

/* ==========================================================
   BOTÓN EDITAR
   ========================================================== */

.cks-cover-edit-button {
    color: #5b12e8;
    cursor: pointer;
    transition: transform .15s ease, opacity .15s ease;
    background: #fff;
    position: absolute;
    z-index: 99;
    border-radius: 50%;
    overflow: hidden;
}

.cks-cover-edit-button svg {
    width: 32px;
    height: 32px;
}

.cks-cover-edit-button:hover {
    transform: scale(1.08);
}

.cks-cover-edit-button:active {
    transform: scale(.97);
}

/* ==========================================================
   POPUP
   ========================================================== */

.cks-cover-popup {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.cks-cover-popup[hidden] {
    display: none;
}

/* Fondo */

.cks-cover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .65);
}

/* Caja */

.cks-cover-dialog {
    position: relative;
    z-index: 1;
    width: min(650px, 100%);
    background: #fff;
    border-radius: 20px;
    padding: 30px;
    box-sizing: border-box;
    box-shadow: 0 20px 70px rgba(0, 0, 0, .30);
}

/* Cerrar */

.cks-cover-close {
    position: absolute;
    top: 12px;
    right: 16px;
    width: 38px;
    height: 38px;
    border: 0;
    background: transparent;
    color: #555;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
}

.cks-cover-close svg {
    width: 38px;
    height: 38px;
}

/* ==========================================================
   GRID
   ========================================================== */

.cks-cover-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 32px;
    justify-items: center;
}

/* Slot */

.cks-cover-slot {
    width: 100%;
    text-align: center;
}

/* ==========================================================
   CÍRCULO EXTERIOR
   ========================================================== */

.cks-cover-circle {
    position: relative;
    z-index: 0;
    width: 170px;
    height: 170px;
    margin: 0 auto;
    border: 3px solid #d9dce3;
    border-radius: 50%;
    overflow: visible;
    background: #f1f2f5;
    box-sizing: border-box;
    cursor: pointer;
}

.cks-cover-slot.is-uploading .cks-cover-circle {
    cursor: wait;
}

.cks-cover-slot.is-deleting .cks-cover-circle {
    cursor: wait;
}

/* ==========================================================
   ÁREA VISUAL RECORTADA
   ========================================================== */

.cks-cover-media {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: 50%;
    background: #f1f2f5;
}

/* 
 */

.cks-cover-media img,
.cks-cover-circle>img {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: 50%;
}

.cks-cover-slot.is-uploading .cks-cover-media img,
.cks-cover-slot.is-uploading .cks-cover-circle>img {
    opacity: .48;
}

/* Estado vacío */

.cks-cover-empty {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f2f5;
}

.cks-cover-slot.has-image .cks-cover-empty {
    display: none;
}

.cks-cover-slot.is-empty .cks-cover-empty {
    display: flex;
    visibility: visible;
    opacity: 1;
}

/* Refuerzo: si existe 
, nunca mostrar vacío */

.cks-cover-media:has(> img) .cks-cover-empty {
    display: none !important;
}

/* + de carga */

.cks-cover-plus {
    position: absolute;
    top: 48%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #5b12e8;
    font-size: 58px;
    font-weight: 300;
    line-height: 1;
}

/* ==========================================================
   EFECTO HOVER
   ========================================================== */

.cks-cover-circle::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 10;
    border-radius: 50%;
    background: rgba(91, 18, 232, .10);
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease;
}

.cks-cover-circle:hover::after {
    opacity: 1;
}

/* ==========================================================
   SPINNER / CARGANDO
   ========================================================== */

.cks-cover-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 100;
    width: 42px;
    height: 42px;
    margin: -21px 0 0 -21px;
    border: 4px solid rgba(255, 255, 255, .55);
    border-top-color: #5b12e8;
    border-radius: 50%;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
}

.cks-cover-slot.is-uploading .cks-cover-loading,
.cks-cover-slot.is-deleting .cks-cover-loading {
    opacity: 1;
    animation: cks-cover-spin .75s linear infinite;
}

.cks-cover-slot:not(.is-uploading):not(.is-deleting) .cks-cover-loading {
    opacity: 0;
    animation: none;
}

@keyframes cks-cover-spin {
    to {
        transform: rotate(360deg);
    }
}

/* 
 durante carga */

.cks-cover-slot.is-uploading .cks-cover-media img {
    opacity: .48;
}

.cks-cover-slot.is-uploading .cks-cover-circle::after,
.cks-cover-slot.is-deleting .cks-cover-circle::after {
    z-index: 50;
    opacity: 1;
    background: rgba(0, 0, 0, .28);
    pointer-events: auto;
}

/* ==========================================================
   BOTÓN ELIMINAR
   ========================================================== */

.cks-cover-delete {
    position: absolute;
    top: 0px;
    right: 5px;
    z-index: 210;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .82);
    color: #fff;
    font-size: 30px;
    font-weight: 300;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.cks-cover-delete:hover {
    background: #000;
}

.cks-cover-delete svg {
    width: 24px;
    height: 24px;
}

.cks-cover-slot.is-uploading .cks-cover-delete,
.cks-cover-slot.is-deleting .cks-cover-delete {
    opacity: 0;
    pointer-events: none;
}

/* ==========================================================
   INDICADOR + PARA REEMPLAZAR
   ========================================================== */

.cks-cover-replace {
    position: absolute;
    top: 85%;
    left: 50%;
    z-index: 210;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: #fff;
    pointer-events: none;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: .8;
}

.cks-cover-replace svg {
    width: 26px;
    height: 26px;
}

.cks-cover-slot.is-uploading .cks-cover-replace,
.cks-cover-slot.is-deleting .cks-cover-replace {
    opacity: 0;
}

/* ==========================================================
   CONFIRMACIÓN
   ========================================================== */

.cks-cover-saved {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 220;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: green;
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    opacity: 0;
    transform: translate(-50%, -50%) scale(.85);
    pointer-events: none;
    transition: opacity .35s ease, transform .35s ease;
}

.cks-cover-slot.is-saved .cks-cover-saved {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    transition: opacity .2s ease, transform .2s ease;
}

/* ==========================================================
   ERROR
   ========================================================== */

.cks-cover-error {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 220;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #d93025;
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    opacity: 0;
    transform: translate(-50%, -50%) scale(.85);
    pointer-events: none;
    transition: opacity .35s ease, transform .35s ease;
}

.cks-cover-slot.is-error .cks-cover-error {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.cks-cover-slot.is-error .cks-cover-saved {
    opacity: 0;
}

.cks-cover-slot.is-error .cks-cover-circle {
    border-color: #d93025;
    box-shadow: 0 0 0 4px rgba(217, 48, 37, .12);
}

/* ==========================================================
   ALERTA PORTADA PRINCIPAL
   ========================================================== */

.cks-cover-primary-warning {
    position: absolute;
    top: -9px;
    right: -9px;
    z-index: 230;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #d93025;
    color: #fff;
    font-size: 23px;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .22);
    animation: cks-cover-warning-pulse 2s ease-in-out infinite;
}

@keyframes cks-cover-warning-pulse {

    0%,
    100% {
        box-shadow: 0 3px 10px rgba(0, 0, 0, .22);
    }

    50% {
        box-shadow: 0 3px 10px rgba(0, 0, 0, .22), 0 0 0 6px rgba(217, 48, 37, .16);
    }
}

.cks-cover-slot.has-primary-error .cks-cover-circle {
    border-color: #d93025;
    box-shadow: 0 0 0 4px rgba(217, 48, 37, .12);
}

/* ==========================================================
   INPUT
   ========================================================== */

.cks-cover-file {
    display: none;
}

/* ==========================================================
   TEXTOS
   ========================================================== */

.cks-cover-slot strong {
    display: block;
    margin-top: 13px;
    font-size: 17px;
}

.cks-cover-slot small {
    display: block;
    margin-top: 4px;
    color: #737985;
    font-size: 13px;
}

/* ==========================================================
   VIDEO DE PORTADA
   ========================================================== */

.cks-cover-video {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center center;
    border: 0;
    border-radius: 50%;
    background: #000;
}

.cks-cover-slot.has-video .cks-cover-circle {
    border-color: #5b12e8;
}

.cks-cover-slot.has-video .cks-cover-empty {
    display: none;
}

.cks-cover-slot.is-uploading .cks-cover-video {
    opacity: .48;
}

/* ==========================================================
   ESTADO VACÍO DEL VIDEO
   ========================================================== */

.cks-cover-slot.has-video .cks-cover-empty {
    display: none;
}

/* ==========================================================
   JERARQUÍA DE PORTADA
   ========================================================== */

.cks-cover-slot {
    position: relative;
    overflow: visible;
}

.cks-cover-slot .cks-cover-circle {
    border-color: #d9dde5;
}

.cks-cover-slot.is-featured .cks-cover-circle {
    border-color: #5b16e8;
}

.cks-cover-featured-label {
    display: none;
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    align-items: center;
    justify-content: center;
    padding: 5px 12px;
    border-radius: 999px;
    background: #5b16e8;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .4px;
    white-space: nowrap;
}

.cks-cover-slot.is-featured .cks-cover-featured-label {
    display: flex;
}


/* ==========================================================
   PREVISUALIZACIÓN COVER HOME
   ========================================================== */

.cks-cover-preview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    margin-top: 24px;
}

.cks-cover-preview-slot {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    border: 3px solid #d9dde5;
    border-radius: 12px;
    background: #f1f3f6;
}

.cks-cover-preview-media {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 9px;
}

.cks-cover-preview-media img,
.cks-cover-preview-media video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.cks-cover-preview-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #9ca3af;
    font-size: 28px;
    font-weight: 300;
}

.cks-cover-preview-empty svg {
    width: 22px;
    height: 22px;
}

/* ==========================================================
   JERARQUÍA PREVIEW
   ========================================================== */

.cks-cover-preview-slot {
    border: 3px solid #d9dde5;
}

.cks-cover-preview-slot.is-featured {
    border-color: #5b16e8;
}

/* ==========================================================
   ETIQUETA PORTADA - PREVISUALIZACIÓN
   ========================================================== */

.cks-cover-preview-slot {
    position: relative;
}

.cks-cover-preview-featured-label {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px 12px;
    border-radius: 999px;
    background: #5b16e8;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .4px;
    white-space: nowrap;
}

/* ==========================================================
   TABS DE VISTA
   ========================================================== */

.cks-cover-view-tabs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: max-content;
    margin: 0 auto 48px;
    padding: 4px;
    border-radius: 12px;
    background: #f1f2f5;
}

.cks-cover-view-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 105px;
    height: 42px;
    padding: 0 14px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #737985;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}

.cks-cover-view-tab:hover {
    color: #5b12e8;
}

.cks-cover-view-tab.is-active {
    background: #5b12e8;
    color: #fff;
    box-shadow: 0 3px 8px rgba(91, 18, 232, .20);
}

.cks-cover-view-icon {
    position: relative;
    display: block;
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    border: 2px solid currentColor;
    box-sizing: border-box;
}

.cks-cover-view-icon-circle {
    border-radius: 50%;
}

.cks-cover-view-icon-portrait {
    width: 14px;
    height: 18px;
    border-radius: 3px;
}

/* ==========================================================
   CAMBIO ENTRE VISTAS
   ========================================================== */

.cks-cover-manager .cks-cover-preview {
    display: none;
}

.cks-cover-manager.is-preview .cks-cover-grid {
    display: none;
}

.cks-cover-manager.is-preview .cks-cover-preview {
    display: grid;
}

/* ==========================================================
   RENDER COVER PERFIL
   ========================================================== */
.model_avatar {
    width: 150px;
    height: 150px;
    overflow: hidden;
    outline: 3px solid var(--lavender);
    -webkit-border-radius: 100px;
    -moz-border-radius: 100px;
    border-radius: 100px;
    -webkit-transition-duration: 0.1s;
    transition-duration: 0.1s;
    margin-bottom: 9px;
    position: relative;
}

.model_avatar video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
}


/* ==========================================================
   RESPONSIVE
   ========================================================== */

@media (max-width:600px) {
    .cks-cover-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
    }
}

@media (max-width:480px) {

    .cks-cover-slot .escape {
        opacity: 0;
    }

    .cks-cover-popup {
        padding: 0px;
    }

    .cks-cover-dialog {
        padding: 24px 16px;
        border-radius: 0px;
        width: 100%;
        height: 100%;
    }

    .cks-cover-preview {
        grid-template-columns: repeat(1, minmax(0, 1fr));
        gap: 16px;
        justify-items: center;
    }

    .cks-cover-preview-slot {
        width: 135px;
    }

    .cks-cover-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr));
        gap: 18px;
    }

    .cks-cover-circle {
        width: 145px;
        height: 145px;
    }

    .cks-cover-primary-warning {
        top: -7px;
        right: -7px;
        width: 34px;
        height: 34px;
        font-size: 21px;
    }

    .cks-cover-delete {
        top: 4px;
        right: 2px;
        width: 28px;
        height: 28px;
    }

    .cks-cover-delete svg {
        width: 22px;
        height: 22px;
    }

    .cks-cover-view-tabs {
        margin: 0 auto 26px;
    }

    .model_avatar {
        width: 95px;
        height: 95px;
        margin-bottom: 0px;
    }
}