/* =====================================================================
   BIO LINK PROFESIONAL - Estilos de la página pública
   ===================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--bio-font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    display: block;
}

/* ---------------------------------------------------------------------
   Variables por tema (claro / oscuro)
--------------------------------------------------------------------- */
.theme-dark {
    --bio-text: #f8fafc;
    --bio-muted: rgba(248, 250, 252, 0.72);
    --bio-surface: rgba(255, 255, 255, 0.09);
    --bio-surface-hover: rgba(255, 255, 255, 0.16);
    --bio-border: rgba(255, 255, 255, 0.14);
    --bio-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
    --bio-btn-solid-bg: #ffffff;
    --bio-btn-solid-text: #0f172a;
    --bio-btn-soft-text: #f8fafc;
    --bio-avatar-border: rgba(255, 255, 255, 0.35);
}

.theme-light {
    --bio-text: #0f172a;
    --bio-muted: rgba(15, 23, 42, 0.72);
    --bio-surface: rgba(255, 255, 255, 0.86);
    --bio-surface-hover: #ffffff;
    --bio-border: rgba(15, 23, 42, 0.12);
    --bio-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
    --bio-btn-solid-bg: #0f172a;
    --bio-btn-solid-text: #ffffff;
    --bio-btn-soft-text: #0f172a;
    --bio-avatar-border: rgba(255, 255, 255, 0.9);
}

/* ---------------------------------------------------------------------
   Estructura
--------------------------------------------------------------------- */
.bio-page {
    min-height: 100vh;
    background-attachment: fixed;
    color: var(--bio-text);
    padding: 0 20px calc(40px + env(safe-area-inset-bottom));
}

.bio-container {
    width: 100%;
    max-width: 580px;
    margin: 0 auto;
}

/* Portada */
.bio-cover {
    margin: 0 -20px;
    height: clamp(150px, 26vw, 230px);
    overflow: hidden;
    background: rgba(0, 0, 0, 0.15);
}

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

.theme-light .bio-cover {
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

/* ---------------------------------------------------------------------
   Cabecera: avatar, logo, nombre, descripción
--------------------------------------------------------------------- */
.bio-header {
    text-align: center;
    padding-top: 0;
}

.bio-avatar {
    width: 118px;
    height: 118px;
    margin: -59px auto 0;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--bio-avatar-border);
    box-shadow: var(--bio-shadow);
    background: var(--bio-surface);
    backdrop-filter: blur(8px);
    position: relative;
    z-index: 2;
    animation: bioFadeUp 0.5s ease both;
}

.bio-cover + .bio-header .bio-avatar {
    margin-top: -59px;
}

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

.bio-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--bio-muted);
}

.bio-logo {
    max-width: 190px;
    margin: 16px auto 0;
    animation: bioFadeUp 0.5s 0.05s ease both;
}

.bio-logo img {
    max-height: 64px;
    width: auto;
    margin: 0 auto;
    object-fit: contain;
}

.bio-name {
    margin: 18px 0 0;
    font-size: clamp(1.6rem, 5.5vw, 2.1rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    animation: bioFadeUp 0.5s 0.1s ease both;
}

.bio-description {
    margin: 10px auto 0;
    max-width: 480px;
    color: var(--bio-muted);
    font-size: clamp(0.95rem, 3.6vw, 1.05rem);
    animation: bioFadeUp 0.5s 0.15s ease both;
}

/* ---------------------------------------------------------------------
   Botones
--------------------------------------------------------------------- */
.bio-links {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 30px;
}

.bio-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    min-height: 58px;
    padding: 15px 22px;
    border: 2px solid transparent;
    border-radius: var(--bio-radius, 16px);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.22s ease, box-shadow 0.22s ease, background-color 0.22s ease, border-color 0.22s ease, opacity 0.22s ease;
    animation: bioFadeUp 0.5s ease both;
}

.bio-links > *:nth-child(1) { animation-delay: 0.18s; }
.bio-links > *:nth-child(2) { animation-delay: 0.24s; }
.bio-links > *:nth-child(3) { animation-delay: 0.30s; }
.bio-links > *:nth-child(4) { animation-delay: 0.36s; }
.bio-links > *:nth-child(5) { animation-delay: 0.42s; }
.bio-links > *:nth-child(6) { animation-delay: 0.48s; }
.bio-links > *:nth-child(7) { animation-delay: 0.54s; }
.bio-links > *:nth-child(8) { animation-delay: 0.60s; }

.bio-btn:hover {
    transform: translateY(-3px);
}

.bio-btn:active {
    transform: translateY(0) scale(0.985);
}

.bio-btn:focus-visible {
    outline: 3px solid rgba(99, 102, 241, 0.75);
    outline-offset: 3px;
}

/* Estilos sólidos (predeterminado) */
.style-solid .bio-btn {
    background: var(--bio-btn-solid-bg);
    color: var(--bio-btn-solid-text);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}

.style-solid .bio-btn:hover {
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.24);
}

/* Estilo con borde */
.style-outline .bio-btn {
    background: var(--bio-surface);
    color: var(--bio-btn-soft-text);
    border-color: var(--bio-border);
    backdrop-filter: blur(6px);
}

.style-outline .bio-btn:hover {
    background: var(--bio-surface-hover);
    border-color: currentColor;
}

