/* =========================================================
   GRUPO-CHAT - SISTEMA DE DISEÑO ROJO CLARO / CORAL SUAVE
   Estética clara moderna: Blanco, Rojo Claro Pastel y Acentos Coral
   ========================================================= */

:root {
    --bg-app: #fff8f8;
    --bg-canvas: #fff8f8;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #fff3f3;

    /* Rojo Claro Principal y Variantes Pastel */
    --brand-purple: #e05353;
    --brand-purple-hover: #cc1f1f;
    --brand-purple-light: #fee8e8;
    --brand-purple-lighter: #fff2f2;
    --brand-purple-tag: #e05353;
    --brand-purple-text: #e06666;
    --brand-gradient: linear-gradient(135deg, #f87171 0%, #e05353 100%);
    --brand-shadow: 0 4px 16px rgba(224, 83, 83, 0.28);

    /* Estados y Colores Semánticos */
    --success: #10b981;
    --danger: #dc2626;
    --danger-light: #fee2e2;

    /* Textos */
    --text-primary: #1e2022;
    --text-secondary: #6e6464;
    --text-muted: #9d9191;

    /* Bordes y Sombras */
    --border-light: #faeaea;
    --border-card: #f5dede;
    --border-active: #e05353;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-full: 9999px;

    --shadow-subtle: 0 2px 10px rgba(224, 83, 83, 0.05);
    --shadow-card: 0 4px 18px rgba(224, 83, 83, 0.06);
    --shadow-float: 0 8px 30px rgba(224, 83, 83, 0.12);

    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --font-heading: 'Outfit', sans-serif;
    --font-doodle: 'Caveat', 'Outfit', cursive, sans-serif;
}

/* Reset & Box Sizing */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar Personalizado en tonos suaves */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(224, 83, 83, 0.2);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(224, 83, 83, 0.4);
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
    background: var(--bg-app);
}

/* =========================================================
   LAYOUT PRINCIPAL DEL CHAT
   ========================================================= */
.chat-layout {
    display: flex;
    flex: 1 1 0%;
    min-height: 0;
    height: 100%;
    width: 100%;
    overflow: hidden;
    position: relative;
}

/* =========================================================
   BARRA LATERAL IZQUIERDA (SIDEBAR BLANCO)
   ========================================================= */
.chat-sidebar {
    width: 310px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    z-index: 30;
}

/* Encabezado Logo y Marca */
.sidebar-brand-header {
    padding: 22px 20px 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--brand-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(224, 83, 83, 0.3);
    flex-shrink: 0;
}

.brand-title-group {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 800;
    color: #2b1f1f;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.brand-tagline {
    font-size: 0.76rem;
    color: var(--brand-purple-text);
    font-weight: 500;
}

/* Pestañas del Sidebar: Grupos / Chats */
.sidebar-tabs {
    display: flex;
    gap: 4px;
    padding: 10px 14px 6px 14px;
}

.sidebar-tab {
    flex: 1;
    padding: 8px 0;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.18s ease;
}

.sidebar-tab:hover {
    background: var(--brand-purple-lighter);
    color: var(--brand-purple);
}

.sidebar-tab.active {
    background: var(--brand-purple-light);
    color: var(--brand-purple);
}

/* Menú flotante de + (foto/doc) */
.more-options-menu {
    position: absolute;
    bottom: 70px;
    left: 8px;
    background: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 28px rgba(224, 83, 83, 0.15), 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid var(--border-light);
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 4px;
    z-index: 50;
    min-width: 150px;
    animation: menuSlideUp 0.15s ease;
}

.more-options-menu.open {
    display: flex;
}

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

.btn-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
    white-space: nowrap;
}

.btn-option i {
    font-size: 1rem;
    color: var(--brand-purple);
    width: 18px;
    text-align: center;
}

.btn-option:hover {
    background: var(--brand-purple-lighter);
}


.btn-circle-action {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--brand-purple-light);
    color: var(--brand-purple);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: all 0.18s ease;
}

.btn-circle-action:hover {
    background: #fdd8d8;
    transform: scale(1.05);
}

/* Lista de Chats y Usuarios */
.sidebar-users-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    color: inherit;
}

.sidebar-user-item:hover {
    background: var(--brand-purple-lighter);
}

.sidebar-user-item.active-room {
    background: var(--brand-purple-light);
}

.sidebar-user-item.active-room .room-title-text {
    color: var(--brand-purple);
    font-weight: 700;
}

.sidebar-user-item.active-room .room-status-text {
    color: var(--brand-purple-text);
}

.sidebar-user-item.active-room .item-arrow {
    color: var(--brand-purple);
}

.user-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

.room-avatar-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--brand-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.05rem;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    background: #faeaea;
    border: 1.5px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.user-online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--success);
    border: 2px solid #ffffff;
}

.user-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.you-tag {
    font-size: 0.75rem;
    color: var(--brand-purple);
    font-weight: 600;
    margin-left: 4px;
}

.user-handle {
    font-size: 0.76rem;
    color: var(--text-muted);
}

.item-arrow {
    color: #fca5a5;
    font-size: 0.78rem;
    margin-left: auto;
}

/* Pie de Barra Lateral */
.sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-profile-link {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--brand-purple);
    text-decoration: none;
    transition: all 0.15s ease;
}

