/* ============================================
   會員頭像上傳組件樣式
   ============================================ */

.user-avatar-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
}

.user-avatar {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--font-size-xxl);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 4px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.user-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.user-avatar:hover .avatar-overlay {
    opacity: 1;
}

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

.avatar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 50%;
}

.avatar-overlay i {
    font-size: var(--font-size-lg);
    margin-bottom: var(--spacing-xs);
}

.avatar-overlay span {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
}

.avatar-actions {
    display: flex;
    gap: var(--spacing-xs);
}

.btn-avatar-action {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--light-color);
    border: 1px solid var(--border-color);
    color: var(--gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-avatar-action:hover {
    background: var(--primary-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.btn-avatar-action:active {
    transform: translateY(0);
}

.user-status {
    display: flex;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-xs);
}

.status-badge {
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
}

.member-level {
    background: var(--warning-light);
    color: var(--warning-dark);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    border: 1px solid var(--warning-color);
}

/* 頭像上傳模態框 */
.avatar-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.avatar-modal.active {
    display: flex;
}

.avatar-modal-content {
    background: white;
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.avatar-modal-header {
    padding: var(--spacing);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.avatar-modal-header h3 {
    margin: 0;
    color: var(--dark-color);
}

.btn-close-modal {
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    font-size: var(--font-size-lg);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-close-modal:hover {
    background: var(--light-color);
    color: var(--danger-color);
}

.avatar-modal-body {
    padding: var(--spacing);
}

.avatar-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-xl);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: var(--spacing);
}

.avatar-upload-area:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.avatar-upload-area.drag-over {
    border-color: var(--success-color);
    background: var(--success-light);
}

.avatar-upload-icon {
    font-size: var(--font-size-xxl);
    color: var(--primary-color);
    margin-bottom: var(--spacing);
}

.avatar-upload-text h4 {
    margin: 0 0 var(--spacing-xs) 0;
    color: var(--dark-color);
}

.avatar-upload-text p {
    margin: 0;
    color: var(--gray);
    font-size: var(--font-size-sm);
}

.avatar-upload-requirements {
    font-size: var(--font-size-xs);
    color: var(--gray-light);
    margin-top: var(--spacing-xs);
}

.avatar-preview-container {
    display: none;
    margin-bottom: var(--spacing);
}

.avatar-preview {
    width: 200px;
    height: 200px;
    margin: 0 auto var(--spacing) auto;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--border-color);
    position: relative;
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 2px dashed white;
    border-radius: 50%;
    pointer-events: none;
}

.avatar-crop-controls {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    align-items: center;
}

.avatar-zoom-slider {
    width: 80%;
}

.avatar-zoom-slider input {
    width: 100%;
}

.avatar-rotation-controls {
    display: flex;
    gap: var(--spacing);
}

.btn-rotate {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--light-color);
    border: 1px solid var(--border-color);
    color: var(--gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-rotate:hover {
    background: var(--primary-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.avatar-upload-progress {
    display: none;
    margin-bottom: var(--spacing);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--light-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: var(--spacing-xs);
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: var(--font-size-sm);
    color: var(--gray);
    text-align: center;
}

.avatar-modal-footer {
    padding: var(--spacing);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing);
}

.btn-secondary {
    padding: var(--spacing-sm) var(--spacing);
    background: var(--light-color);
    border: 1px solid var(--border-color);
    color: var(--dark-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: var(--font-weight-medium);
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--gray-light);
}

.btn-primary {
    padding: var(--spacing-sm) var(--spacing);
    background: var(--primary-color);
    border: 1px solid var(--primary-color);
    color: white;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: var(--font-weight-medium);
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 頭像歷史模態框 */
.avatar-history-modal .avatar-modal-content {
    max-width: 800px;
}

.avatar-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--spacing);
    max-height: 400px;
    overflow-y: auto;
    padding: var(--spacing-sm);
}

.avatar-history-item {
    position: relative;
    cursor: pointer;
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: all 0.2s ease;
}

.avatar-history-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.avatar-history-item img {
    width: 100%;
    height: 100px;
    object-fit: cover;
}

.avatar-history-item.active::after {
    content: '當前使用';
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--success-color);
    color: white;
    font-size: var(--font-size-xs);
    padding: 2px 6px;
    border-radius: 10px;
}

.avatar-history-date {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: var(--font-size-xs);
    padding: 4px;
    text-align: center;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .user-avatar {
        width: 100px;
        height: 100px;
        font-size: var(--font-size-xl);
    }
    
    .avatar-modal-content {
        width: 95%;
        margin: var(--spacing);
    }
    
    .avatar-preview {
        width: 150px;
        height: 150px;
    }
    
    .avatar-history-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
}

@media (max-width: 480px) {
    .user-avatar {
        width: 80px;
        height: 80px;
        font-size: var(--font-size-lg);
    }
    
    .avatar-actions {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .avatar-modal-footer {
        flex-direction: column;
    }
    
    .avatar-modal-footer button {
        width: 100%;
    }
}