/* Estilo suave (claro) */
.style-soft .bio-btn {
    background: var(--bio-surface);
    color: var(--bio-btn-soft-text);
    backdrop-filter: blur(6px);
}

.style-soft .bio-btn:hover {
    background: var(--bio-surface-hover);
    box-shadow: var(--bio-shadow);
}

/* Iconos dentro de los botones */
.bio-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.bio-btn-icon img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.bio-btn-label {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Posición del icono */
.iconpos-left .bio-btn {
    flex-direction: row;
}

.iconpos-right .bio-btn {
    flex-direction: row-reverse;
}

.iconpos-none .bio-btn-icon {
    display: none;
}

.iconpos-none .bio-btn-label {
    flex: 0 1 auto;
}

/* Marca de "copiado" en el botón alias */
.bio-btn-check {
    position: absolute;
    right: 18px;
    display: inline-flex;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bio-btn-alias.is-copied .bio-btn-check {
    opacity: 1;
    transform: scale(1);
}

.bio-btn-alias.is-copied {
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.65), 0 10px 26px rgba(0, 0, 0, 0.22);
}

.bio-empty {
    text-align: center;
    color: var(--bio-muted);
    padding: 18px;
    border: 1px dashed var(--bio-border);
    border-radius: var(--bio-radius, 16px);
}

/* ---------------------------------------------------------------------
   Pie de página
--------------------------------------------------------------------- */
.bio-footer {
    margin-top: 38px;
    text-align: center;
    color: var(--bio-muted);
    font-size: 0.86rem;
}

.bio-credit p,
.bio-credit {
    margin: 0;
}

.bio-branding {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--bio-surface);
    border: 1px solid var(--bio-border);
    font-size: 0.78rem;
    text-decoration: none;
    color: inherit;
}

/* ---------------------------------------------------------------------
   Notificación flotante (alias copiado)
--------------------------------------------------------------------- */
.bio-toast {
    position: fixed;
    left: 50%;
    bottom: calc(26px + env(safe-area-inset-bottom));
    transform: translate(-50%, 24px);
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 13px 22px;
    border-radius: 999px;
    background: #16a34a;
    color: #ffffff;
    font-size: 0.94rem;
    font-weight: 600;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease, transform 0.28s ease;
    z-index: 999;
    max-width: calc(100vw - 40px);
    text-align: center;
}

.bio-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ---------------------------------------------------------------------
   Barra de vista previa (solo en admin)
--------------------------------------------------------------------- */
.preview-bar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 18px;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 0.88rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.preview-bar-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-weight: 600;
}

.preview-bar a {
    color: #a5b4fc;
    font-weight: 600;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid rgba(165, 180, 252, 0.4);
    transition: background-color 0.2s ease;
}

.preview-bar a:hover {
    background: rgba(165, 180, 252, 0.14);
}

/* ---------------------------------------------------------------------
   Animaciones
--------------------------------------------------------------------- */
@keyframes bioFadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .bio-page {
        background-attachment: scroll;
    }
}

/* ---------------------------------------------------------------------
   Responsive
--------------------------------------------------------------------- */
@media (max-width: 480px) {
    .bio-page {
        padding-left: 16px;
        padding-right: 16px;
    }

    .bio-cover {
        margin-left: -16px;
        margin-right: -16px;
        height: 150px;
    }

    .bio-avatar {
        width: 104px;
        height: 104px;
        margin-top: -52px;
    }

    .bio-links {
        gap: 12px;
        margin-top: 26px;
    }

    .bio-btn {
        min-height: 54px;
        padding: 14px 18px;
        font-size: 0.98rem;
    }

    .bio-btn-check {
        right: 14px;
    }
}

@media (min-width: 768px) {
    .bio-cover {
        margin-left: -20px;
        margin-right: -20px;
    }
}

/* =====================================================================
   Alias de pago múltiples (panel desplegable con botón copiar)
   ===================================================================== */
.bio-alias-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bio-btn-chevron {
    display: inline-flex;
    flex: none;
    transition: transform 0.2s ease;
}

.bio-btn-alias-toggle.is-open .bio-btn-chevron {
    transform: rotate(180deg);
}

.bio-alias-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    color: var(--bio-text);
    background: var(--bio-surface);
    border: 1px solid var(--bio-border);
    border-radius: var(--bio-radius, 16px);
    box-shadow: var(--bio-shadow);
}

.bio-alias-panel[hidden] {
    display: none;
}

.bio-alias-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--bio-border);
    border-radius: calc(var(--bio-radius, 16px) * 0.75);
}

.bio-alias-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
}

.bio-alias-label {
    font-weight: 700;
    font-size: 0.95rem;
}

.bio-alias-holder {
    font-size: 0.82rem;
    color: var(--bio-muted);
}

.bio-alias-value {
    margin-top: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.95rem;
    word-break: break-all;
}

.bio-alias-copy {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 14px;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--bio-btn-solid-bg);
    color: var(--bio-btn-solid-text);
    transition: transform 0.15s ease, background 0.2s ease;
}

.bio-alias-copy:hover {
    transform: translateY(-1px);
}

.bio-alias-copy.is-copied {
    background: #16a34a;
    color: #ffffff;
}

@media (max-width: 380px) {
    .bio-alias-card {
        flex-wrap: wrap;
    }
    .bio-alias-copy {
        width: 100%;
        justify-content: center;
    }
}