.sidebar-profile-link:hover {
    color: var(--brand-purple-hover);
    transform: translateX(2px);
}

.sidebar-logout-link {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--danger-light);
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.15s ease;
}

.sidebar-logout-link:hover {
    background: var(--danger);
    color: #ffffff;
}

/* =========================================================
   ÁREA PRINCIPAL DE CHAT (CANVAS PASTEL ROJO CLARO)
   ========================================================= */
.chat-main {
    flex: 1 1 0%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-canvas);
    overflow: hidden;
    position: relative;
}

/* Encabezado Superior de la Sala */
.chat-room-header {
    height: 70px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    z-index: 20;
}

.room-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.room-icon-purple {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--brand-purple);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    box-shadow: 0 3px 10px rgba(224, 83, 83, 0.25);
}

.room-name {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.room-status {
    font-size: 0.8rem;
    color: var(--brand-purple-text);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
}

/* Acciones y Tarjeta de Usuario en Cabecera */
.room-actions-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-profile-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 14px 4px 6px;
    background: var(--bg-app);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    text-decoration: none;
    margin-left: 6px;
    transition: all 0.15s ease;
}

.header-profile-badge:hover {
    background: var(--brand-purple-light);
    border-color: #fecaca;
}

.badge-avatar-wrap {
    position: relative;
    width: 36px;
    height: 36px;
}

.header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--brand-purple);
}

.badge-online-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--success);
    border: 1.5px solid #ffffff;
}

.badge-texts {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.badge-fullname {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.badge-userhandle {
    font-size: 0.72rem;
    color: var(--brand-purple-text);
}

/* =========================================================
   CANVAS DE MENSAJES CON ILUSTRACIONES
   ========================================================= */
.chat-messages-container {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
    padding: 24px 32px 16px 32px;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Doodles decorativos en fondo */
.chat-canvas-doodles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.doodle-text {
    position: absolute;
    top: 18%;
    right: 8%;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: var(--font-doodle);
    font-size: 1.6rem;
    font-weight: 700;
    color: rgba(224, 83, 83, 0.35);
    transform: rotate(6deg);
    line-height: 1.15;
    user-select: none;
}

.doodle-heart {
    font-size: 1.5rem;
    color: rgba(224, 83, 83, 0.45);
    margin-top: 4px;
}

.doodle-airplane {
    position: absolute;
    bottom: 22%;
    right: 5%;
    width: 75px;
    height: 75px;
    transform: rotate(-12deg);
    opacity: 0.85;
}

.plane-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 6px 12px rgba(224, 83, 83, 0.18));
}

.doodle-wave-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle at bottom left, rgba(254, 202, 202, 0.35) 0%, transparent 70%);
}

/* Pastilla Centrada de Fecha */
.chat-date-pill {
    margin: 0 auto 24px auto;
    background: #fee8e8;
    color: var(--brand-purple);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 20px;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-subtle);
    z-index: 5;
    user-select: none;
}

/* Contenedor de Mensajes */
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
    min-height: 100%;
    z-index: 5;
}

.chat-messages::before {
    content: '';
    margin-top: auto;
}

.chat-loader {
    text-align: center;
    padding: 40px 0;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
}

.chat-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.chat-empty i {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.5;
    color: var(--brand-purple);
}

/* =========================================================
   TARJETAS DE MENSAJE
   ========================================================= */
.chat-message-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 78%;
    animation: message-appear 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

@keyframes message-appear {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.msg-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

.msg-sender-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: #fde8e8;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(224, 83, 83, 0.12);
}

.msg-bubble-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    box-shadow: var(--shadow-card);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    min-width: 190px;
    max-width: 520px;
    display: flex;
    flex-direction: column;
}

/* =========================================================
   ALINEACIÓN DIFERENCIADA: OTROS (IZQUIERDA) vs PROPIO (DERECHA)
   ========================================================= */
/* Mensajes de otros participantes: a la izquierda */
.chat-message-row.msg-other {
    align-self: flex-start;
    margin-right: auto;
    flex-direction: row;
}

.chat-message-row.msg-other .msg-bubble-card {
    border-top-left-radius: 4px;
    background: #ffffff;
    border: 1px solid var(--border-card);
}

/* Mensajes propios del usuario logueado: a la derecha */
.chat-message-row.msg-own {
    align-self: flex-end;
    margin-left: auto;
    flex-direction: row-reverse;
}

