/* Avatar Picker Customizable Profile Image Styles (HBO Max Inspired) */

/* User avatar wrapper in unified header */
.user-avatar-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    cursor: pointer;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid #e2e8f0;
}

.user-avatar-wrapper:hover {
    border-color: #0161bb;
}

/* Rendered avatar circle inside the wrapper */
.user-avatar-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 30px;
    background-color: #1e293b; /* Fond sombre par défaut */
    transition: background-color 0.2s ease;
    overflow: hidden;
}

.user-avatar-circle .material-symbols-outlined {
    font-size: 36px;
    color: #ffffff;
    font-weight: 500;
}

.user-avatar-circle img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.user-avatar-circle img.avatar-img-char {
    object-fit: contain;
}

.user-avatar-circle img.avatar-img-custom {
    object-fit: cover; /* Cover circle for photos */
}

/* Edit pencil badge */
.avatar-edit-badge {
    position: absolute;
    bottom: 0px;
    right: 0px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #0161bb;
    border: 2px solid #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.user-avatar-wrapper:hover .avatar-edit-badge {
    background: #014b91;
    transform: scale(1.1);
}

/* Overlay & modal transitions */
@keyframes zoomInFade {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Overlay background with modern backdrop-filter */
.avatar-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

/* Modal Card with premium dark-slate styling and neon border highlights */
.avatar-picker-card {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
    animation: zoomInFade 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.avatar-picker-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #f8fafc;
}

.avatar-picker-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
    padding: 0;
}

.avatar-picker-close:hover {
    color: #f1f5f9;
}

.avatar-picker-body {
    padding: 24px;
}

.avatar-picker-subtitle {
    margin: 0 0 20px 0;
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.5;
}

/* Tabs for modal */
.avatar-picker-tabs {
    display: flex;
    justify-content: space-around;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 20px;
}

.avatar-tab-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
    flex-grow: 1;
    text-align: center;
}

.avatar-tab-btn:hover {
    color: #f1f5f9;
}

.avatar-tab-btn.active {
    color: #0161bb;
    border-bottom-color: #0161bb;
}

/* Grid of options */
.avatar-selection-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    max-height: 240px;
    overflow-y: auto;
    padding: 10px 5px;
}

/* Responsive wrap */
@media (max-width: 480px) {
    .avatar-selection-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
    .avatar-category-subgrid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
}

/* Individual avatar option */
.avatar-option-cell {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    border: 3px solid transparent;
    box-sizing: border-box;
}

.avatar-option-cell:hover {
    transform: scale(1.12);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.35);
}

/* Selected state marker */
.avatar-option-cell.is-selected {
    border-color: #ffffff;
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.5), 0 4px 15px rgba(0, 0, 0, 0.4);
    transform: scale(1.08);
}

/* Selected checkmark check indicator badge */
.avatar-option-cell.is-selected::after {
    content: "check_circle";
    font-family: 'Material Symbols Outlined';
    font-weight: bold;
    font-size: 20px;
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 22px;
    height: 22px;
    background: #10b981;
    color: #ffffff;
    border: 2px solid #1e293b;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    animation: zoomInFade 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.avatar-option-cell .material-symbols-outlined {
    font-size: 38px;
    color: #ffffff;
    transition: transform 0.2s ease;
}

.avatar-option-cell:hover .material-symbols-outlined {
    transform: scale(1.1) rotate(5deg);
}

/* Character grid specific */
.avatar-character-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 260px;
    overflow-y: auto;
    padding: 10px 5px;
}

.avatar-category-title {
    margin: 8px 0;
    font-size: 13px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
}

.avatar-category-subgrid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 12px;
}

.avatar-character-cell {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    cursor: pointer;
    overflow: hidden;
    box-shadow: none;
    border: 2px solid transparent;
    transition: all 0.2s ease-in-out;
    box-sizing: border-box;
    background-color: #1e293b; /* Default: gris sombre pour bien voir l'avatar */
}

.avatar-character-cell img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.avatar-character-cell:hover {
    box-shadow: none;
    border-color: #ffffff;
}

.avatar-character-cell.is-selected {
    border-color: #ffffff;
    box-shadow: none;
}

.avatar-character-cell.is-selected::after {
    content: "check_circle";
    font-family: 'Material Symbols Outlined';
    font-weight: bold;
    font-size: 20px;
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 22px;
    height: 22px;
    background: #10b981;
    color: #ffffff;
    border: 2px solid #1e293b;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    z-index: 5;
    animation: zoomInFade 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Custom upload & link elements styles */
.avatar-custom-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.custom-avatar-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 12px 24px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    justify-content: center;
}

.custom-avatar-upload-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #0161bb;
    color: #0161bb;
}

.avatar-custom-separator {
    text-align: center;
    color: #64748b;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    margin: 8px 0;
    position: relative;
}

.avatar-custom-separator::before,
.avatar-custom-separator::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
}

