/* === SIDEBAR PROFILES COMPONENT === */
/* Barra lateral de perfiles públicos - Sistema completo */

/* Importar variables compartidas */
@import url('../../shared/styles/variables.css');

/* ===== VARIABLES ESPECÍFICAS DEL COMPONENTE ===== */
:root {
    --sidebar-width: 56px; /* Aumentado para mejor hit target */
    --chip-padding: 6px;
    --chip-radius: 8px;
    --avatar-s: 28px;
    --avatar-m: 36px;
    --dot-s: 10px;
    --dot-m: 12px;
    
    /* Estados de presencia */
    --status-live: #ff4444;
    --status-online: #44ff44;
    --status-offline: #666666;
    --status-away: #ffaa44;
    
    /* Contextos */
    --context-scheduled: #44aaff;
    --context-recommended: #aa44ff;
}

/* ===== CONTENEDOR PRINCIPAL ===== */
.sidebar-profiles {
    position: fixed;
    left: 0;
    top: var(--header-height);
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: linear-gradient(180deg, 
        rgba(86, 9, 54, 0.9) 0%, 
        rgba(107, 17, 66, 0.8) 50%, 
        rgba(86, 9, 54, 0.9) 100%);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(169, 60, 122, 0.3);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 5px;
    gap: 15px;
    overflow-y: auto;
    overflow-x: hidden;
    
    /* Scrollbar personalizada */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* Scrollbar para Webkit (Chrome, Safari, Edge) */
.sidebar-profiles::-webkit-scrollbar {
    width: 6px;
}

.sidebar-profiles::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-profiles::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    transition: background 0.3s ease;
}

.sidebar-profiles::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* ===== HEADER DE PERFILES ===== */
.profiles-header {
    width: 100%;
    text-align: center;
    margin-bottom: 10px;
}

.profiles-title {
    color: var(--accent-text);
    font-size: 0.7em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ===== COMPONENTE BASE UNIFICADO ===== */
.profile-chip {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--chip-padding) 2px;
    border-radius: var(--chip-radius);
    cursor: pointer;
    transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
    position: relative;
    min-height: 44px; /* WCAG hit target */
}

/* Estados hover y focus unificados */
.profile-chip:hover,
.profile-chip:focus-visible {
    background-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.08) inset;
    outline: none;
    transform: translateY(-1px);
}

.profile-chip.is-active {
    box-shadow: 0 0 0 2px var(--accent-color) inset;
}

/* Variantes de tamaño */
.profile-chip--s {
    flex-direction: row;
}

.profile-chip--m {
    flex-direction: column;
    gap: 8px;
    padding: 8px 2px;
}

/* Compatibilidad temporal con clases existentes */
.featured-profile {
    /* Copiado de .profile-chip */
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--chip-padding) 2px;
    border-radius: var(--chip-radius);
    cursor: pointer;
    transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
    position: relative;
    min-height: 44px;
    
    /* Copiado de .profile-chip--m */
    flex-direction: column;
    gap: 8px;
    padding: 8px 2px;
}

/* ===== AVATARES UNIFICADOS ===== */
.avatar {
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.25);
    position: relative;
    transition: all 0.18s ease;
}

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

/* Fallback para imágenes no encontradas */
.avatar.no-img {
    background: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.8em;
}

.avatar.no-img::before {
    content: attr(data-initials);
}

/* Tamaños de avatares */
.profile-chip--s .avatar {
    width: var(--avatar-s);
    height: var(--avatar-s);
}

.profile-chip--m .avatar {
    width: var(--avatar-m);
    height: var(--avatar-m);
}

/* Compatibilidad temporal */
.profile-avatar {
    /* Copiado de .avatar */
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Propiedades específicas */
    width: var(--avatar-m);
    height: var(--avatar-m);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.mini-avatar {
    /* Copiado de .avatar */
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Propiedades específicas */
    width: var(--avatar-s);
    height: var(--avatar-s);
}

/* ===== ESTADOS DE PERFIL UNIFICADOS ===== */
.dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    border-radius: 50%;
    border: 2px solid white;
    z-index: 1;
}

/* Tamaños de dot según avatar */
.profile-chip--s .dot {
    width: var(--dot-s);
    height: var(--dot-s);
}

.profile-chip--m .dot {
    width: var(--dot-m);
    height: var(--dot-m);
}

/* Estados de presencia (solo estos usan dot) */
.dot.status--live {
    background: var(--status-live);
    box-shadow: 0 0 8px rgba(255, 68, 68, 0.6);
    animation: live-pulse 2s infinite;
}

.dot.status--online {
    background: var(--status-online);
}

.dot.status--offline {
    background: var(--status-offline);
}

.dot.status--away {
    background: var(--status-away);
}

/* Contextos usando anillo en avatar (no dot) */
.profile-chip.is-scheduled .avatar {
    box-shadow: 0 0 0 2px var(--context-scheduled) inset;
}

.profile-chip.is-recommended .avatar {
    box-shadow: 0 0 0 2px var(--context-recommended) inset;
}

/* Compatibilidad temporal */
.profile-status {
    /* Copiado de .dot */
    position: absolute;
    bottom: -1px;
    right: -1px;
    border-radius: 50%;
    border: 2px solid white;
    z-index: 1;
}

.profile-status.live {
    /* Copiado de .dot.status--live */
    background: var(--status-live);
    box-shadow: 0 0 8px rgba(255, 68, 68, 0.6);
    animation: live-pulse 2s infinite;
}