.chat-message-row.msg-own .msg-bubble-card {
    background: linear-gradient(145deg, #fff5f5 0%, #fee8e8 100%);
    border: 1px solid #fca5a5;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 16px rgba(224, 83, 83, 0.1);
}

.chat-message-row.msg-own .msg-card-header {
    flex-direction: row-reverse;
}

.chat-message-row.msg-own .msg-card-time {
    margin-left: 0;
    margin-right: auto;
}

.chat-message-row.msg-own .msg-card-footer {
    justify-content: flex-end;
}

.chat-message-row.msg-own .msg-hover-actions {
    margin-left: 0;
    margin-right: 4px;
    flex-direction: row-reverse;
}

/* Cabecera del Mensaje */
.msg-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.msg-card-author {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
}

.you-pill-badge {
    background: var(--brand-purple);
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    letter-spacing: 0.02em;
}

.msg-card-time {
    margin-left: auto;
    font-size: 0.74rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Cuerpo del Mensaje */
.msg-card-body {
    word-break: break-word;
}

.msg-text {
    font-size: 0.94rem;
    color: #2d3436;
    line-height: 1.5;
    white-space: pre-wrap;
}

.msg-photo-wrapper {
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    max-width: 320px;
    max-height: 320px;
    position: relative;
    box-shadow: var(--shadow-subtle);
}

.msg-photo-img {
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: cover;
    display: block;
    border-radius: 12px;
    transition: transform 0.15s ease;
}

.msg-photo-img:hover {
    transform: scale(1.02);
}

/* Pie del Mensaje (Fecha Completa) */
.msg-card-footer {
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.msg-full-date {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: var(--font-main);
}

/* Botones de Acción al pasar el cursor */
.msg-hover-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.15s ease;
    align-self: center;
    margin-left: 4px;
}

.chat-message-row:hover .msg-hover-actions {
    opacity: 1;
}

.btn-msg-action {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ffffff;
    color: var(--brand-purple);
    border: 1px solid var(--border-card);
    box-shadow: var(--shadow-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-msg-action:hover {
    background: var(--brand-purple-light);
    transform: scale(1.1);
}

/* Reproductor de Audio */
.msg-audio-player {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 240px;
    padding: 6px 4px;
}

.audio-btn-play {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--brand-purple);
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    box-shadow: 0 3px 10px rgba(224, 83, 83, 0.3);
    transition: all 0.15s ease;
}

.audio-btn-play:hover {
    background: var(--brand-purple-hover);
    transform: scale(1.06);
}

.audio-waveform-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.audio-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--brand-purple-light);
    border-radius: var(--radius-full);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.audio-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--brand-purple);
    border-radius: var(--radius-full);
    transition: width 0.1s linear;
}

.audio-time-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: monospace;
}

/* Botón flotante para bajar */
.btn-scroll-bottom {
    position: absolute;
    bottom: 24px;
    right: 32px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid var(--border-card);
    color: var(--brand-purple);
    box-shadow: var(--shadow-float);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    transition: all 0.18s ease;
}

.btn-scroll-bottom:hover {
    background: var(--brand-purple);
    color: #ffffff;
    transform: translateY(-2px);
}

/* =========================================================
   BARRA DE ENTRADA FLOTANTE
   ========================================================= */
.chat-input-area {
    background: transparent;
    padding: 10px 24px 20px 24px;
    position: relative;
    flex-shrink: 0;
    z-index: 20;
}

.chat-input-form-floating {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
}

.btn-plus-expand {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--brand-purple-light);
    color: var(--brand-purple);
    border: none;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: var(--shadow-subtle);
    transition: all 0.18s ease;
}

.btn-plus-expand:hover {
    background: #fdd3d3;
    transform: scale(1.05);
}

.chat-pill-input-wrapper {
    flex: 1 1 0%;
    min-width: 0;
    background: #ffffff;
    border: 1.5px solid var(--border-card);
    border-radius: var(--radius-full);
    padding: 6px 16px 6px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-float);
    transition: all 0.2s ease;
}

.chat-pill-input-wrapper:focus-within {
    border-color: var(--brand-purple);
    box-shadow: 0 8px 30px rgba(224, 83, 83, 0.18);
}

.chat-textarea {
    flex: 1 1 0%;
    min-width: 0;
    width: 0;
    background: transparent;
    border: none;
    outline: none;
    font-family: var(--font-main);
    font-size: 0.95rem;
    color: var(--text-primary);
    resize: none;
    max-height: 100px;
    min-height: 24px;
    line-height: 1.4;
    padding: 6px 0;
}

.chat-textarea::placeholder {
    color: var(--text-muted);
}

.pill-internal-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-inline-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.btn-inline-icon:hover {
    color: var(--brand-purple);
    background: var(--brand-purple-light);
}

.btn-circle-purple {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--brand-purple);
    color: #ffffff;
    border: none;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(224, 83, 83, 0.35);
    transition: all 0.18s ease;
}

.btn-circle-purple:hover {
    background: var(--brand-purple-hover);
    transform: scale(1.06);
    box-shadow: 0 6px 20px rgba(224, 83, 83, 0.45);
}

/* Barra de Grabación de Voz */
.voice-recorder-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: #ffffff;
    border: 1.5px solid rgba(224, 83, 83, 0.3);
    border-radius: var(--radius-full);
    padding: 8px 20px;
    box-shadow: var(--shadow-float);
    max-width: 960px;
    margin: 0 auto;
    animation: message-appear 0.2s ease;
}

.rec-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rec-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--brand-purple);
    animation: blink-rec 1s infinite alternate;
}

@keyframes blink-rec {
    from {
        opacity: 1;
        transform: scale(1.1);
    }

    to {
        opacity: 0.3;
        transform: scale(0.9);
    }
}

.rec-text {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--brand-purple);
}

