/* ============================================
   Enlaceme - Estilos del perfil público
   5 temas: claro, oscuro, degradado, neon, oceano
   Mobile-first, carga ultrarrápida
   ============================================ */

/* --- Reset mínimo --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 0;
    padding-bottom: 2rem;
    line-height: 1.5;
    position: relative;
}

/* En escritorio: contenido en tarjeta centrada tipo móvil */
@media (min-width: 600px) {
    body {
        align-items: flex-start;
        padding: 2rem 1rem;
    }

    /* Sin imagen de fondo: fondo oscuro neutro en los laterales */
    body:not(.tiene-fondo) {
        background-color: #1a1a2a;
    }
    /* Con imagen de fondo: el div .perfil-bg-fondo la muestra, body transparente */
    body.tiene-fondo {
        background: transparent;
    }
}

/* Imagen de fondo — div independiente que cubre toda la pantalla */
.perfil-bg-fondo {
    position: fixed;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    z-index: 0;
}

/* Overlay oscuro sobre la imagen de fondo */
.perfil-fondo-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 0;
}

a {
    text-decoration: none;
    color: inherit;
}

/* --- Rich text en nombre y bio --- */
.perfil-nombre strong, .perfil-nombre b { font-weight: 800; }
.perfil-nombre em, .perfil-nombre i { font-style: italic; }
.perfil-nombre u { text-decoration: underline; }
.perfil-nombre s { text-decoration: line-through; }
.perfil-nombre span[style] { display: inline; }

.perfil-bio p { margin: 0 0 0.4rem; }
.perfil-bio p:last-child { margin-bottom: 0; }
.perfil-bio strong, .perfil-bio b { font-weight: 700; }
.perfil-bio em, .perfil-bio i { font-style: italic; }
.perfil-bio u { text-decoration: underline; }
.perfil-bio s { text-decoration: line-through; }
.perfil-bio a { color: inherit; text-decoration: underline; opacity: 0.85; }
.perfil-bio span[style] { display: inline; }

/* --- Contenedor del perfil --- */
.perfil-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    animation: fadeIn 0.4s ease;
    padding: 0 1rem;
}

/* En escritorio: tarjeta con scroll interno tipo app móvil */
@media (min-width: 600px) {
    .perfil-container {
        background: inherit;
        border-radius: 24px 24px 0 0;
        box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 24px 64px rgba(0,0,0,0.5);
        min-height: calc(100vh - 4rem);
        padding: 0;
        overflow: hidden;
    }

    /* Cabecera sin padding lateral extra en desktop */
    .perfil-container .perfil-cabecera {
        border-radius: 24px 24px 0 0;
    }

    /* Contenido interior con padding lateral */
    .perfil-container .perfil-enlaces,
    .perfil-container .perfil-bloques,
    .perfil-container .perfil-compartir,
    .perfil-container .perfil-footer {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
        width: 100%;
    }
}

/* --- Cabecera (avatar + nombre + bio + sociales) --- */
.perfil-cabecera {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2rem 1rem 1.5rem;
    position: relative;
    margin-bottom: 1rem;
}

.perfil-cabecera-con-img {
    width: 100vw;
    max-width: 100vw;
    background-size: cover;
    background-position: center;
    padding: 2.5rem 1rem 2rem;
}

.perfil-cabecera-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.perfil-cabecera-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 480px;
    width: 100%;
}

.perfil-cabecera-con-img .perfil-cabecera-inner {
    color: white;
}

