/* ============================================
   USER PROFILE IMAGE & AVATAR STYLES
   Global styles for the UserProfileImage component
   and all avatar/initials displays
   ============================================ */

/* --------------------------------------------
   1. BASE AVATAR SIZES
   -------------------------------------------- */

/* Extra Small (24px) - inline, compact lists */
.avatar-xs,
.profile-avatar-xs {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.avatar-xs.initials,
.profile-avatar-xs.initials {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cl-primary, #70AFFB);
    color: white;
    font-size: 0.6rem;
    font-weight: 600;
}

/* Small (32px) - sidebar, compact cards */
.avatar-sm,
.profile-avatar-sm,
.account-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.avatar-sm.initials,
.profile-avatar-sm.initials,
.account-avatar.initials {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cl-primary, #70AFFB);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Medium (48px) - cards, lists, default */
.avatar-md,
.profile-avatar-md,
.profile-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.avatar-md.initials,
.profile-avatar-md.initials,
.profile-avatar.initials {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cl-primary, #70AFFB);
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Large (64px) - profile cards, headers */
.avatar-lg,
.profile-avatar-lg {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.avatar-lg.initials,
.profile-avatar-lg.initials {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cl-primary, #70AFFB);
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
}

/* Extra Large (100px) - dashboard hero, profile pages */
.avatar-xl,
.profile-avatar-xl,
.profile-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.avatar-xl.initials,
.profile-avatar-xl.initials,
.profile-avatar-large.initials-large {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cl-primary, #70AFFB);
    color: white;
    font-size: 2.5rem;
    font-weight: 700;
}

/* --------------------------------------------
   2. AVATAR WITH BORDER (for gradient backgrounds)
   -------------------------------------------- */
.avatar-bordered,
.profile-avatar-large {
    border: 4px solid rgba(255, 255, 255, 0.3);
}

.avatar-bordered-white {
    border: 3px solid white;
}

.avatar-bordered-primary {
    border: 3px solid var(--cl-primary, #70AFFB);
}

/* --------------------------------------------
   3. AVATAR COLOR VARIANTS (for initials)
   -------------------------------------------- */

/* Primary (default) */
.avatar-primary,
.initials-primary {
    background: var(--cl-primary, #70AFFB) !important;
    color: white !important;
}

/* Secondary/Purple */
.avatar-secondary,
.initials-secondary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
}

/* Success/Green */
.avatar-success,
.initials-success {
    background: #22C55E !important;
    color: white !important;
}

/* Warning/Orange */
.avatar-warning,
.initials-warning {
    background: #F97316 !important;
    color: white !important;
}

/* Muted/Gray */
.avatar-muted,
.initials-muted {
    background: #E5E7EB !important;
    color: #1E293B !important;
}

/* Transparent (for dark backgrounds) */
.avatar-transparent,
.initials-transparent {
    background: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
}

/* --------------------------------------------
   4. AVATAR STATES
   -------------------------------------------- */

/* Online indicator */
.avatar-wrapper {
    position: relative;
    display: inline-block;
}

.avatar-status {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
}

.avatar-status.online {
    background: #22C55E;
}

.avatar-status.offline {
    background: #9CA3AF;
}

.avatar-status.busy {
    background: #EF4444;
}

/* Hover effect */
.avatar-hover:hover {
    transform: scale(1.05);
    transition: transform 0.2s ease;
    cursor: pointer;
}

/* --------------------------------------------
   5. AVATAR GROUPS (stacked avatars)
   -------------------------------------------- */
.avatar-group {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
}

.avatar-group > * {
    margin-left: -12px;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.avatar-group > *:last-child {
    margin-left: 0;
}

.avatar-group-count {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #E5E7EB;
    color: #1E293B;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: -12px;
    border: 2px solid white;
}

/* --------------------------------------------
   6. COACH/FIGHTER SPECIFIC AVATARS
   -------------------------------------------- */

/* Coach avatar (sidebar/header) */
.coach-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.coach-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.coach-avatar .avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cl-primary, #70AFFB);
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
}

/* Fighter mini avatar (lists) */
.fighter-av,
.fighter-av-mini {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.fighter-av-mini {
    width: 36px;
    height: 36px;
}

.fighter-av img,
.fighter-av-mini img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fighter-av .av-fallback,
.fighter-av-mini .av-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.fighter-av-mini .av-fallback {
    font-size: 0.75rem;
}

/* --------------------------------------------
   7. MOBILE NAV AVATAR
   -------------------------------------------- */
.mobile-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--cl-primary, #70AFFB);
    object-fit: cover;
}

/* --------------------------------------------
   8. PROFILE PREVIEW (upload/edit forms)
   -------------------------------------------- */
.profile-preview {
    width: 120px;
    height: 120px;
    object-fit: cover;
    object-position: center;
    border-radius: 50%;
    border: 2px solid #E0E6EB;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    display: block;
}

.profile-preview.placeholder {
    background: #f8f9fb;
}

/* Photo thumbnail in edit forms */
.photo-thumb {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #E0E6EB;
}

/* --------------------------------------------
   9. CONVERSATION AVATARS (chat)
   -------------------------------------------- */
.conversation-avatar {
    width: 48px;
    height: 48px;
    position: relative;
    flex-shrink: 0;
}

/* Single person avatar */
.avatar-single {
    width: 100%;
    height: 100%;
}

.avatar-single img,
.avatar-single .avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Split avatar (2 people) */
.avatar-split {
    width: 100%;
    height: 100%;
    display: flex;
    overflow: hidden;
    border-radius: 50%;
    position: relative;
}

.avatar-split .half {
    width: 50%;
    height: 100%;
    overflow: hidden;
}

.avatar-split .half img,
.avatar-split .half .avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
}

.avatar-split .left {
    border-right: 1px solid rgba(255, 255, 255, 0.6);
}

.avatar-split .right {
    border-left: 1px solid rgba(255, 255, 255, 0.6);
}

/* Grid avatar (3-4 people) */
.avatar-grid {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 0;
    border-radius: 50%;
    overflow: hidden;
    background: #E5E7EB;
}

.avatar-grid-item {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #fff;
}

.avatar-grid-item img,
.avatar-grid-item .avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
}

/* Chat bubble avatar */
.chat-avatar {
    margin-right: 0.6rem;
}

.chat-avatar.me {
    order: 2;
    margin-left: 0.6rem;
    margin-right: 0;
}

.avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--cl-primary, #70AFFB);
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    font-size: 0.8rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* --------------------------------------------
   10. RESPONSIVE ADJUSTMENTS
   -------------------------------------------- */
@media (max-width: 768px) {
    .avatar-xl,
    .profile-avatar-xl,
    .profile-avatar-large {
        width: 80px;
        height: 80px;
    }

    .avatar-xl.initials,
    .profile-avatar-xl.initials,
    .profile-avatar-large.initials-large {
        font-size: 2rem;
    }

    .avatar-lg,
    .profile-avatar-lg {
        width: 56px;
        height: 56px;
    }

    .avatar-lg.initials,
    .profile-avatar-lg.initials {
        font-size: 1.25rem;
    }

    .profile-preview {
        width: 100px;
        height: 100px;
    }
}