.rec-timer {
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.rec-waveform {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 20px;
}

.wave-bar {
    width: 3px;
    height: 100%;
    background: var(--brand-purple);
    border-radius: 2px;
    animation: wave-anim 1s infinite ease-in-out alternate;
}

.wave-bar:nth-child(2) {
    animation-delay: 0.2s;
    height: 60%;
}

.wave-bar:nth-child(3) {
    animation-delay: 0.4s;
    height: 80%;
}

.wave-bar:nth-child(4) {
    animation-delay: 0.1s;
    height: 50%;
}

.wave-bar:nth-child(5) {
    animation-delay: 0.3s;
    height: 90%;
}

@keyframes wave-anim {
    0% {
        transform: scaleY(0.3);
    }

    100% {
        transform: scaleY(1);
    }
}

.rec-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-cancel-rec {
    color: var(--brand-purple);
    background: var(--brand-purple-light);
}

.btn-cancel-rec:hover {
    background: var(--brand-purple);
    color: #ffffff;
}

.btn-send-rec {
    background: var(--success);
}

.btn-send-rec:hover {
    background: #059669;
}

/* Preview de Adjunto */
.attachment-preview-bar {
    padding: 8px 24px;
    background: #ffffff;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-subtle);
}

.preview-item {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-card);
}

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

.btn-remove-attachment {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: #ffffff;
    font-size: 0.65rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attachment-filename {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* =========================================================
   PÁGINAS DE AUTENTICACIÓN Y PERFIL (PALETA ROJO CLARO)
   ========================================================= */
.auth-body,
.profile-body {
    background: radial-gradient(circle at top center, #fee8e8 0%, #fff8f8 60%);
    overflow-y: auto;
}

.auth-wrapper,
.profile-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.auth-card,
.profile-card {
    width: 100%;
    max-width: 440px;
    background: #ffffff;
    border: 1px solid var(--border-card);
    border-radius: 24px;
    padding: 38px 34px;
    box-shadow: 0 10px 35px rgba(224, 83, 83, 0.1);
}

.profile-card {
    max-width: 520px;
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--brand-purple);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(224, 83, 83, 0.35);
    margin-bottom: 16px;
}

.auth-title,
.profile-title {
    font-family: var(--font-heading);
    font-size: 1.65rem;
    font-weight: 700;
    color: #2b1f1f;
    margin-bottom: 6px;
}

.auth-subtitle,
.profile-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.alert-box {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.88rem;
    line-height: 1.4;
}

.alert-danger {
    background: var(--danger-light);
    border: 1px solid #fca5a5;
    color: #b91c1c;
}

.alert-success {
    background: #dcfce7;
    border: 1px solid #86efac;
    color: #15803d;
}

.auth-form,
.profile-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 0.86rem;
    font-weight: 600;
    color: #374151;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 0.95rem;
    pointer-events: none;
}

.form-input {
    width: 100%;
    height: 46px;
    background: #fffafa;
    border: 1.5px solid #f3dada;
    border-radius: var(--radius-sm);
    padding: 0 40px 0 42px;
    font-family: var(--font-main);
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: all 0.18s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--brand-purple);
    box-shadow: 0 0 0 3px rgba(224, 83, 83, 0.15);
    background: #ffffff;
}

.form-input:focus+.input-icon,
.input-wrapper:focus-within .input-icon {
    color: var(--brand-purple);
}

.btn-toggle-pwd {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
}

.btn-toggle-pwd:hover {
    color: var(--brand-purple);
}

.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Botones Principales */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 46px;
    padding: 0 20px;
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.18s ease;
}

