/* Стили для модального окна аватара */
#avatarModal .modal-content {
    border-radius: 12px;
    overflow: hidden;
}

#avatarModal .current-avatar-section {
    padding: 15px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #f8f9fa;
    margin-bottom: 20px;
}

#avatarModal .current-avatar-section h6 {
    margin-bottom: 10px;
    color: #495057;
    font-weight: 600;
}

#avatarPreview img {
    max-width: 200px;
    max-height: 200px;
    object-fit: cover;
    border-radius: 8px;
    margin: 0 auto;
    display: block;
}

/* Стили для Cropper */
.crop-container {
    max-height: 400px;
    overflow: hidden;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 15px;
}

.crop-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 15px;
}

.crop-controls .btn {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
}

/* Стили для Cropper переопределения */
.cropper-view-box,
.cropper-face {
    border-radius: 50%;
}

.cropper-view-box {
    outline: 2px solid #007bff;
    outline-color: rgba(0, 123, 255, 0.75);
}

.cropper-line {
    background-color: #007bff;
}

.cropper-point {
    background-color: #007bff;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* Кнопки модального окна */
#avatarModal .modal-footer {
    border-top: 1px solid #dee2e6;
    padding: 15px 20px;
}

#removeAvatarBtn {
    margin-right: auto;
}


#avatarModal .qchat-avatar-upload-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2rem;
    margin-top: 0.5rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid rgba(13, 110, 253, 0.25);
    border-radius: 0.5rem;
    background: rgba(13, 110, 253, 0.06);
    color: inherit;
    font-size: 0.875rem;
}

#avatarModal .qchat-avatar-upload-status.d-none {
    display: none !important;
}

#avatarModal[aria-busy="true"] .modal-footer .btn:disabled,
#avatarModal[aria-busy="true"] .crop-controls .btn:disabled,
#avatarModal[aria-busy="true"] #avatarChooseFileBtn:disabled {
    cursor: wait;
}

/* QChat avatar modal: dark-theme surfaces + native cropper aspect-ratio guard. */
#avatarModal .qchat-native-cropper-stage #cropImage {
    /* Bootstrap .img-fluid and #cropImage { max-height: 300px } must not clamp
       the intrinsic cropper dimensions: clamping only one axis visibly squashes
       portrait/landscape images. The cropper itself controls width/height. */
    max-width: none !important;
    max-height: none !important;
}

body.dark-theme #avatarModal .current-avatar-section,
body.dark-theme #avatarModal .crop-container {
    background: #0d1117 !important;
    color: #c9d1d9 !important;
    border-color: #30363d !important;
}

body.dark-theme #avatarModal .current-avatar-section h6 {
    color: #c9d1d9 !important;
}

body.dark-theme #avatarModal .qchat-native-cropper-stage {
    background: #161b22 !important;
}

body.dark-theme #avatarModal .img-thumbnail {
    background-color: #21262d !important;
    border-color: #30363d !important;
}

@media (prefers-color-scheme: dark) {
    body.auto-theme #avatarModal .current-avatar-section,
    body.auto-theme #avatarModal .crop-container {
        background: #0d1117 !important;
        color: #c9d1d9 !important;
        border-color: #30363d !important;
    }

    body.auto-theme #avatarModal .current-avatar-section h6 {
        color: #c9d1d9 !important;
    }

    body.auto-theme #avatarModal .qchat-native-cropper-stage {
        background: #161b22 !important;
    }

    body.auto-theme #avatarModal .img-thumbnail {
        background-color: #21262d !important;
        border-color: #30363d !important;
    }
}
