/**
 * 头像裁剪组件样式
 */

.avatar-cropper-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-cropper-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
}

.avatar-cropper-container {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.avatar-cropper-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.avatar-cropper-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.avatar-cropper-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.avatar-cropper-close:hover {
    background: #f3f4f6;
}

.avatar-cropper-body {
    padding: 20px;
}

.avatar-cropper-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
}

.avatar-cropper-preview canvas {
    width: 100%;
    height: 100%;
    cursor: grab;
}

.avatar-cropper-preview canvas:active {
    cursor: grabbing;
}

.avatar-cropper-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.avatar-cropper-zoom {
    display: flex;
    align-items: center;
    gap: 12px;
}

.zoom-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    border-radius: 8px;
    font-size: 18px;
    color: #374151;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.zoom-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.zoom-slider {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #e5e7eb;
    border-radius: 2px;
    outline: none;
}

.zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #111827;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
}

.zoom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.zoom-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #111827;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.avatar-cropper-hint {
    font-size: 12px;
    color: #9ca3af;
    text-align: center;
    margin: 0;
}

.avatar-cropper-footer {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
}

.avatar-cropper-cancel,
.avatar-cropper-confirm {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.avatar-cropper-cancel {
    background: #ffffff;
    border: 1px solid #d1d5db;
    color: #374151;
}

.avatar-cropper-cancel:hover {
    background: #f3f4f6;
}

.avatar-cropper-confirm {
    background: #111827;
    border: 1px solid #111827;
    color: #ffffff;
}

.avatar-cropper-confirm:hover {
    background: #1f2937;
}

/* 头像预览样式 */
.avatar-preview-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.avatar-preview {
    width: 96px;
    height: 96px;
    border-radius: 4px;
    object-fit: cover;
    border: 2px solid #e5e7eb;
    transition: border-color 0.2s;
}

.avatar-preview-container:hover .avatar-preview {
    border-color: #111827;
}

.avatar-preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.avatar-preview-container:hover .avatar-preview-overlay {
    opacity: 1;
}

.avatar-preview-overlay svg {
    width: 24px;
    height: 24px;
    color: #ffffff;
    margin-bottom: 4px;
}

.avatar-preview-overlay span {
    font-size: 12px;
    color: #ffffff;
}

/* 响应式调整 */
@media (max-width: 480px) {
    .avatar-cropper-container {
        width: 95%;
        margin: 10px;
    }
    
    .avatar-cropper-header {
        padding: 12px 16px;
    }
    
    .avatar-cropper-body {
        padding: 16px;
    }
    
    .avatar-cropper-footer {
        padding: 12px 16px;
    }
}