.btn-primary {
    background: var(--brand-purple);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(224, 83, 83, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: var(--brand-purple-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(224, 83, 83, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: #fffafa;
    color: #4b5563;
    border: 1px solid #f3dada;
}

.btn-secondary:hover {
    background: #fee8e8;
    color: var(--brand-purple);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    height: 36px;
    font-size: 0.85rem;
    padding: 0 14px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.auth-link {
    color: var(--brand-purple);
    text-decoration: none;
    font-weight: 600;
}

.auth-link:hover {
    color: var(--brand-purple-hover);
    text-decoration: underline;
}

/* Avatar Upload Preview en Registro / Perfil */
.avatar-upload-section,
.profile-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.avatar-preview-wrapper,
.profile-avatar-box {
    position: relative;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    cursor: pointer;
    overflow: hidden;
    border: 2.5px dashed var(--brand-purple);
    box-shadow: 0 3px 10px rgba(224, 83, 83, 0.15);
    transition: transform 0.15s ease;
}

.profile-avatar-box {
    width: 110px;
    height: 110px;
    border: 3px solid var(--brand-purple);
}

.avatar-preview-wrapper:hover,
.profile-avatar-box:hover {
    transform: scale(1.04);
}

.avatar-preview-wrapper img,
.profile-avatar-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-overlay,
.profile-avatar-overlay {
    position: absolute;
    inset: 0;
    background: rgba(224, 83, 83, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.avatar-preview-wrapper:hover .avatar-overlay,
.profile-avatar-box:hover .profile-avatar-overlay {
    opacity: 1;
}

.avatar-hint,
.avatar-help-text {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    color: var(--brand-purple);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 18px;
}

.btn-back:hover {
    transform: translateX(-3px);
}

/* Lightbox Modal */
.image-lightbox-modal {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: message-appear 0.2s ease;
}

.lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(30, 20, 20, 0.82);
    backdrop-filter: blur(8px);
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1000;
}

.lightbox-close {
    position: absolute;
    top: -44px;
    right: 0;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 6px;
}

.lightbox-close:hover {
    color: #f87171;
}

#lightbox-img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.lightbox-download {
    margin-top: 12px;
    color: #ffffff;
    text-decoration: none;
    font-size: 0.85rem;
    padding: 8px 18px;
    background: var(--brand-purple);
    border-radius: var(--radius-full);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(224, 83, 83, 0.35);
}

.lightbox-download:hover {
    background: var(--brand-purple-hover);
}

/* =========================================================
   RESPONSIVE / MEDIA QUERIES
   ========================================================= */
@media (max-width: 860px) {
    .chat-sidebar {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 40;
        transform: translateX(-100%);
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    }

    .chat-sidebar.active {
        transform: translateX(0);
    }

    .mobile-menu-toggle {
        display: inline-flex;
    }

    /* Cabecera Móvil Compacta */
    .chat-room-header {
        height: 52px;
        padding: 0 8px;
    }

    .room-info {
        gap: 6px;
        min-width: 0;
        flex: 1;
    }

    .room-icon-purple {
        width: 32px;
        height: 32px;
        font-size: 0.88rem;
        flex-shrink: 0;
    }

    .room-name {
        font-size: 0.92rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }

    .room-status {
        font-size: 0.66rem;
    }

    .room-actions-right {
        gap: 4px;
        flex-shrink: 0;
        display: flex;
        align-items: center;
    }

    #btn-search-chat {
        display: none !important; /* Ocultar búsqueda en móvil */
    }

    #btn-refresh-chat {
        display: none !important; /* Ocultar refresco manual en móvil (se actualiza solo) */
    }

    .btn-circle-action {
        width: 32px;
        height: 32px;
        font-size: 0.82rem;
        flex-shrink: 0;
    }

    .header-profile-badge {
        padding: 0;
        margin-left: 2px;
        border: none;
        background: transparent;
        flex-shrink: 0;
    }

    .badge-avatar-wrap {
        width: 32px;
        height: 32px;
    }

    .header-avatar {
        width: 32px;
        height: 32px;
    }

    .header-profile-badge .badge-texts {
        display: none !important;
    }

    /* Contenedor de Mensajes en Móvil */
    .chat-messages-container {
        padding: 8px 6px 4px 6px;
    }

    .chat-message-row {
        max-width: 88%;
        gap: 8px;
        margin-bottom: 10px;
    }

    .chat-message-row.msg-own {
        align-self: flex-end;
        margin-left: auto;
    }

    .chat-message-row.msg-other {
        align-self: flex-start;
        margin-right: auto;
    }

    .msg-avatar-wrapper {
        flex-shrink: 0;
    }

    .msg-sender-avatar {
        width: 32px;
        height: 32px;
    }

    .msg-bubble-card {
        padding: 8px 12px;
        border-radius: 14px;
        max-width: calc(100% - 40px);
        min-width: 110px;
    }

    .msg-card-header {
        gap: 6px;
        margin-bottom: 4px;
    }

    .msg-card-author {
        font-size: 0.82rem;
    }

    .you-pill-badge {
        font-size: 0.62rem;
        padding: 1px 6px;
    }

    .msg-card-time {
        font-size: 0.68rem;
    }

    .msg-text {
        font-size: 0.9rem;
    }

    .msg-card-footer {
        margin-top: 4px;
    }

    .msg-full-date {
        font-size: 0.68rem;
    }

    .msg-hover-actions {
        display: none !important; /* En pantallas táctiles ocultar */
    }

    .msg-photo-wrapper {
        max-width: 220px;
    }

    .doodle-text {
        display: none;
    }

    .doodle-airplane {
        opacity: 0.3;
        width: 50px;
        height: 50px;
    }

    /* Botón flotante para bajar en móvil */
    .btn-scroll-bottom {
        bottom: 64px;
        right: 12px;
        width: 36px;
        height: 36px;
        font-size: 0.8rem;
    }

    /* BARRA DE ENTRADA EN MÓVIL (100% GARANTIZADA QUE NADA SE CORTE) */
    .chat-input-area {
        padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 6px)) 6px;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
        overflow: visible;
    }

    .chat-input-form-floating {
        gap: 6px;
        width: 100%;
        max-width: 100%;
        display: flex;
        align-items: center;
        box-sizing: border-box;
    }

    .btn-plus-expand {
        width: 38px;
        height: 38px;
        min-width: 38px;
        max-width: 38px;
        font-size: 1.05rem;
        flex-shrink: 0;
    }

    .chat-pill-input-wrapper {
        flex: 1 1 0%;
        min-width: 0;
        padding: 4px 6px 4px 12px;
        gap: 4px;
        box-sizing: border-box;
        overflow: hidden;
    }

    .chat-textarea {
        flex: 1 1 0%;
        min-width: 0;
        width: 0;
        font-size: 0.92rem;
        padding: 4px 0;
        line-height: 1.3;
    }

    .chat-textarea::placeholder {
        font-size: 0.82rem;
    }

    .pill-internal-actions {
        gap: 2px;
        flex-shrink: 0;
        display: flex;
        align-items: center;
    }

    #btn-emoji-picker {
        display: none !important; /* Teclado nativo del móvil ya incluye emojis */
    }

    .btn-inline-icon {
        font-size: 1.05rem;
        padding: 4px;
        width: 28px;
        height: 28px;
        flex-shrink: 0;
    }

    .btn-circle-purple {
        width: 38px;
        height: 38px;
        min-width: 38px;
        max-width: 38px;
        font-size: 1rem;
        flex-shrink: 0;
    }

    .voice-recorder-bar {
        padding: 6px 10px;
        gap: 6px;
    }

    .rec-text {
        font-size: 0.74rem;
    }

    .rec-timer {
        font-size: 0.9rem;
    }
}