.perfil-cabecera-con-img .perfil-nombre {
    color: white;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.perfil-cabecera-con-img .perfil-bio {
    color: rgba(255,255,255,0.9);
}

.perfil-cabecera-con-img .perfil-avatar {
    border-color: rgba(255,255,255,0.8);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Avatar --- */
.perfil-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 1rem;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.perfil-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- Nombre y bio --- */
.perfil-nombre {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.perfil-bio {
    font-size: 0.95rem;
    opacity: 0.85;
    max-width: 380px;
    margin-bottom: 1.75rem;
}

/* --- Iconos sociales de cabecera --- */
.perfil-sociales {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.perfil-social-icono {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: transform 150ms ease, box-shadow 150ms ease;
}

.perfil-social-icono svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.perfil-social-icono:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* --- Enlaces --- */
.perfil-enlaces {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.perfil-enlace {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.875rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    transition: transform 150ms ease, box-shadow 150ms ease;
    position: relative;
}

.perfil-enlace:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.perfil-enlace:active {
    transform: translateY(0);
}

.perfil-enlace-icono svg {
    width: 22px;
    height: 22px;
    vertical-align: middle;
}

.perfil-enlace-icono.icono-img {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    object-fit: cover;
    vertical-align: middle;
}

/* --- Bloques del perfil --- */
.perfil-bloques {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

/* Encabezados */
.perfil-heading {
    width: 100%;
    margin-top: 0.5rem;
    text-align: left;
}

.perfil-heading-1 {
    font-size: 1.4rem;
    font-weight: 700;
}

.perfil-heading-2 {
    font-size: 1.15rem;
    font-weight: 600;
}

.perfil-heading-3 {
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.8;
}

/* Texto */
.perfil-texto {
    width: 100%;
    font-size: 0.9rem;
    line-height: 1.6;
    opacity: 0.85;
    text-align: left;
}

/* Alineación */
.perfil-align-izquierda { text-align: left; }
.perfil-align-centro { text-align: center; }
.perfil-align-derecha { text-align: right; }

/* Imagen centrada */
.perfil-imagen-wrap {
    width: 100%;
    text-align: center;
}

/* Texto enriquecido */
.perfil-texto a {
    text-decoration: underline;
    opacity: 1;
}

.perfil-texto a:hover {
    opacity: 0.8;
}

/* Imagen */
.perfil-imagen {
    width: 100%;
    max-width: 100%;
    border-radius: 0.5rem;
    display: block;
}

.perfil-imagen-link {
    display: block;
    width: 100%;
    transition: transform 150ms ease, box-shadow 150ms ease;
}

.perfil-imagen-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* Video YouTube */
.perfil-video-wrap {
    width: 100%;
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    border-radius: 0.5rem;
    overflow: hidden;
}

.perfil-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Formulario de contacto */
.perfil-contacto {
    width: 100%;
    padding: 1.25rem;
    border-radius: 0.75rem;
    text-align: left;
}

.tema-claro .perfil-contacto { background: #FFFFFF; border: 1px solid #E2E8F0; }
.tema-oscuro .perfil-contacto { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12); }
.tema-degradado .perfil-contacto { background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.2); backdrop-filter: blur(4px); }
.tema-neon .perfil-contacto { background: transparent; border: 1px solid #39FF14; }
.tema-oceano .perfil-contacto { background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.25); backdrop-filter: blur(4px); }
.tema-personalizado .perfil-contacto { background: rgba(128,128,128,0.1); border: 1px solid rgba(128,128,128,0.2); }

.perfil-contacto-titulo {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.perfil-contacto-campo {
    margin-bottom: 0.6rem;
}

.perfil-contacto-input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
    font-family: inherit;
    border: 1px solid rgba(128,128,128,0.3);
    border-radius: 0.375rem;
    background: rgba(255,255,255,0.1);
    color: inherit;
    outline: none;
    transition: border-color 150ms ease;
}

.perfil-contacto-input:focus {
    border-color: rgba(108, 92, 231, 0.6);
}

.tema-claro .perfil-contacto-input { background: #F8F9FA; color: #2D3436; }
.tema-neon .perfil-contacto-input { background: #1A1A1A; color: #39FF14; border-color: #39FF14; }

textarea.perfil-contacto-input {
    resize: vertical;
    min-height: 60px;
}

.perfil-contacto-btn {
    width: 100%;
    padding: 0.7rem;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: opacity 150ms ease;
    background: rgba(108, 92, 231, 0.9);
    color: white;
}

.tema-neon .perfil-contacto-btn { background: #39FF14; color: #0D0D0D; }

.perfil-contacto-btn:hover { opacity: 0.85; }
.perfil-contacto-btn:disabled { opacity: 0.5; cursor: wait; }

.perfil-contacto-estado {
    margin-top: 0.5rem;
    padding: 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.85rem;
    text-align: center;
}

.perfil-contacto-ok { background: rgba(0,184,148,0.15); color: #00B894; }
.perfil-contacto-error { background: rgba(231,76,60,0.15); color: #E74C3C; }

/* Separador */
.perfil-separador {
    width: 60%;
    border: none;
    border-top: 1px solid currentColor;
    opacity: 0.2;
    margin: 0.5rem auto;
}

/* --- Perfil vacío --- */
.perfil-vacio {
    opacity: 0.6;
    font-size: 0.9rem;
    margin: 2rem 0;
}

/* --- Compartir --- */
.perfil-compartir {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.perfil-compartir-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.5;
    font-weight: 600;
}

.perfil-compartir-btns {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: center;
}

.perfil-share-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: none;
    cursor: pointer;
    transition: transform 150ms ease, box-shadow 150ms ease;
    text-decoration: none;
}

.perfil-share-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.perfil-share-btn:hover {
    transform: scale(1.12);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.perfil-copiado {
    font-size: 0.78rem;
    color: #00B894;
    font-weight: 600;
    animation: fadeIn 0.3s ease;
}

/* --- Footer --- */
.perfil-footer {
    margin-top: auto;
    padding-top: 2rem;
    font-size: 0.78rem;
    opacity: 0.5;
}

.perfil-footer:hover {
    opacity: 0.8;
}

/* ============================================
   TEMAS
   ============================================ */

/* --- Tema Claro --- */
.tema-claro {
    background: #F8F9FA;
    color: #2D3436;
}

.tema-claro .perfil-avatar {
    border-color: #E2E8F0;
}

.tema-claro .perfil-enlace {
    background: #FFFFFF;
    color: #2D3436;
    border: 1px solid #E2E8F0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.tema-claro .perfil-enlace:hover {
    border-color: #6C5CE7;
    color: #6C5CE7;
}

/* --- Tema Oscuro --- */
.tema-oscuro {
    background: #1A1A2E;
    color: #E2E8F0;
}

.tema-oscuro .perfil-avatar {
    border-color: rgba(255, 255, 255, 0.15);
}

.tema-oscuro .perfil-enlace {
    background: rgba(255, 255, 255, 0.08);
    color: #E2E8F0;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.tema-oscuro .perfil-enlace:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
}

.tema-oscuro .perfil-footer a {
    color: #A29BFE;
}

/* --- Tema Degradado --- */
.tema-degradado {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #FFFFFF;
}

.tema-degradado .perfil-avatar {
    border-color: rgba(255, 255, 255, 0.4);
}

.tema-degradado .perfil-enlace {
    background: rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(4px);
}

.tema-degradado .perfil-enlace:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* --- Tema Neón --- */
.tema-neon {
    background: #0D0D0D;
    color: #FFFFFF;
}

.tema-neon .perfil-avatar {
    border-color: #39FF14;
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.3);
}

.tema-neon .perfil-nombre {
    text-shadow: 0 0 10px rgba(57, 255, 20, 0.5);
    color: #39FF14;
}

.tema-neon .perfil-enlace {
    background: transparent;
    color: #39FF14;
    border: 1px solid #39FF14;
    box-shadow: 0 0 8px rgba(57, 255, 20, 0.2);
}

.tema-neon .perfil-enlace:hover {
    background: #39FF14;
    color: #0D0D0D;
    box-shadow: 0 0 20px rgba(57, 255, 20, 0.5);
}

.tema-neon .perfil-footer a {
    color: #39FF14;
}

/* --- Tema Océano --- */
.tema-oceano {
    background: linear-gradient(180deg, #0077B6 0%, #00B4D8 50%, #90E0EF 100%);
    color: #FFFFFF;
}
@media (min-width: 600px) {
    /* En escritorio los temas no sobreescriben el fondo del body
       para que la imagen de fondo se vea en los laterales */
    body.tiene-fondo.tema-claro,
    body.tiene-fondo.tema-oscuro,
    body.tiene-fondo.tema-degradado,
    body.tiene-fondo.tema-neon,
    body.tiene-fondo.tema-oceano,
    body.tiene-fondo.tema-personalizado {
        background: transparent;
    }
}

.tema-oceano .perfil-avatar {
    border-color: rgba(255, 255, 255, 0.5);
}

.tema-oceano .perfil-enlace {
    background: rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(4px);
}

.tema-oceano .perfil-enlace:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* --- Tema Personalizado (colores via CSS variables inline) --- */
.tema-personalizado .perfil-avatar {
    border-color: rgba(255, 255, 255, 0.3);
}

/* --- Responsive --- */
@media (max-width: 480px) {
    body {
        padding: 1.5rem 0.75rem;
    }

    .perfil-nombre {
        font-size: 1.25rem;
    }

    .perfil-enlace {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}