.profile-status.online {
    /* Copiado de .dot.status--online */
    background: var(--status-online);
}

.profile-status.offline {
    /* Copiado de .dot.status--offline */
    background: var(--status-offline);
}

.profile-status.away {
    /* Copiado de .dot.status--away */
    background: var(--status-away);
}

.profile-status.next {
    background: var(--context-scheduled);
}

.profile-status.new,
.profile-status.trending,
.profile-status.popular {
    display: none; /* Estos usarán anillos o badges */
}

@keyframes live-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

@keyframes trending-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ===== INFORMACIÓN DE PERFIL ===== */
.profile-info {
    text-align: center;
}

.profile-name {
    color: var(--text-color-light);
    font-size: 0.6em;
    font-weight: 600;
    display: block;
    line-height: 1.2;
}

.profile-role {
    color: var(--accent-text);
    font-size: 0.5em;
    font-weight: 400;
    opacity: 0.8;
    display: block;
    margin-top: 2px;
}

/* ===== COMPATIBILIDAD TEMPORAL MINI PERFILES ===== */
.mini-profile {
    /* Copiado de .profile-chip */
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: var(--chip-radius);
    cursor: pointer;
    transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
    position: relative;
    min-height: 44px;
    
    /* Copiado de .profile-chip--s */
    flex-direction: row;
    
    /* Override temporal */
    padding: 4px 2px;
}

/* Eliminar hovers específicos - usar hover unificado */
.mini-profile.next-dj:hover,
.mini-profile.following:hover,
.mini-profile.recommended:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.08) inset !important;
    transform: translateY(-1px) !important;
}

/* ===== SECCIONES DE PERFILES ===== */
.profiles-section {
    width: 100%;
    margin: 20px 0;
}

.profiles-section-header {
    text-align: center;
    margin-bottom: 12px;
}

.section-icon {
    color: var(--accent-text);
    font-size: 0.8em;
    opacity: 0.8;
}

.followed-profiles,
.recommended-profiles {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

/* ===== USUARIOS CONECTADOS ===== */
.connected-users {
    width: 100%;
    margin-top: auto; /* Empujar al final */
    padding: 12px 2px;
    text-align: center;
}

.users-count {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-color-light);
    font-size: 0.7em;
}

.users-count i {
    font-size: 1.2em;
    opacity: 0.8;
}

.users-count span {
    font-weight: 600;
    color: var(--accent-text);
}

/* ===== SOPORTE PARA PREFERS-REDUCED-MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    .dot.status--live {
        animation: none;
    }
    
    .profile-chip {
        transition: none;
    }
    
    .avatar {
        transition: none;
    }
}

/* ===== RESPONSIVE DESIGN ===== */
/* Mobile - preservar fix del header */
@media (max-width: 768px) {
    .sidebar-profiles {
        width: var(--sidebar-width); /* Usar variable */
        padding: 12px 4px;
        gap: 12px;
    }
    
    .profile-avatar {
        width: 32px;
        height: 32px;
    }
    
    .mini-avatar {
        width: 24px;
        height: 24px;
    }
    
    .profile-status {
        width: 10px;
        height: 10px;
    }
    
    .profile-name {
        font-size: 0.55em;
    }
    
    .profile-role {
        font-size: 0.45em;
    }
}

/* Pantallas muy pequeñas */
@media (max-width: 480px) {
    .sidebar-profiles {
        padding: 10px 3px;
        gap: 10px;
    }
    
    .profile-avatar {
        width: 30px;
        height: 30px;
    }
    
    .mini-avatar {
        width: 22px;
        height: 22px;
    }
    
    .profile-status {
        width: 8px;
        height: 8px;
    }
    
    .users-count {
        font-size: 0.6em;
    }
}

/* ===== EFECTOS INTERACTIVOS ===== */
/* Hover global en sidebar */
.sidebar-profiles:hover {
    border-right-color: rgba(169, 60, 122, 0.6);
}

/* Loading state para perfiles */
.mini-profile.loading {
    opacity: 0.5;
    pointer-events: none;
}

.mini-profile.loading .mini-avatar::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid var(--accent-color);
    border-top: 1px solid transparent;
    border-radius: 50%;
    animation: profile-loading 1s linear infinite;
}

@keyframes profile-loading {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== FEEDBACK VISUAL PARA AUDIO ===== */
/* Feedback cuando el audio está reproduciéndose */
body.audio-playing .sidebar-profiles {
    border-left: 2px solid var(--accent-color);
}

body.audio-playing .featured-profile .avatar {
    animation: audio-pulse 3s ease-in-out infinite;
}

@keyframes audio-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(var(--accent-color-rgb), 0.4); }
    50% { box-shadow: 0 0 0 4px rgba(var(--accent-color-rgb), 0.1); }
}

/* Indicator visual sutil en perfiles cuando hay audio */
body.audio-playing .profile-chip .avatar::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: var(--accent-color);
    border-radius: 50%;
    opacity: 0.7;
    animation: audio-beat 1s ease-in-out infinite;
}

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

/* RECORDATORIO: Este componente requiere:
   - Font Awesome icons: fa-heart, fa-star, fa-users
   - Images: dj-avatar-1.jpg hasta dj-avatar-16.jpg
   - Variables CSS: todas las del design system
   - JavaScript: profile-panel.js para interacciones
   - Event Bus: Para comunicación con otros componentes
*/