/* =========================================================
   PERFIL V2 — DISEÑO SPLIT PANEL PREMIUM
   ========================================================= */

.profile-body-v2 {
    background: #fff8f8;
    overflow-y: auto;
    min-height: 100vh;
}

.profile-body-v2 .app-container {
    height: auto;
    min-height: 100vh;
    overflow: visible;
}

/* Raíz: grid de dos columnas */
.pv2-root {
    display: grid;
    grid-template-columns: 320px 1fr;
    min-height: 100vh;
}

/* ── Panel lateral decorativo ───────────────────────────── */
.pv2-deco {
    background: linear-gradient(160deg, #e05353 0%, #c43c3c 55%, #a82b2b 100%);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    padding: 40px 36px 50px 36px;
    position: relative;
    overflow: hidden;
}

.pv2-deco-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 2;
}

.pv2-deco-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #ffffff;
    flex-shrink: 0;
}

.pv2-deco-brand span {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.02em;
}

/* Formas geométricas flotantes */
.pv2-deco-shapes {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.pv2-shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pv2-shape-1 {
    width: 280px;
    height: 280px;
    bottom: -70px;
    left: -80px;
    animation: float-shape 8s ease-in-out infinite alternate;
}

.pv2-shape-2 {
    width: 160px;
    height: 160px;
    top: 80px;
    right: -40px;
    animation: float-shape 6s ease-in-out infinite alternate-reverse;
}

.pv2-shape-3 {
    width: 90px;
    height: 90px;
    top: 50%;
    left: 30%;
    animation: float-shape 10s ease-in-out infinite alternate;
}

@keyframes float-shape {
    from { transform: translateY(0) rotate(0deg); }
    to   { transform: translateY(-18px) rotate(8deg); }
}

.pv2-deco-tagline {
    font-family: var(--font-heading);
    font-size: 1.55rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.92);
    line-height: 1.3;
    z-index: 2;
}

/* ── Panel principal ────────────────────────────────────── */
.pv2-main {
    display: flex;
    flex-direction: column;
    padding: 32px 48px 48px 48px;
    background: #fff8f8;
    overflow-y: auto;
}

/* Barra superior de navegación */
.pv2-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 36px;
}

.pv2-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--brand-purple);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    background: var(--brand-purple-light);
    border: 1px solid rgba(224, 83, 83, 0.2);
    transition: all 0.2s ease;
}

.pv2-back-btn:hover {
    background: var(--brand-purple);
    color: #ffffff;
    transform: translateX(-2px);
    box-shadow: 0 4px 14px rgba(224, 83, 83, 0.3);
}

.pv2-online-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
    color: #15803d;
}

.pv2-online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
    animation: pulse-dot 2s ease infinite;
}

@keyframes pulse-dot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%       { transform: scale(1.3); opacity: 0.7; }
}

/* Tarjeta del formulario */
.pv2-card {
    background: #ffffff;
    border: 1px solid var(--border-card);
    border-radius: 24px;
    padding: 40px 44px;
    box-shadow: 0 8px 40px rgba(224, 83, 83, 0.08);
    max-width: 520px;
}

.pv2-card-header {
    margin-bottom: 32px;
}

.pv2-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
    color: #2b1f1f;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.pv2-subtitle {
    color: var(--text-secondary);
    font-size: 0.92rem;
}

/* Alerta de estado */
.pv2-alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.4;
    animation: message-appear 0.2s ease;
}

.pv2-alert.is-success {
    background: #dcfce7;
    border: 1px solid #86efac;
    color: #15803d;
}

.pv2-alert.is-error {
    background: var(--danger-light);
    border: 1px solid #fca5a5;
    color: #b91c1c;
}

/* Sección del avatar */
.pv2-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 32px;
}

