* {
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}


/* =============================================
   PÁGINA
============================================= */

.profile-page {
    --profile-surface: var(--bg-panel, #ffffff);
    --profile-soft: var(--bg-panel-soft, #f5edf7);
    --profile-border: var(--border, #e2dce8);
    --profile-text: var(--text-main, #2d2d35);
    --profile-muted: var(--text-muted, #6f6f7a);
    --profile-accent: var(--primary-color, #af00a1);
    --profile-accent-hover: var(--primary-hover-color, #d642df);

    width: 100%;
    max-width: 1000px;
    min-height: calc(100vh - 120px);
    margin: 0 auto;
    padding: 32px 20px 56px;

    color: var(--profile-text);
}

.oculto {
    display: none !important;
}

/* =============================================
   CARGANDO / MENSAJES
============================================= */

.profile-status,
.profile-message {
    width: 100%;
    max-width: 720px;
    margin: 24px auto;
    padding: 28px 24px;

    background: var(--profile-surface);
    color: var(--profile-text);

    border: 1px solid var(--profile-border);
    border-radius: 14px;

    text-align: center;
}

.profile-status {
    min-height: 160px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;

    color: var(--profile-muted);
}

.profile-spinner {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;

    border: 3px solid var(--profile-border);
    border-top-color: var(--profile-accent);
    border-radius: 50%;

    animation: profile-spin 0.8s linear infinite;
}

@keyframes profile-spin {
    to {
        transform: rotate(360deg);
    }
}

.profile-message h2 {
    margin: 0 0 8px;
    color: var(--profile-text);
}

.profile-message p {
    margin: 0 0 20px;
    color: var(--profile-muted);
    line-height: 1.55;
}

/* =============================================
   CONTENIDO
============================================= */

.profile-content {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
}

/* =============================================
   TARJETA DE PERFIL
============================================= */

.profile-card {
    position: relative;

    width: 100%;
    min-width: 0;

    display: grid;
    grid-template-columns: 128px minmax(0, 1fr);
    align-items: start;
    gap: 26px;

    padding: 28px;

    background: var(--profile-surface);
    border: 1px solid var(--profile-border);
    border-radius: 16px;

    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.profile-card::before {
    content: "";

    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;

    width: 4px;

    background: var(--profile-accent);

    border-radius: 16px 0 0 16px;
}

/* =============================================
   AVATAR
============================================= */

.profile-avatar-container {
    position: relative;

    width: 128px;
    height: 128px;
}

.profile-avatar {
    display: block;

    width: 128px;
    height: 128px;

    object-fit: cover;

    background: var(--profile-soft);

    border: 3px solid var(--profile-surface);
    border-radius: 50%;

    outline: 2px solid var(--profile-accent);
    outline-offset: 2px;
}

.profile-avatar-container::after {
    content: "";

    position: absolute;
    inset: -5px;

    border: 1px solid rgba(175, 0, 161, 0.22);
    border-radius: 50%;

    pointer-events: none;
}

/* =============================================
   INFORMACIÓN
============================================= */

.profile-info {
    width: 100%;
    min-width: 0;
}

.profile-name {
    max-width: 100%;

    margin: 0 0 7px;

    color: var(--profile-text);

    font-size: clamp(1.55rem, 3vw, 2rem);
    font-weight: 750;
    line-height: 1.15;

    overflow-wrap: anywhere;
}

.profile-role {
    display: inline-flex;
    align-items: center;

    max-width: 100%;

    margin-bottom: 16px;
    padding: 5px 10px;

    color: var(--profile-accent);
    background: rgba(175, 0, 161, 0.08);

    border: 1px solid rgba(175, 0, 161, 0.20);
    border-radius: 999px;

    font-size: 0.78rem;
    font-weight: 750;

    overflow-wrap: anywhere;
}

.profile-description {
    width: 100%;
    max-width: 100%;

    margin: 0;

    color: var(--profile-muted);

    font-size: 0.95rem;
    line-height: 1.6;

    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* =============================================
   ACCIONES
============================================= */


.profile-actions {
    width: 100%;
    margin-top: 22px;

    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;

    gap: 10px;
}

.profile-actions .profile-button,
.profile-actions .profile-back-button {
    width: auto !important;
    min-width: max-content;
    min-height: 42px;

    flex: 0 0 auto;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 10px 18px;

    border: 1px solid transparent;
    border-radius: var(--border-radius, 9px);

    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.2;

    white-space: nowrap;

    text-align: center;
    text-decoration: none;

    cursor: pointer;

    box-sizing: border-box;

    transition:
        transform 0.15s ease,
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
}

.profile-actions .profile-button:hover,
.profile-actions .profile-back-button:hover {
    transform: translateY(-1px);
}

.profile-actions .profile-button:active,
.profile-actions .profile-back-button:active {
    transform: none;
}

.profile-actions .profile-button:focus-visible,
.profile-actions .profile-back-button:focus-visible {
    outline: 2px solid var(--profile-accent);
    outline-offset: 2px;
}

.profile-actions .profile-button-primary {
    background: var(--profile-accent);
    color: #ffffff;
    border-color: var(--profile-accent);
}

.profile-actions .profile-button-primary:hover {
    background: var(--profile-accent-hover);
    color: #ffffff;
    border-color: var(--profile-accent-hover);
}

.profile-actions .profile-button-secondary,
.profile-actions .profile-back-button {
    background: var(--profile-soft);
    color: var(--profile-text);
    border-color: var(--profile-border);
}

.profile-actions .profile-button-secondary:hover,
.profile-actions .profile-back-button:hover {
    background: var(--profile-surface);
    color: var(--profile-accent);
    border-color: var(--profile-accent);
}



/* =============================================
   DARK MODE
============================================= */

[data-theme="dark"] .profile-page,
body.dark .profile-page,
body.dark-mode .profile-page,
.dark-mode .profile-page {
    --profile-surface:
        var(
            --bg-panel,
            #1b1622
        );

    --profile-soft:
        var(
            --bg-panel-soft,
            #251e2e
        );

    --profile-border:
        var(
            --border,
            #3d304b
        );

    --profile-text:
        var(
            --text-main,
            #f4eff6
        );

    --profile-muted:
        var(
            --text-muted,
            #a59ba9
        );
}

[data-theme="dark"] .profile-card,
body.dark .profile-card,
body.dark-mode .profile-card,
.dark-mode .profile-card {
    background:
        linear-gradient(
            145deg,
            var(--profile-surface),
            var(--profile-soft)
        );

    box-shadow:
        0 16px 45px
        rgba(0, 0, 0, 0.32);
}

[data-theme="dark"] .profile-avatar,
body.dark .profile-avatar,
body.dark-mode .profile-avatar,
.dark-mode .profile-avatar {
    background:
        var(--profile-soft);

    border-color:
        var(--profile-surface);

    box-shadow:
        0 10px 28px
        rgba(0, 0, 0, 0.38);
}

[data-theme="dark"] .profile-avatar-container::after,
body.dark .profile-avatar-container::after,
body.dark-mode .profile-avatar-container::after,
.dark-mode .profile-avatar-container::after {
    border-color:
        rgba(214, 66, 223, 0.35);
}

[data-theme="dark"] .profile-role,
body.dark .profile-role,
body.dark-mode .profile-role,
.dark-mode .profile-role {
    background:
        rgba(214, 66, 223, 0.10);

    border-color:
        rgba(214, 66, 223, 0.28);

    color:
        var(--profile-accent-hover);
}

[data-theme="dark"] .profile-button-secondary,
[data-theme="dark"] .profile-back-button,
body.dark .profile-button-secondary,
body.dark .profile-back-button,
body.dark-mode .profile-button-secondary,
body.dark-mode .profile-back-button,
.dark-mode .profile-button-secondary,
.dark-mode .profile-back-button {
    background:
        var(--profile-surface);

    color:
        var(--profile-text);

    border-color:
        var(--profile-border);
}

[data-theme="dark"] .profile-button-secondary:hover,
[data-theme="dark"] .profile-back-button:hover,
body.dark .profile-button-secondary:hover,
body.dark .profile-back-button:hover,
body.dark-mode .profile-button-secondary:hover,
body.dark-mode .profile-back-button:hover,
.dark-mode .profile-button-secondary:hover,
.dark-mode .profile-back-button:hover {
    background:
        var(--profile-soft);

    color:
        var(--profile-accent-hover);

    border-color:
        rgba(214, 66, 223, 0.38);
}

[data-theme="dark"] .profile-status,
[data-theme="dark"] .profile-message,
body.dark .profile-status,
body.dark .profile-message,
body.dark-mode .profile-status,
body.dark-mode .profile-message,
.dark-mode .profile-status,
.dark-mode .profile-message {
    background:
        var(--profile-surface);

    color:
        var(--profile-text);

    border-color:
        var(--profile-border);

    box-shadow:
        0 14px 38px
        rgba(0, 0, 0, 0.30);
}

[data-theme="dark"] .profile-spinner,
body.dark .profile-spinner,
body.dark-mode .profile-spinner,
.dark-mode .profile-spinner {
    border-color:
        var(--profile-border);

    border-top-color:
        var(--profile-accent);
}

[data-theme="dark"] .profile-button-primary,
body.dark .profile-button-primary,
body.dark-mode .profile-button-primary,
.dark-mode .profile-button-primary {
    color: #ffffff;
}


/* =============================================
   TABLET
============================================= */

@media (max-width: 700px) {
    .profile-page {
        min-height: auto;
        padding: 24px 15px 44px;
    }

    .profile-card {
        grid-template-columns: 108px minmax(0, 1fr);
        gap: 20px;
        padding: 24px 20px;
    }

    .profile-avatar-container,
    .profile-avatar {
        width: 108px;
        height: 108px;
    }
}

/* =============================================
   MÓVIL
============================================= */

@media (max-width: 520px) {
    .profile-page {
        padding: 18px 10px 36px;
    }

    .profile-card {
        display: flex;
        flex-direction: column;
        align-items: center;

        gap: 18px;

        padding: 24px 16px;

        text-align: center;

        border-radius: 14px;
    }

    .profile-card::before {
        right: 0;
        bottom: auto;

        width: auto;
        height: 4px;

        border-radius: 14px 14px 0 0;
    }

    .profile-avatar-container,
    .profile-avatar {
        width: 104px;
        height: 104px;
    }

    .profile-info {
        width: 100%;
    }

    .profile-name {
        font-size: 1.55rem;
    }

    .profile-description {
        font-size: 0.93rem;
        line-height: 1.55;
    }

    .profile-actions {
        flex-direction: column;
        align-items: stretch;

        margin-top: 20px;
    }

    .profile-button,
    .profile-back-button {
        width: 100%;
    }

    .profile-status,
    .profile-message {
        margin: 16px auto;
        padding: 24px 18px;
        border-radius: 14px;
    }
}

/* =============================================
   ACCESIBILIDAD
============================================= */

@media (prefers-reduced-motion: reduce) {

    .profile-spinner {
        animation: none;
    }

    .profile-button,
    .profile-back-button {
        transition: none;
    }

    .profile-button:hover,
    .profile-back-button:hover {
        transform: none;
    }
}