/**
 * Avatar Builder CSS
 * Styling for avatar-systemet med bilder
 */

/* ==================== PREVIEW ==================== */
.avatar-preview-container {
    width: 150px;
    height: 150px;
    margin: 0 auto var(--space-lg, 20px);
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--accent, #4ade80);
    box-shadow: 0 0 20px var(--accent-glow, rgba(74, 222, 128, 0.3));
    background: var(--bg-tertiary, #2d3748);
}

.avatar-stack {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
}

.avatar-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* ==================== CATEGORY ==================== */
.avatar-category {
    margin-bottom: var(--space-md, 15px);
}

.avatar-category-label {
    display: block;
    color: var(--text-secondary, #9ca3af);
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: var(--space-sm, 10px);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==================== OPTIONS GRID ==================== */
.avatar-options {
    display: flex;
    gap: var(--space-sm, 10px);
    flex-wrap: wrap;
}

.avatar-option {
    width: 60px;
    height: 60px;
    padding: 4px;
    background: var(--bg-card, #1e2530);
    border: 2px solid var(--border-color, #2d3748);
    border-radius: var(--radius-md, 10px);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.avatar-option img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

.avatar-option:hover:not(.locked) {
    border-color: var(--accent, #4ade80);
    transform: scale(1.05);
}

.avatar-option.selected {
    border-color: var(--accent, #4ade80);
    background: rgba(74, 222, 128, 0.15);
    box-shadow: 0 0 10px var(--accent-glow, rgba(74, 222, 128, 0.3));
}

/* Locked state */
.avatar-option.locked {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(50%);
}

.avatar-option.locked:hover {
    opacity: 0.7;
}

.lock-icon {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 0.7em;
    background: var(--bg-primary, #0f1419);
    padding: 2px 4px;
    border-radius: 4px;
}

/* No selection (X) */
.no-selection {
    font-size: 1.5em;
    color: var(--text-muted, #6b7280);
}

.avatar-option.selected .no-selection {
    color: var(--accent, #4ade80);
}

/* ==================== COMPACT MODE ==================== */
.avatar-builder.compact .avatar-preview-container {
    width: 100px;
    height: 100px;
}

.avatar-builder.compact .avatar-option {
    width: 50px;
    height: 50px;
}

/* ==================== PROFILE AVATAR ==================== */
.profile-avatar-image {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--accent, #4ade80);
    background: var(--bg-tertiary, #2d3748);
    position: relative;
}

.profile-avatar-image .avatar-stack {
    width: 100%;
    height: 100%;
}

/* ==================== MINI AVATAR ==================== */
.avatar-mini {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--accent, #4ade80);
    display: inline-block;
    vertical-align: middle;
}

.avatar-mini .avatar-stack {
    width: 100%;
    height: 100%;
}

/* ==================== UNLOCK TOOLTIP ==================== */
.avatar-option[title] {
    position: relative;
}

.avatar-option.locked::before {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary, #1a1f26);
    color: var(--text-primary, #e0e0e0);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75em;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
    border: 1px solid var(--border-color, #2d3748);
}

.avatar-option.locked:hover::before {
    opacity: 1;
}

/* ==================== ANIMATIONS ==================== */
@keyframes avatarUnlock {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); box-shadow: 0 0 30px var(--gold, #fbbf24); }
    100% { transform: scale(1); }
}

.avatar-option.just-unlocked {
    animation: avatarUnlock 0.6s ease;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 480px) {
    .avatar-option {
        width: 50px;
        height: 50px;
    }
    
    .avatar-preview-container {
        width: 120px;
        height: 120px;
    }
}