.pv2-avatar-wrap {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    cursor: pointer;
    overflow: hidden;
    border: 3px solid var(--brand-purple);
    box-shadow: 0 6px 24px rgba(224, 83, 83, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pv2-avatar-wrap:hover {
    transform: scale(1.04);
    box-shadow: 0 10px 32px rgba(224, 83, 83, 0.35);
}

.pv2-avatar-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pv2-avatar-overlay {
    position: absolute;
    inset: 0;
    background: rgba(224, 83, 83, 0.72);
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.pv2-avatar-overlay i {
    font-size: 1.4rem;
}

.pv2-avatar-wrap:hover .pv2-avatar-overlay {
    opacity: 1;
}

.pv2-avatar-hint {
    font-size: 0.76rem;
    color: var(--text-muted);
}

/* Campos del formulario */
.pv2-fields {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 28px;
}

.pv2-field-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.pv2-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 7px;
}

.pv2-label i {
    color: var(--brand-purple);
    width: 14px;
    text-align: center;
}

.pv2-input {
    width: 100%;
    height: 48px;
    background: #fffafa;
    border: 1.5px solid #f3dada;
    border-radius: var(--radius-sm);
    padding: 0 16px;
    font-family: var(--font-main);
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: all 0.18s ease;
    outline: none;
}

.pv2-input:focus {
    border-color: var(--brand-purple);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(224, 83, 83, 0.12);
}

.pv2-input:disabled {
    background: #fdf5f5;
    color: var(--text-muted);
    cursor: not-allowed;
    border-style: dashed;
}

.pv2-input-locked {
    position: relative;
    display: flex;
    align-items: center;
}

.pv2-lock-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 0.82rem;
    pointer-events: none;
}

.pv2-input-locked .pv2-input {
    padding-left: 38px;
}

.pv2-hint {
    font-size: 0.76rem;
    color: var(--text-muted);
}

/* Fila de metadatos */
.pv2-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.84rem;
    color: var(--text-secondary);
    background: #fff4f4;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
}

.pv2-meta-row i {
    color: var(--brand-purple);
}

/* Botón guardar */
.pv2-btn-save {
    width: 100%;
    height: 50px;
    background: var(--brand-gradient);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-size: 0.97rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 18px rgba(224, 83, 83, 0.35);
    transition: all 0.2s ease;
    letter-spacing: 0.01em;
}

.pv2-btn-save:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(224, 83, 83, 0.45);
    background: linear-gradient(135deg, #e05353 0%, #c43c3c 100%);
}

.pv2-btn-save:active {
    transform: translateY(0);
}

.pv2-btn-save:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 860px) {
    .pv2-root {
        grid-template-columns: 1fr;
    }

    .pv2-deco {
        padding: 28px 24px 36px 24px;
        min-height: 200px;
    }

    .pv2-deco-tagline {
        font-size: 1.2rem;
    }

    .pv2-main {
        padding: 24px 20px 40px 20px;
    }

    .pv2-card {
        padding: 28px 24px;
        border-radius: 18px;
    }

    .pv2-title {
        font-size: 1.5rem;
    }
}

/* =========================================================
   PANEL ADMIN — ESTILOS PREMIUM
   ========================================================= */

.admin-body {
    background: #0f0f14;
    min-height: 100vh;
    overflow-y: auto;
}

.admin-body .app-container {
    height: auto;
    min-height: 100vh;
    overflow: visible;
    background: transparent;
}

/* ── Pantalla de Login Admin ────────────────────────────── */
.adm-root {
    min-height: 100vh;
}

.adm-login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at top left, #1a0a0a 0%, #0f0f14 60%);
    padding: 24px 16px;
}

.adm-login-card {
    width: 100%;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(224, 83, 83, 0.2);
    border-radius: 24px;
    padding: 44px 38px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(224, 83, 83, 0.08);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    text-align: center;
}

.adm-login-icon {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: linear-gradient(135deg, #e05353, #a82b2b);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #ffffff;
    box-shadow: 0 8px 28px rgba(224, 83, 83, 0.4);
    margin-bottom: 22px;
}

.adm-login-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.adm-login-subtitle {
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 28px;
}

.adm-login-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.adm-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    text-align: left;
}

.adm-label {
    font-size: 0.83rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    gap: 6px;
}

.adm-label i {
    color: var(--brand-purple);
}

.adm-input {
    width: 100%;
    height: 46px;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid rgba(224, 83, 83, 0.2);
    border-radius: var(--radius-sm);
    padding: 0 16px;
    font-family: var(--font-main);
    font-size: 0.95rem;
    color: #ffffff;
    outline: none;
    transition: all 0.18s ease;
}

.adm-input:focus {
    border-color: var(--brand-purple);
    background: rgba(224, 83, 83, 0.08);
    box-shadow: 0 0 0 3px rgba(224, 83, 83, 0.15);
}

.adm-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.adm-btn-primary {
    height: 48px;
    background: linear-gradient(135deg, #e05353, #c43c3c);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 18px rgba(224, 83, 83, 0.4);
    transition: all 0.2s ease;
    margin-top: 4px;
}

.adm-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(224, 83, 83, 0.5);
}

.adm-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.adm-alert {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.86rem;
    font-weight: 500;
    margin-bottom: 8px;
    text-align: left;
    animation: message-appear 0.2s ease;
}

.adm-alert-error {
    background: rgba(220, 38, 38, 0.15);
    border: 1px solid rgba(220, 38, 38, 0.35);
    color: #fca5a5;
}

.adm-alert-success {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.adm-back-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 22px;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.84rem;
    text-decoration: none;
    transition: color 0.15s ease;
}

.adm-back-link:hover {
    color: rgba(255, 255, 255, 0.7);
}

/* ── Panel principal (post-login) ───────────────────────── */
.adm-panel {
    min-height: 100vh;
    display: flex;
    flex-direction: row;
    background: #0f0f14;
}