.avatar-custom-separator::before { left: 0; }
.avatar-custom-separator::after { right: 0; }

.avatar-custom-url-section {
    width: 100%;
}

.avatar-url-input-wrapper {
    display: flex;
    gap: 8px;
    width: 100%;
}

#avatar-url-input {
    flex-grow: 1;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 10px 14px;
    color: #ffffff;
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

#avatar-url-input:focus {
    border-color: #0161bb !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

.avatar-url-btn {
    background: #0161bb;
    border: none;
    border-radius: 12px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.avatar-url-btn:hover {
    background: #014b91 !important;
    box-shadow: 0 4px 12px rgba(1, 97, 187, 0.3);
}

.avatar-url-btn .material-symbols-outlined {
    font-size: 20px;
}

/* Preview & Color Selector Section */
.avatar-picker-preview-section {
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 20px;
}

.avatar-picker-preview-wrapper {
    flex-shrink: 0;
}

.avatar-picker-preview-wrapper .user-avatar-circle {
    width: 72px;
    height: 72px;
    border: 2px solid #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.avatar-picker-color-selector {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.color-selector-label {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
}

/* Dots rapides */
.avatar-colors-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
}

.avatar-color-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.avatar-color-dot:hover {
    transform: scale(1.18);
    border-color: rgba(255, 255, 255, 0.5);
}

.avatar-color-dot.is-active {
    transform: scale(1.12);
    border-color: #fff;
    box-shadow: 0 0 0 2px #0161bb, 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* ── Color Dropdown ────────────────────────────────────────────── */
.avatar-color-dropdown {
    position: relative;
    margin-bottom: 6px;
}

.avatar-color-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
    text-align: left;
}

.avatar-color-dropdown-trigger:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
}

.avatar-color-dropdown-trigger .material-symbols-outlined {
    font-size: 18px;
    color: #64748b;
    margin-left: auto;
    transition: transform 0.2s ease;
}

.avatar-color-dropdown.is-open .avatar-color-dropdown-trigger .material-symbols-outlined {
    transform: rotate(180deg);
}

.avatar-color-dropdown.is-open .avatar-color-dropdown-trigger {
    border-color: #0161bb;
    background: rgba(1, 97, 187, 0.08);
}

.avatar-color-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 999;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    max-height: 220px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    padding: 4px;
}

.avatar-color-dropdown.is-open .avatar-color-dropdown-menu {
    display: block;
}

.avatar-color-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 13px;
    color: #cbd5e1;
    transition: background 0.15s ease, color 0.15s ease;
}

.avatar-color-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #f1f5f9;
}

.avatar-color-dropdown-item.is-active {
    background: rgba(1, 97, 187, 0.15);
    color: #60a5fa;
    font-weight: 600;
}

.avatar-color-dot-mini {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    display: inline-block;
}

.avatar-color-item-name {
    flex: 1;
}

/* Modal Footer */
.avatar-picker-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: flex-end;
    background: #1e293b;
}

.avatar-picker-save-btn {
    background: #0161bb;
    border: none;
    border-radius: 12px;
    padding: 10px 24px;
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.avatar-picker-save-btn:hover {
    background: #014b91;
    box-shadow: 0 4px 12px rgba(1, 97, 187, 0.3);
}

/* ── Advanced Color Picker ───────────────────────────────────── */
.avatar-color-advanced {
    margin-top: 8px;
}

.avatar-color-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.avatar-color-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.avatar-color-col--rgb {
    flex: 1;
}

.avatar-color-rgb-group {
    display: flex;
    gap: 4px;
    align-items: flex-end;
}

.avatar-color-input--full {
    width: 100%;
    box-sizing: border-box;
}

.avatar-color-field {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.avatar-color-field--rgb {
    min-width: 44px;
}

.avatar-color-field-label {
    font-size: 9px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding-left: 2px;
}

.avatar-color-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 12px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    padding: 5px 8px;
    width: 80px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -moz-appearance: textfield;
    appearance: textfield;
}

.avatar-color-input::-webkit-outer-spin-button,
.avatar-color-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.avatar-color-input--small {
    width: 44px;
    padding: 5px 4px;
    text-align: center;
}

.avatar-color-input:focus {
    border-color: #0161bb;
    box-shadow: 0 0 0 2px rgba(1, 97, 187, 0.25);
    background: rgba(1, 97, 187, 0.08);
}

.avatar-color-input.is-invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.avatar-color-eyedropper-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-top: 0;
    align-self: flex-end;
}

.avatar-color-eyedropper-btn:hover {
    background: rgba(1, 97, 187, 0.15);
    border-color: #0161bb;
    color: #60a5fa;
    transform: scale(1.05);
}

.avatar-color-eyedropper-btn:active {
    transform: scale(0.96);
}

.avatar-color-eyedropper-btn .material-symbols-outlined {
    font-size: 16px;
}

.avatar-color-eyedropper-btn.is-unavailable {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}