/* Sidebar oscuro */
.adm-sidebar {
    width: 240px;
    background: rgba(255, 255, 255, 0.03);
    border-right: 1px solid rgba(224, 83, 83, 0.12);
    display: flex;
    flex-direction: column;
    padding: 28px 18px;
    flex-shrink: 0;
    gap: 8px;
}

.adm-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 12px;
}

.adm-brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #e05353, #a82b2b);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #ffffff;
    flex-shrink: 0;
}

.adm-brand-name {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.adm-brand-sub {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.35);
}

.adm-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.adm-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.adm-nav-item i {
    width: 16px;
    text-align: center;
    color: rgba(224, 83, 83, 0.5);
}

.adm-nav-item:hover,
.adm-nav-item.active {
    background: rgba(224, 83, 83, 0.1);
    color: #ffffff;
}

.adm-nav-item.active i {
    color: var(--brand-purple);
}

.adm-logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid rgba(220, 38, 38, 0.2);
    color: rgba(220, 38, 38, 0.7);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    width: 100%;
    text-align: left;
    margin-top: auto;
}

.adm-logout-btn:hover {
    background: rgba(220, 38, 38, 0.1);
    color: #f87171;
    border-color: rgba(220, 38, 38, 0.4);
}

/* Contenido principal */
.adm-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 36px 48px;
    background: #0f0f14;
}

.adm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 36px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.adm-page-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.adm-page-title i {
    color: var(--brand-purple);
}

.adm-badge-online {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 13px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    color: #6ee7b7;
}

.adm-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
    animation: pulse-dot 2s ease infinite;
}

/* Sección */
.adm-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.adm-info-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(224, 83, 83, 0.07);
    border: 1px solid rgba(224, 83, 83, 0.18);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.9rem;
    line-height: 1.5;
}

.adm-info-card i {
    color: var(--brand-purple);
    font-size: 1.1rem;
    margin-top: 2px;
    flex-shrink: 0;
}

/* Resultado de token generado */
.adm-token-result {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(224, 83, 83, 0.3);
    border-radius: var(--radius-md);
    padding: 24px 28px;
}

@keyframes token-pop {
    0%   { opacity: 0; transform: scale(0.94) translateY(8px); }
    60%  { transform: scale(1.02) translateY(-2px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.adm-token-anim {
    animation: token-pop 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.adm-token-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.adm-token-display {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.adm-token-value {
    font-family: 'Courier New', monospace;
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.2em;
    background: rgba(224, 83, 83, 0.1);
    border: 1px solid rgba(224, 83, 83, 0.25);
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    flex: 1;
    text-align: center;
}

.adm-copy-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: rgba(224, 83, 83, 0.15);
    border: 1px solid rgba(224, 83, 83, 0.3);
    color: var(--brand-purple);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.adm-copy-btn:hover {
    background: var(--brand-purple);
    color: #ffffff;
}

.adm-token-note {
    font-size: 0.82rem;
    color: rgba(255, 200, 50, 0.7);
    display: flex;
    align-items: center;
    gap: 7px;
}

.adm-token-note i {
    color: rgba(255, 200, 50, 0.8);
}

/* Botón generar */
.adm-btn-generate {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #e05353, #c43c3c);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-size: 0.97rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(224, 83, 83, 0.35);
    transition: all 0.2s ease;
}

.adm-btn-generate:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(224, 83, 83, 0.45);
}

.adm-btn-generate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Historial de tokens */
.adm-tokens-history {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-md);
    padding: 20px 24px;
}

.adm-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.adm-history-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
}

.adm-btn-refresh {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    transition: all 0.15s ease;
}

.adm-btn-refresh:hover {
    border-color: var(--brand-purple);
    color: var(--brand-purple);
}

.adm-history-empty {
    font-size: 0.86rem;
    color: rgba(255, 255, 255, 0.25);
    text-align: center;
    padding: 20px 0;
}

/* Tabla de tokens */
.adm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.adm-table thead th {
    text-align: left;
    padding: 8px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.adm-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.12s ease;
}

.adm-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.adm-table tbody td {
    padding: 10px 12px;
    color: rgba(255, 255, 255, 0.65);
}

.adm-token-code {
    font-family: 'Courier New', monospace;
    font-size: 0.92rem;
    color: #ffffff;
    letter-spacing: 0.1em;
    background: rgba(224, 83, 83, 0.08);
    border-radius: 6px;
    padding: 3px 10px;
}

.adm-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.74rem;
    font-weight: 700;
}

.adm-badge-free {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #6ee7b7;
}

.adm-badge-used {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.3);
}

/* ── Barra de acceso admin (dentro de auth-card) ─────────── */
.admin-access-bar {
    display: flex;
    justify-content: center;
    padding: 16px 0 0 0;
    margin-top: 8px;
    border-top: 1px solid var(--border-light);
}

.admin-access-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    border-radius: var(--radius-full);
    background: rgba(30, 20, 20, 0.07);
    border: 1px solid rgba(224, 83, 83, 0.15);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.18s ease;
}

.admin-access-link:hover {
    background: rgba(224, 83, 83, 0.08);
    color: var(--brand-purple);
    border-color: rgba(224, 83, 83, 0.3);
    transform: translateY(-1px);
}

.admin-access-link i {
    font-size: 0.9rem;
}